SOCO-Java-PLBART-ST / README.md
buelfhood's picture
Add new SentenceTransformer model
308b3c5 verified
|
Raw History Blame Contribute Delete
112 kB
--- tags: - sentence-transformers - sentence-similarity - feature-extraction - generated_from_trainer - dataset_size:33411 - loss:BatchAllTripletLoss base_model: uclanlp/plbart-java-cs widget: - source_sentence: "\nimport java.io.*;\nimport java.net.*;\n\npublic class Copier\n\ {\n private URL target;\n\n public Copier( String fileName)\n {\n try\n\ \ {\n String line;\n BufferedReader ;\n\t BufferedWriter\ \ bout;\n target = new URL( \"http://www.cs.rmit.edu./students\");\n\t\ \ InputStream hm = target.openStream();\n\t HttpURLConnection urlcon = ( HttpURLConnection)\ \ target.openConnection();\n bf = new BufferedReader( new InputStreamReader(\ \ target.openStream()));\n\t bout = new BufferedWriter(new FileWriter(fileName));\n\ \ while((line = bf.readLine()) != null)\n {\n bout.write(\ \ line+\"\\n\"); \n }\n\t \n\t bout.print();\n }\n catch( Exception\ \ e)\n {\n System.out.println(\"Something wrong! \"+e);\n \ \ System.exit(0);\n }\n }\n public static void main (String[] args)\n\ \ {\n Copier c = new Copier(\"response.html\");\n }\n}\n\n \n\ \ \n\n \n\n\n \n\n\t\n" sentences: - "import java.io.*;\nimport java.net.*;\nimport java.util.*;\n\n\npublic class\ \ Dictionary\n{\n\tpublic static void main (String args[])\n\t{\n\t\t\n\t\t\n\ \ Calendar cal = Calendar.getInstance();\n Date now=cal.getTime();\n\ \ double startTime = now.getTime();\n\n\t\tString password=getPassword(startTime);\n\ \t\tSystem.out.println(\"The password is \" + password);\n\t}\n\n\tpublic static\ \ String getPassword(double startTime)\n\t{\n\t\tString password=\"\";\n\t\tint\ \ requests=0;\n\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\tFileReader fRead = new FileReader(\"\ /usr/share/lib/dict/words\");\n\t\t\tBufferedReader buf = new BufferedReader(fRead);\n\ \n\t\t\tpassword=buf.readLine();\n\n\t\t\twhile (password != null)\n\t\t\t{\n\t\ \t\t\t\n\t\t\t\tif (password.length()<=3)\n\t\t\t\t{\n\t\t\t\t\trequests++;\n\t\ \t\t\t\tif (testPassword(password, startTime, requests))\n\t\t\t\t\t\treturn password;\n\ \t\t\t\t}\n\n\t\t\t\tpassword = buf.readLine();\n\n\t\t\t}\n\t\t}\n\t\tcatch (IOException\ \ ioe)\n\t\t{\n\n\t\t}\n\n\t\treturn password;\n\t}\n\n\tprivate static boolean\ \ testPassword(String password, double startTime, int requests)\n\t{\n\t\ttry\n\ \t\t{\n\t\t\t\n\t\t\t\n\t\t\tURL url=new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\ );\n\n\t\t\tHttpURLConnection connection;\n\n \t\tString userPassword = \"\ :\" + password;\n\n \t\t\n \t\tString encoding = new url.misc.BASE64Encoder().encode\ \ (userPassword.getBytes());\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tconnection\ \ = (HttpURLConnection) url.openConnection();\n\t\t\t\t\n\t\t\t\tconnection.setRequestProperty(\"\ Authorization\", \" \" + encoding);\n\n\t\t\t\t\n\t\t\t\tint status=connection.getResponseCode();\n\ \n\t\t\t\tSystem.out.println(password + requests);\n\n\t\t\t\tif (status==200)\n\ \t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"It took \" + getTime(startTime) + \"\ \ milliseconds find the password.\");\n\t\t\t\t\tSystem.out.println(\" were \"\ \ + requests + \" requests .\");\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\ \treturn false;\n\n\t\t\t}\n\n\t\t\tcatch (IOException ioe)\n\t\t\t{\n\t\t\t\t\ System.out.print(ioe);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\n\t\tcatch (IOException\ \ MalformedURLException)\n\t\t{\n\t\t\tSystem.out.print(\"Invalid URL\");\n\t\t\ \treturn false;\n\t\t}\n\t}\n\n\n\tprivate static double getTime(double startTime)\n\ \t{\n\t\t\n\t\t\n Calendar cal = Calendar.getInstance();\n Date\ \ now=cal.getTime();\n double endTime = now.getTime();\n\n return\ \ endTime-startTime;\n\n\t}\n\n}\n" - "import java.io.*;\nimport java.net.*;\nimport java.util.*;\nimport java.*;\n\n\ \npublic class WatchDog {\n\n\npublic static final int interval = 79200000;\n\n\ public static void main(String[] args) {\n WatchDog wd = new WatchDog();\n\ \ Thread thread = new Thread();\n URLConnection conn = null;\n DataInputStream\ \ data = null;\n DataInputStream in = null;\n String line;\n String lines;\n\ \ String buffer = new String();\n String buffers = new String();\n String\ \ url = new String(\"http://www.cs.rmit.edu./students/\");\n boolean change;\n\ \ttry{\n\tURL myurl = new URL(url);\n conn = myurl.openConnection();\n\ \ conn.connect();\n Object content = null;\n \n System.out.println(\"\ Connection opened......\");\n System.out.println(\"Retrieving data from\ \ URL\");\n data = new DataInputStream(new BufferedInputStream(conn.getInputStream()));\n\ \ System.out.println(\" data from the URL......\");\n content =\ \ myurl.getContent();\n BufferedReader reader = null;\n\treader = new BufferedReader(new\ \ InputStreamReader((InputStream) content));\n\n \n while ((line\ \ = data.readLine()) != null)\n\n {\n System.out.println(line);\n\ \ FileWriter outnew = new FileWriter(\"watchdogresult.html\");\n \ \ outnew.write(line);\n }\n System.out.println(\"Waiting for\ \ any change....\");\n thread.sleep(79200000);\n conn = myurl.openConnection();\n\ \ conn.connect();\n in = new DataInputStream(new BufferedInputStream(conn.getInputStream()));\n\ \ while ((lines = in.readLine()) != null)\n {\n\n\t FileWriter newf\ \ = new FileWriter(\"watchdogresult.tmp\");\n newf.write(buffers);\n \ \ }\n\tchange = true;\n if(change);\n else{\n\tchange = false;\n\ \ \n\twd.mail();\n\t}\n}\n catch (InterruptedException e) {}\n catch (IOException\ \ e) {\n e.printStackTrace();\n String r = new String(e.getMessage());\n\ \ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n }\n\ \ else\n System.out.println(\"Other problems\");\n }\n }\n\n\npublic\ \ void mail(){\n\n try {\n\n String from = new String(\"Watchdog Reporter\"\ );\n String email = new String(\"@cs.rmit.edu.\");\n String subject\ \ = new String(\" is a change in \");\n\n \n URL u = new URL(\"mailto:\"\ \ + email);\n URLConnection c = u.openConnection();\n c.setDoInput(false);\n\ \ c.setDoOutput(true);\n System.out.println(\"Connecting...\");\n \ \ System.out.flush();\n c.connect();\n PrintWriter out =\n \ \ new PrintWriter(new OutputStreamWriter(c.getOutputStream()));\n\n \n \ \ out.println(\"From: \\\"\" + from + \"\\\" <\" +\n System.getProperty(\"\ user.name\") + \"@\" +\n InetAddress.getLocalHost().getHostName()\ \ + \">\");\n out.println(\": \" );\n out.println(\"Subject: \" + subject);\n\ \ out.println(); \n\n \n String line = new String(\"Watchdog observe\ \ that is a change in the web .\");\n out.close();\n System.out.println(\"\ Message sent.\");\n System.out.flush();\n }\n catch (Exception e) {\n\ \ System.err.println(e);\n }\n\n }\n\n}\n\n" - "\n\n\n\n \n\n\nclass BasicAuth {\n\n public BasicAuth() {}\n\n\n private\ \ static byte[] cvtTable = {\n (byte)'A', (byte)'B', (byte)'C', (byte)'D',\ \ (byte)'E',\n (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J',\n\ \ (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O',\n (byte)'P',\ \ (byte)'Q', (byte)'R', (byte)'S', (byte)'T',\n (byte)'U', (byte)'V', (byte)'W',\ \ (byte)'X', (byte)'Y',\n (byte)'Z',\n (byte)'a', (byte)'b', (byte)'c',\ \ (byte)'d', (byte)'e',\n (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j',\n\ \ (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o',\n (byte)'p',\ \ (byte)'q', (byte)'r', (byte)'s', (byte)'t',\n (byte)'u', (byte)'v', (byte)'w',\ \ (byte)'x', (byte)'y',\n (byte)'z',\n (byte)'0', (byte)'1', (byte)'2',\ \ (byte)'3', (byte)'4',\n (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',\n\ \ (byte)'+', (byte)'/'\n };\n\n static String encode(String name,\n\ \ String passwd) {\n byte input[] = (name + \"\ :\" + passwd).getBytes();\n byte[] output = new byte[((input.length / 3)\ \ + 1) * 4];\n int ridx = 0;\n int chunk = 0;\n\n for (int\ \ i = 0; i < input.length; i += 3) {\n int left = input.length - i;\n\ \n\n if (left > 2) {\n chunk = (input[i] << 16)|\n \ \ (input[i + 1] << 8) |\n input[i\ \ + 2];\n output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];\n \ \ output[ridx++] = cvtTable[(chunk&0x3F000) >>12];\n \ \ output[ridx++] = cvtTable[(chunk&0xFC0) >> 6];\n output[ridx++]\ \ = cvtTable[(chunk&0x3F)];\n } else if (left == 2) {\n\n \ \ chunk = (input[i] << 16) |\n (input[i + 1] << 8);\n\ \ output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];\n \ \ output[ridx++] = cvtTable[(chunk&0x3F000) >>12];\n output[ridx++]\ \ = cvtTable[(chunk&0xFC0) >> 6];\n output[ridx++] = '=';\n \ \ } else {\n\n chunk = input[i] << 16;\n \ \ output[ridx++] = cvtTable[(chunk&0xFC0000)>>18];\n output[ridx++]\ \ = cvtTable[(chunk&0x3F000) >>12];\n output[ridx++] = '=';\n \ \ output[ridx++] = '=';\n }\n }\n return\ \ new String(output);\n }\n}" - source_sentence: "\nimport java.io.*;\n\npublic class Dictionary\n{\n \n public\ \ static void main(String args[])throws Exception\n {\n String s = null;\n\ \ String pass=\"\";\n int at=0;\n String strLine=\"\";\n\ \ int i=0;\n\n BufferedReader in = new BufferedReader(new FileReader(\"\ /usr/share/lib/dict/words\"));\n \n start =System.currentTimeMillis();\n\ \ try\n {\n while((pass=strLine = in.readLine()) !=\ \ null)\n {\n \n if(pass.length()==3)\n\ \ {\n\n System.out.println(pass);\n \ \ at++;\n \n Process p =\ \ Runtime.getRuntime().exec(\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ );\n p.waitFor();\n i = p.exitValue();\n\ \n if(i==0)\n {\n \ \ finish=System.currentTimeMillis();\n \n\ \ float time=finish-start;\n\n \ \ System.out.println(\"PASSWORD CRACKED:\"+ pass + \" in \" + at + \"\ \ attempts \" );\n System.out.println(\"PASSWORD CRACKED:\"\ + pass + \" in \" + time + \" milliseconds \" );\n \ \ System.exit(0);\n }\n\n\n BufferedReader\ \ stdInput = new BufferedReader(new\n InputStreamReader(p.getInputStream()));\n\ \n BufferedReader stdError = new BufferedReader(new\n \ \ InputStreamReader(p.getErrorStream()));\n\n \ \ \n\n System.out.println(\"Standard output of the command\ \ \");\n while ((s = stdInput.readLine()) != null)\n \ \ {\n System.out.println(s);\n \ \ }\n\n \n System.out.println(\"\ Standard error of the command \");\n while ((s = stdError.readLine())\ \ != null)\n {\n System.out.println(s);\n\ \ }\n }\n }\n System.exit(0);\n\ \ }\n catch (IOException e)\n {\n System.out.println(\"\ Exception happened \");\n e.printStackTrace();\n System.exit(-1);\n\ \ }\n }\n}" sentences: - "import java.net.*;\nimport java.util.*;\n\npublic class BruteForce {\n\n public\ \ static void main(String[] args) {\n new CrackAttempt();\n }\n}\n\nclass\ \ CrackAttempt {\n public CrackAttempt() {\n final int MAX_LENGTH = 3;\n\ \ boolean auth = false;\n Date = new Date();\n boolean morePasswords\ \ = true;\n int passPtr = 0;\n StringBuffer validChars = new StringBuffer(\"\ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n char[] password\ \ = new char[MAX_LENGTH];\n\n password[0] = validChars.charAt(0);\n \ \ while (!auth && morePasswords) {\n String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\ ;\n try {\n \n Authenticator.setDefault(new CrackAuth(password));\n\ \ URL url = new URL(resource);\n HttpURLConnection conn\ \ = (HttpURLConnection)url.openConnection();\n conn.setRequestMethod(\"\ HEAD\");\n if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)\ \ {\n System.out.println(\"cracked with \" + new String(password));\n\ \ auth = true;\n }\n } catch (Exception e) {\n\ \ System.out.println(\" was exception: \" + e.getMessage());\n \ \ }\n int count = passPtr;\n while (true) {\n \ \ if (password[count] == validChars.charAt(validChars.length() - 1)) {\n \ \ password[count] = validChars.charAt(0);\n count--;\n\ \ } else {\n password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count]))\ \ + 1);\n break;\n }\n if (count < 0) {\n\ \ \n if (passPtr < MAX_LENGTH - 1) {\n \ \ passPtr++;\n password[passPtr] = validChars.charAt(0);\n\ \ } else {\n morePasswords = false;\n \ \ }\n break;\n }\n }\n \n }\ \ \n if (!auth) {\n System.out.println(\"Unable determine password\"\ );\n } else {\n time = (new Date()).getTime() - start.getTime();\n\ \ System.out.println(\"it took \" + String.valueOf(time) + \" milliseconds\ \ crack the password\");\n }\n }\n}\n\nclass CrackAuth extends Authenticator\ \ {\n char[] password;\n public CrackAuth(char[] password) {\n this.password\ \ = password;\n }\n\n protected PasswordAuthentication getPasswordAuthentication()\n\ \ {\n String user = \"\";\n return new PasswordAuthentication(user,\ \ password);\n }\n}\n" - "import java.net.*;\nimport java.io.*;\n\n\npublic class EmailClient\n{\n\tprivate\ \ String sender, recipient, hostName;\n\n\tpublic EmailClient(String nSender,\ \ String nRecipient, String nHost)\n\t{\n\t\tsender = nSender;\n\t\trecipient\ \ = nRecipient;\n\t\thostName = nHost;\n\t}\n\n\tpublic void sendMail(String subject,\ \ String message)\n\t{\n\t\ttry\n\t\t{\n\t\t\tSocket s1=null;\n\t\t\tInputStream\t\ is = null;\n\t\t\tOutputStream os = null;\n\n\t\t\tDataOutputStream = null;\n\ \n\t\t\ts1 = new Socket(hostName,25);\n\t\t\tis = s1.getInputStream();\n\t\t\t\ os = s1.getOutputStream();\n\n\t\t\tbd = new DataOutputStream(os);\n\n\t\t\tBufferedReader\ \ response = new BufferedReader(new InputStreamReader(is));\n\n\t\t\tbd.writeBytes(\"\ HELO \"+ InetAddress.getLocalHost().getHostName() + \"\\r\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\ \n\t\t\tbd.writeBytes(\"MAIL FROM:\"+sender+\"\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\ \n\t\t\tbd.writeBytes(\"RCPT :\"+recipient+\"\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\ \n\t\t\tbd.writeBytes(\"data\"+\"\\n\");\n\n\t\t\tbd.writeBytes(\"Subject:\"+subject+\"\ \\n\");\n\n\t\t\tbd.writeBytes(message+\"\\n.\\n\");\n\n\t\t\twaitForSuccessResponse(response);\n\ \t\t}\n\n\t\tcatch (UnknownHostException badUrl)\n\t\t{\n\t\t\tSystem.out.println(\"\ Host unknown.\");\n\t\t}\n\n\t\tcatch (EOFException eof)\n\t\t{\n\t\t\tSystem.out.println(\"\ <EOF>\");\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tSystem.out.println(\"\ got exception: \"+e);\n\t\t}\n\t}\n\n\tprivate static void\twaitForSuccessResponse(BufferedReader\ \ response) throws IOException\n\t{\n\t\tString rsp;\n\t\tboolean r250 = false;\n\ \n\t\twhile( ! r250 )\n\t\t{\n\t\t\trsp = response.readLine().trim();\n\n\t\t\t\ if(rsp.startsWith(\"250\"))\n\t\t\t\tr250 = true;\n\t\t}\n\n\t}\n}" - "\n\n\n\nimport java.io.*;\nimport java.net.*;\n\npublic class WatchDog\n{\n \ \ public static void main(String args[]) throws InterruptedException, MalformedURLException,\ \ IOException\n {\n final String fullurl = \"http://www.cs.rmit.edu./students/\"\ ;\n final int waitperiod = 1000*60*60*24;\n final String email = \"\ @cs.rmit.edu.\";\n lastmodified = 0;\n lastmodifiedsave = 0;\n \ \ boolean first = true;\n URL url = new URL(fullurl);\n while(true)\n\ \ {\n URLConnection uc = url.openConnection();\n lastmodified\ \ = uc.getLastModified();\n if(first)\n {\n \n \ \ lastmodifiedsave = lastmodified;\n first = false;\n \ \ Execute ex1 = new Execute(\"wget -q -nc -O \"+fullurl);\n }\n\ \ \n if(lastmodified != lastmodifiedsave)\n {\n \ \ lastmodifiedsave = lastmodified;\n \n Execute ex2\ \ = new Execute(\"mv .old\");\n \n Execute ex3 = new Execute(\"\ wget -q -nc -O \"+fullurl);\n Execute ex4 = new Execute(\"echo \\\"\ The \"+fullurl+\" was modified, here the modifications:\\\" > pagediff\");\n\ \ \n Execute ex5 = new Execute(\"diff .old >> pagediff\"\ );\n \n Execute ex6 = new Execute(\"mailx -s \\\" modification\\\ \" \\\"\"+email+\"\\\" < pagediff\");\n System.out.println(\"Modification\ \ notice! Check your mail.\");\n }\n \n \n Thread.sleep(waitperiod);\n\ \ }\n }\n}\n" - source_sentence: "\n\n\nimport java.io.*;\nimport java.util.*;\nimport java.*;\n\ import java.net.*;\n\npublic class WatchDog\n{\n\n static Process p = null;\n\ \ static Process qproc = null;\n\n static BufferedReader bf = null;\n static\ \ StringTokenizer tok = null;\n\n static String Path = null;\n static String\ \ str = null;\n static String urlStr=null;\n static boolean changed = false;\n\ \n static File indexfile = new File(\"index.html\");\n static File tmpfile\ \ = new File(\"tmpindex.html\");\n static File mdfile = new File(\"md5file.txt\"\ );\n static File tmpmdfile = new File(\"tmpmd5file.txt\");\n static PrintWriter\ \ mailwriter = null;\n\n\n public static void main(String[] args) \n {\n\n\ \ urlStr = \"http://www.cs.rmit.edu./\";\n\n try\n {\n \ \ \n mailwriter = new PrintWriter(new BufferedWriter(new FileWriter(\"\ tomail.txt\", false)));\n\n getLatest(urlStr);\n parseFile();\ \ \n\n mailwriter.read();\n\n if(changed)\n {\n \ \ System.out.println(\"Sending Mail\");\n p = Runtime.getRuntime().exec(\"\ ./mailscript\");\n p.waitFor();\n\n }\n else\n \ \ System.out.println(\" mail sent\");\n\n } catch (IOException ioe)\n\ \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n\n\n }\n\n\n static void getLatest(String urlStr)\n { \n \ \ \n URL url = null;\n \n try\n {\n url = new URL(urlStr);\n\ \n } catch (MalformedURLException mfurl)\n {\n System.out.println(\"\ Malformed URL\");\n mfurl.printStackTrace();\n }\n\n try\n\ \ {\n mailwriter.println();\n\n p = Runtime.getRuntime().exec(\"\ /usr//pwd\"); \n p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\ \ p.getInputStream()));\n\n Path=bf.readLine();\n\ \n if (indexfile.exists())\n {\n mailwriter.println(\"\ File with name 'index.html' found in directory.\");\n mailwriter.println(\"\ Renaming existing 'index.html' 'tmpindex.html...\");\n p = Runtime.getRuntime().exec(\"\ /usr//mv \"+indexfile+ \" \" + Path+\"/\"+tmpfile);\n p.waitFor();\n\ \ p = Runtime.getRuntime().exec(\"/usr//mv \"+mdfile+ \" \" + Path+\"\ /\"+tmpmdfile);\n mailwriter.println();\n mailwriter.println(\"\ File with name 'md5file.txt' found in directory.\");\n mailwriter.print(\"\ Renaming existing 'md5file.txt' 'tmpmd5file.txt...\");\n\n mailwriter.println(\"\ .\");\n\n mailwriter.println();\n }\n\n mailwriter.println(\"\ Downloading current version of site - \" + urlStr);\n p = Runtime.getRuntime().exec(\"\ /usr/local//wget \"+url);\n p.waitFor();\n if (!tmpfile.exists())\n\ \ {\n mailwriter.println(\"File - \" + urlStr + \"index.html\ \ saved disk for the first time.\");\n }\n\n\n } catch (IOException\ \ ioe)\n {\n System.out.println(\"IOException\");\n \ \ ioe.printStackTrace();\n }\n catch (IndexOutOfBoundsException\ \ iobe)\n {\n System.out.println(\"Index Out Of Bounds Exception\"\ );\n iobe.printStackTrace();\n }\n catch (Exception e)\n\ \ {\n System.out.println(\"Exception\");\n e.printStackTrace();\n\ \ }\n }\n\n static void parseFile()\n {\n\n Vector imgVect =\ \ new Vector();\n\n try\n {\n p = Runtime.getRuntime().exec(\"\ /usr//grep img \" + Path + \"/\"+ indexfile);\n p.waitFor();\n \ \ bf= new BufferedReader(new InputStreamReader(\n p.getInputStream()));\n\ \n while((str=bf.readLine())!=null)\n {\n bf = new\ \ StringTokenizer(str, \"\\\"\", false);\n \n while(bf.hasMoreTokens())\n\ \ {\n str=bf.nextToken();\n if ((str.indexOf(\"\ gif\") > 0) || (str.indexOf(\"jpg\") > 0))\n imgVect.addElement(str);\n\ \ }\n \n }\n\n }catch (IOException ioe)\n \ \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (Exception e)\n {\n System.out.println(\"\ Exception\");\n e.printStackTrace();\n }\n\n mailwriter.println(\"\ Creating file with md5sums of the webpage and images...\");\n md5Create(imgVect);\n\ \n }\n\n static void md5Create(Vector imgVect)\n {\n String tmpString\ \ = null;\n Vector imgNames = new Vector();\n\n try\n {\n \ \ PrintWriter pr = new PrintWriter(new BufferedWriter(new FileWriter(mdfile,\ \ false)));\n \n p=Runtime.getRuntime().exec(\"/usr/local//md5sum \"+indexfile);\n\ \ p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\ \ p.getInputStream()));\n pr.println(bf.readLine());\n\ \ \n for(int i=0; i<imgVect.size();i++)\n {\n imgNames.insertElementAt((getImgNames((String)imgVect.elementAt(i))),\ \ i);\n imgVect.setElementAt((getFullPath((String)imgVect.elementAt(i))),\ \ i);\n\n p=Runtime.getRuntime().exec(\"/usr/local//md5sum \"+(String)imgNames.elementAt(i));\n\ \ p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\ \ p.getInputStream()));\n pr.println(bf.readLine());\n\ \ rmImgFile(Path+\"/\"+(String)imgNames.elementAt(i));\n }\n\ \ pr.get();\n\n } catch (IOException ioe)\n {\n \ \ System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n\n if (tmpmdfile.exists())\n compVersions((imgVect.size())+1);\n\ \n }\n\n static void compVersions(int numlines)\n {\n\n int tmp = 0;\n\ \ int x = 0;\n String[] md5A = new String[numlines];\n Vector tmpmd5V\ \ = new Vector(); \n \n \ \ \n String[] tmpmd5A = null;\n StringTokenizer stoken\ \ = null;\n String mdImgName = null;\n String mdImgVal = null;\n \ \ String tmpImgName = null;\n String tmpImgVal = null;\n\n try\n\ \ {\n\n bf = new BufferedReader(new FileReader(mdfile));\n\n \ \ while((str = bf.readLine()) != null)\n {\n md5A[tmp]=str;\n\ \ tmp++;\n }\n\n bf= new BufferedReader(new FileReader(tmpmdfile));\n\ \ tmp=0;\n\n while ((str = bf.readLine()) !=null)\n {\n\ \ tmpmd5V.addElement(str);\n tmp++;\n }\n\n \ \ tmpmd5A = (String[])tmpmd5V.toArray(new String[tmpmd5V.size()]); \n\n\ \ if (tmpmd5A[0].compareTo(md5A[0]) != 0)\n {\n mailwriter.println(\"\ ---The file index.html has changed.---\");\n mailwriter.println(\"\ -Diff of old and new -\");\n changed=true;\n mailwriter.println();\n\ \ p=Runtime.getRuntime().exec(\"/usr/local//diff index.html tmpindex.html\"\ );\n p.waitFor();\n bf = new BufferedReader(new InputStreamReader(p.getInputStream()));\n\ \n while ((str = bf.readLine()) != null)\n mailwriter.println(str);\n\ \n }\n else\n {\n mailwriter.println(\"The\ \ file index.html hasn't changed.\");\n mailwriter.println();\n \ \ }\n\n mailwriter.println();\n mailwriter.println(\"Changes\ \ Images\");\n mailwriter.println(\"-----------------\");\n\n\n \ \ \n\n for (tmp=1; tmp<md5A.length; tmp++) \n {\n \ \ stoken = new StringTokenizer(md5A[tmp]);\n mdImgVal = stoken.nextToken();\n\ \ mdImgName = stoken.nextToken();\n for (x=1; x<tmpmd5A.length;\ \ x++)\n {\n stoken = new StringTokenizer(tmpmd5A[x]);\n\ \ tmpImgVal = stoken.nextToken();\n tmpImgName = stoken.nextToken();\n\ \n if (mdImgName.compareTo(tmpImgName) == 0)\n {\n\ \ if(mdImgVal.compareTo(tmpImgVal) == 0)\n {\n\ \ \n break;\n }\n \ \ else\n {\n mailwriter.println(\"\ The image \"+mdImgName+\" has changed.\");\n changed=true;\n\ \ break;\n }\n }\n \ \ if (x == ((tmpmd5A.length)-1))\n {\n mailwriter.println(\"\ The image \"+mdImgName+\" is new this \");\n changed=true;\n\ \ }\n }\n }\n\n for (tmp=1; tmp<tmpmd5A.length;\ \ tmp++) \n {\n stoken = new StringTokenizer(tmpmd5A[tmp]);\n\ \ tmpImgVal = stoken.nextToken();\n tmpImgName = stoken.nextToken();\n\ \ for (x=1; x<md5A.length; x++)\n {\n stoken\ \ = new StringTokenizer(md5A[x]);\n mdImgVal = stoken.nextToken();\n\ \ mdImgName = stoken.nextToken();\n if (tmpImgName.compareTo(mdImgName)\ \ == 0)\n {\n break;\n }\n \ \ if (x == ((md5A.length)-1))\n {\n mailwriter.println(\"\ The image \"+tmpImgName+\" is longer the \");\n changed=true;\n\ \ }\n }\n }\n\n\n } catch(IOException ioe)\n\ \ {System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch(InterruptedException iex)\n {System.out.println(\"\ Interrupted Exception\");\n iex.printStackTrace();\n }\n\n }\n\ \n\n static Object getFullPath(String fname)\n {\n \n\n if(fname.charAt(0)==\ \ '/') \n fname=urlStr+fname; \n else if(fname.charAt(0) != 'h')\n\ \ fname=urlStr+'/'+fname;\n\n getImgFile(fname);\n\n return\ \ (Object)fname; \n }\n\n static void getImgFile(String fullPath)\n {\n\ \ \n\n try\n {\n qproc=Runtime.getRuntime().exec(\"/usr/local//wget\ \ \"+fullPath);\n qproc.waitFor();\n\n } catch (IOException ioe)\n\ \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n }\n\n static void rmImgFile(String delpath)\n {\n \n\n\ \ try\n {\n qproc=Runtime.getRuntime().exec(\"/usr//rm \"+ delpath);\n\ \ qproc.waitFor();\n\n } catch (IOException ioe)\n {\n \ \ System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n \n }\n\n static Object getImgNames(String prsName)\n {\n\ \ \n \n String str = new StringTokenizer(prsName, \"/\", false);\n\ \n while(bgf.hasMoreTokens())\n {\n str=bgf.nextToken();\n \ \ if ((str.indexOf(\"gif\") > 0) || (str.indexOf(\"jpg\") > 0))\n \ \ prsName=str;\n }\n return (Object)prsName;\n }\n}\n" sentences: - "\t\n\n\nimport java.io.*;\nimport java.net.*;\n\nimport java.util.*;\n\nimport\ \ java.misc.BASE64Encoder;\n\npublic class Dictionary {\n\n private String userId;\n\ \ private String password;\n\n\tReadDictionary myWords = new ReadDictionary();\n\ \n public Dictionary() {\n\n\t\n\tmyWords.openFile();\n\n \n Authenticator.setDefault\ \ (new MyAuthenticator());\n\t\n\t\n }\n\n public String fetchURL (String urlString)\ \ {\n\n\n\tStringBuffer sb = new StringBuffer();\n\tHttpURLConnection connection;\n\ \tDate startTime, endTime;\n\tint responseCode = -1;\n\tboolean retry = true;\t\ \n\t\n URL url;\n\tstartTime = new Date();\n\t\n System.out.println (\"\ \ time :\" + startTime);\n\n\twhile (retry == true)\n\t{\n\t\n\t try {\n\n\t\ \t\turl = new URL (urlString);\n\n\t\t\tconnection = (HttpURLConnection)url.openConnection();\n\ \n\t\t\tsetUserId(\"\");\n\t\t\tsetPassword(\"rhk8611\");\n\n\t\t\tSystem.out.println(\"\ Attempting get a response : \" +connection.getURL() );\n\t\t\tresponseCode =\ \ connection.getResponseCode();\n\t\t\tSystem.out.print(responseCode + \" \");\n\ \n\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) \n\t\t\t{\n\t\t\t\tretry\ \ = false;\n\t\t\t\tSystem.out.println(\"**** ACCESS GRANTED *****\");\n\t\t\t\ } else\n\t\t\t{\n\t\t\t\tretry = true;\n\t\t\t\tthrow new IOException(\n\t\t\t\ \t\t\"HTTP response : \" + String.valueOf(responseCode) + \n\t\t\t\t\t\"\\nResponse\ \ Message: \" +connection.getResponseMessage() );\n\t\t\t}\n\n\t\t\tInputStream\ \ content = (InputStream)url.getContent();\n\t\t\tBufferedReader in = \n\t\t\ \tnew BufferedReader (new InputStreamReader (content));\n\t\t\tString line;\n\t\ \t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\t\tsb.append (line);\n\t\ \t\t\t}\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\t\n\t\t\t\tretry=false;\n\ \t\t\t\tSystem.out.println (\"Invalid URL\" + e.getMessage());\n\t\t\t} catch\ \ (IOException e) {\n\t\t\t\t\n\t\t\t\tretry=true;\n\t\t\t\tconnection = null;\n\ \t\t\t\tSystem.out.println (\"Error URL \\n\" + e.getMessage());\n\t\t\t}\n\t\ \t}\t\n\t\tendTime = new Date();\n\t\tSystem.out.println (\"Total time taken (Sec)\ \ :\" + (endTime.getTime() - startTime.getTime())/1000);\n\t\t\n\t\t\n\treturn\ \ sb.toString();\n }\n\n\n public static void main (String args[]) {\n\tDictionary\ \ myGenerator = new Dictionary();\n\t\nString pageFound = myGenerator.fetchURL(\"\ http://sec-crack.cs.rmit.edu./SEC/2/\");\n\t\t\n\tSystem.out.println(\" ACCESSED\ \ ->\\n\" + pageFound);\n }\n\n class MyAuthenticator extends Authenticator\ \ {\n protected PasswordAuthentication getPasswordAuthentication()\n\t{\n\t\ \tString username = getUserId();\n\t\tString pass = myWords.readLine();\t\n\n\t\ \ System.out.println(\" Authenticating with -> \" + pass);\n\n\t return new\ \ PasswordAuthentication (username, pass.toCharArray());\n\t \n }\n }\n\t\ \n\tpublic String getPassword()\n\t{\n\t\treturn this.password;\n\t}\n\n\tpublic\ \ void setPassword(String password)\n\t{\n\t\tthis.password = password;\n\t}\n\ \n\t\n\tpublic String getUserId()\n\t{\n\t\treturn this.userId;\n\t}\n\n\tpublic\ \ void setUserId(String userId)\n\t{\n\t\tthis.userId = userId;\n\t}\n\n\n\n\n\ } \n\n\n" - "package java.httputils;\n\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\n\ import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\n\ import java.io.FileOutputStream;\nimport java.io.FileReader;\nimport java.io.IOException;\n\ import java.io.OutputStream;\n\n\npublic class WatchDog\n{\n protected final\ \ int MILLIS_IN_HOUR = (60 * 60 * 1000);\n protected int interval = 24;\n \ \ protected String URL = \"http://www.cs.rmit.edu./students/\";\n protected\ \ String fileName = \"WatchDogContent.html\";\n protected String command =\ \ \"./alert_mail.sh\";\n protected String savedContent;\n protected String\ \ retrievedContent;\n\n \n public WatchDog()\n {\n super();\n\ \ }\n\n \n public void run() throws Exception\n {\n HttpRequestClient\ \ client = null;\n \n \n System.out.println(getClass().getName()\ \ +\n \"Retrieving baseline copy of: \" + getURL());\n\ \ client = new HttpRequestClient(getURL());\n retrievedContent =\ \ client.getContent().toString();\n\n System.out.println(getClass().getName()\ \ +\n \"Writing baseline content : \" + getFileName());\n\ \ writeFile();\n\n while (true)\n {\n \n \ \ System.out.println(getClass().getName() +\n \ \ \" Sleeping for hours: \" + getInterval());\n Thread.currentThread().sleep(MILLIS_IN_HOUR\ \ * getInterval());\n\n \n System.out.println(getClass().getName()\ \ +\n \" Retrieving: \" + getURL());\n\n \ \ client = new HttpRequestClient(getURL());\n retrievedContent = client.getContent().toString();\n\ \n \n System.out.println(getClass().getName() +\n \ \ \" saved copy: \" + getURL());\n savedContent\ \ = readFile();\n\n \n System.out.println(getClass().getName()\ \ +\n \" Comparing saved and retrieved. \");\n \ \ if (!savedContent.equals(retrievedContent))\n {\n \ \ \n System.out.println(getClass().getName() +\n \ \ \" Difference found. \");\n\n writeTempFile();\n\ \ runCommand();\n }\n\n \n writeFile();\n\ \ }\n }\n\n\n \n public String runCommand()\n {\n String\ \ cmd = getCommand() + \" \\\"\" + getURL() + \"\\\"\";\n try\n \ \ {\n Runtime r = Runtime.getRuntime();\n System.out.println(getClass().getName()\ \ +\n \" Executing: \" + cmd);\n\n Process proc = r.exec(cmd);\n\ \ }\n catch (Exception e)\n {\n try\n \ \ {\n Runtime r = Runtime.getRuntime();\n Process\ \ proc = r.exec(cmd);\n }\n catch (Exception ex)\n \ \ {\n System.out.println(getClass().getName()\n \ \ + \" Could not run :\"\n + getCommand()\n \ \ + \" because : \"\n + ex.getMessage());\n \ \ }\n }\n\n return \"Executed successfully\";\n }\n\ \n \n protected String readFile() throws FileNotFoundException\n {\n\ \ BufferedInputStream input = null;\n FileInputStream file = null;\n\ \ StringBuffer content = new StringBuffer();\n try\n {\n\ \ file = new FileInputStream(getFileName());\n \n \ \ input = new BufferedInputStream(file);\n \n }\n \ \ catch (FileNotFoundException x)\n {\n System.err.println(\"\ File not found: \" + getFileName());\n throw x;\n }\n\n \ \ try\n {\n int ch;\n while ((ch = input.get())\ \ != -1)\n {\n content.append((char)ch);\n \ \ }\n }\n catch (IOException x)\n {\n x.printStackTrace();\n\ \ }\n finally\n {\n if (input != null)\n \ \ {\n try\n {\n input.get();\n\ \ file.get();\n }\n catch (IOException\ \ e)\n {\n }\n }\n }\n \ \ return content.toString();\n }\n\n \n protected void writeFile() throws\ \ Exception\n {\n OutputStream os = null;\n try\n {\n\ \ os = new BufferedOutputStream(\n new FileOutputStream(getFileName(),\ \ false));\n os.write(getRetrievedContent().getBytes());\n }\n\ \ catch (FileNotFoundException e)\n {\n e.printStackTrace();\n\ \ throw e;\n }\n catch (IOException e)\n {\n \ \ e.printStackTrace();\n throw e;\n }\n finally\n\ \ {\n if (os != null)\n {\n try\n\ \ {\n os.close();\n }\n \ \ catch (IOException e)\n {\n }\n \ \ }\n }\n }\n\n \n protected void writeTempFile() throws\ \ Exception\n {\n OutputStream os = null;\n try\n {\n\ \ os = new BufferedOutputStream(\n new FileOutputStream(\"\ .html\", false));\n os.write(getRetrievedContent().getBytes());\n \ \ }\n catch (FileNotFoundException e)\n {\n e.printStackTrace();\n\ \ throw e;\n }\n catch (IOException e)\n {\n \ \ e.printStackTrace();\n throw e;\n }\n finally\n\ \ {\n if (os != null)\n {\n try\n\ \ {\n os.close();\n }\n \ \ catch (IOException e)\n {\n }\n \ \ }\n }\n }\n\n public static void main(String[] args)\n \ \ {\n WatchDog watchDog = new WatchDog();\n\n if (args.length\ \ < 3)\n {\n watchDog.printUsage();\n }\n\n \n\ \ System.out.println(watchDog.getClass().getName() +\n \ \ \": Initialising with \" +\n args[0] + \" \\n\"\ \ +\n args[1] + \" \\n\" +\n args[2]\ \ + \" \\n\");\n watchDog.setURL(args[0]);\n watchDog.setInterval(Integer.parseInt(args[1]));\n\ \ watchDog.setCommand(args[2]);\n\n \n try\n {\n \ \ System.out.println(watchDog.getClass().getName() + \": Invoking the\ \ run method.\");\n watchDog.run();\n }\n catch (Exception\ \ e)\n {\n e.printStackTrace();\n }\n }\n\n public\ \ String printUsage()\n {\n StringBuffer s = new StringBuffer();\n\n\ \ s.append(\"** WatchDog proper usage **\\n\\n\");\n s.append(\n\ \ this.getClass().getName() +\n \" <URL> <interval> <Command\ \ execute>\\n\\n\");\n\n return s.toString();\n }\n\n \n public\ \ String getCommand()\n {\n return command;\n }\n\n \n public\ \ String getFileName()\n {\n return fileName;\n }\n\n \n public\ \ int getInterval()\n {\n return interval;\n }\n\n \n public\ \ String getURL()\n {\n return URL;\n }\n\n \n public void\ \ setCommand(String string)\n {\n command = string;\n }\n\n \n\ \ public void setFileName(String string)\n {\n fileName = string;\n\ \ }\n\n \n public void setInterval(int i)\n {\n interval =\ \ i;\n }\n\n \n public void setURL(String string)\n {\n URL\ \ = string;\n }\n\n \n public String getRetrievedContent()\n {\n \ \ return retrievedContent;\n }\n\n \n public String getSavedContent()\n\ \ {\n return savedContent;\n }\n\n \n public void setRetrievedContent(String\ \ string)\n {\n retrievedContent = string;\n }\n\n \n public\ \ void setSavedContent(String string)\n {\n savedContent = string;\n\ \ }\n\n}\n" - "\n\nimport java.awt.*;\nimport java.util.*;\nimport java.net.*;\nimport java.io.*;\n\ import java.*;\n\n \npublic class BruteForce \n{\n public final char [ ] letter\ \ = {\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \n 'I', 'J', 'K',\ \ 'L', 'M', 'N', 'O', 'P', \n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',\ \ \n 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', \n 'g', 'h', 'i',\ \ 'j', 'k', 'l', 'm', 'n', \n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',\ \ \n 'w', 'x', 'y', 'z'};\t\t\t \n\n\n public static void main(String\ \ args[]) throws Exception\n {\n \n String urlPath = null;\n \ \ \n if(args.length > 0)\n {\n urlPath = args[0];\n\ \ System.out.println(\"URL \" + urlPath);\n BruteForce bForce\ \ = new BruteForce(urlPath); \n }\n else{\n \ \ System.out.println(\"Please enter URL at command prompt\");\n System.out.println(\"\ eg. >java BruteForce http://sec-crack.cs.rmit.edu./SEC/2/\");\n }\n\n \ \ System.exit(0);\n\n }\n\n \n public BruteForce(String urlPath)\ \ throws Exception\n {\n linkToWeb(urlPath);\n\n }\n\n public\ \ boolean linkToWeb(String urlPath) throws Exception\n {\n HttpURLConnection\ \ connection;\n int i, j, k; \n URL = new URL(urlPath);\n \ \ String let1 = null;\n String let2 = null;\n String let3 = null;\n\ \ String usrName = \"\";\n String usrNamePwd = null;\n String\ \ encoding = null;\n boolean ok = false;\n\n connection = (HttpURLConnection).openConnection();\ \ \n\n \n\n for(i=0; i<String.valueOf(letter).length(); i++)\ \ {\n let1 = String.valueOf(letter[i]);\t\t\n\n usrNamePwd\ \ = usrName +\":\"+ let1;\n encoding = new url.misc.BASE64Encoder().encode\ \ (usrNamePwd.getBytes());\n connection.setRequestProperty(\"Authorization\"\ , \" \" + encoding);\n\n System.out.println(let1);\n if(connection.getResponseCode()\ \ == 200){\n System.out.println(\"Password Found \" +let1); \n\ \ return true;\n }\n connection.disconnect();\n\ \n for(j=0; j<String.valueOf(letter).length(); j++) {\n \ \ let2 = let1 + letter[j];\t\t\n\n usrNamePwd = usrName +\"\ :\"+ let2;\n encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes());\n\ \n connection = (HttpURLConnection).openConnection();\n \ \ connection.setRequestProperty(\"Authorization\", \" \" + encoding);\n\ \n if(connection.getResponseCode() == 200){\n \ \ System.out.println(\"Password Found \" +let2);\n return\ \ true;\n }\n connection.disconnect();\n\n \ \ System.out.println(let2);\n\n for(k=0; k<String.valueOf(letter).length();\ \ k++) {\n let3 = let2 + letter[k]; \n \ \ \n usrNamePwd = usrName +\":\"+ let3;\n \ \ encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes());\n\ \ \n connection = (HttpURLConnection).openConnection();\n \ \ connection.setRequestProperty(\"Authorization\", \" \" + encoding);\n\ \n if(connection.getResponseCode() == 200){\n \ \ System.out.println(\"Password Found \" +let3);\n \ \ return true;\n }\n \n connection.disconnect();\n\ \ System.out.println(let3);\n \n \ \ }\n }\n\n }\n\n System.out.println(\"Password\ \ not found\" );\n return false;\n\n }\n\n\n\n public class Base64Converter\n\ \ {\n\n public final char [ ] alphabet = {\n 'A', 'B', 'C', 'D',\ \ 'E', 'F', 'G', 'H', \n 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', \n\ \ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', \n 'Y', 'Z', 'a', 'b',\ \ 'c', 'd', 'e', 'f', \n 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', \n\ \ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', \n 'w', 'x', 'y', 'z',\ \ '0', '1', '2', '3', \n '4', '5', '6', '7', '8', '9', '+', '/' }; \n\ \n public String encode ( String s )\n {\n return encode ( s.getBytes\ \ ( ) );\n }\n\n public String encode ( byte [ ] octetString )\n \ \ {\n int bits24;\n int bits6;\n\n char [ ] out\n \ \ = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];\n\n int\ \ outIndex = 0;\n int i = 0;\n\n while ( ( i + 3 ) <= octetString.length\ \ )\n {\n \n bits24 = ( octetString [ i++ ] & 0xFF )\ \ << 16; \n bits24 |= ( octetString [ i++ ] & 0xFF ) << 8; \n \ \ bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;\n\n bits6 = ( bits24\ \ & 0x00FC0000 ) >> 18; \n out [ outIndex++ ] = alphabet [ bits6 ];\n\ \ bits6 = ( bits24 & 0x0003F000 ) >> 12; \n out [ outIndex++\ \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6; \n\ \ out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24\ \ & 0x0000003F );\n out [ outIndex++ ] = alphabet [ bits6 ]; \n \ \ }\n\n if ( octetString.length - i == 2 )\n {\n \n \ \ bits24 = ( octetString [ i ] & 0xFF ) << 16; \n bits24\ \ |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n bits6 = ( bits24 & 0x00FC0000\ \ ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ]; \n bits6\ \ = ( bits24 & 0x0003F000 ) >> 12; \n out [ outIndex++ ] = alphabet [\ \ bits6 ]; \n bits6 = ( bits24 & 0x00000FC0 ) >> 6; \n out [\ \ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++\ \ ] = '='; \n }\n else if ( octetString.length - i == 1 )\n \ \ {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n\n\ \ bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ]\ \ = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12; \n \ \ out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out\ \ [ outIndex++ ] = '='; \n out [ outIndex++ ] = '='; \n }\n\n\ \ return new String ( out );\n }\n\n }\n \n}\n\n" - source_sentence: "\n\n\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\ \nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\n\ import javax.sql.DataSource;\n\n\n\npublic class DictionaryPropertyHelper {\n\n\ \tprivate static Properties dictProps;\n\n\n\n\tpublic DictionaryPropertyHelper()\ \ {\n\t}\n\n\n\t\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\ \t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"\ Error init'ing the dictionary Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\ \treturn dictProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps()\ \ throws Exception{\n\t\tif(dictProps == null){\n\t\t\tdictProps = new Properties();\n\ \n\t\t\tInputStream fis =\n\t\t\t\tDictionaryPropertyHelper.class.getResourceAsStream(\"\ /dictionary.properties\");\n\t\t\tdictProps.load(fis);\n\t\t}\n\t}\n}\n\n" sentences: - "\n\nimport java.net.*;\nimport java.io.*;\nimport java.String;\nimport java.*;\n\ import java.util.*;\n\npublic class BruteForce {\n private static final int passwdLength\ \ = 3; \n private static String commandLine\n = \"curl http://sec-crack.cs.rmit.edu./SEC/2/index.php\ \ -I -u :\";\n private String chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\ ;\n private int charLen = chars.length(); \n private int n = 0; \ \ \n private int n3 = charLen*charLen*charLen; \ \ \n private String response;\n private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];\n\ \ private char[][] data = new char[passwdLength][charLen];\n private char[]\ \ pwdChar2 = new char[2];\n private char[] pwdChar = new char[passwdLength];\n\ \ private String url;\n private int startTime;\n private int endTime;\n private\ \ int totalTime;\n private float averageTime;\n private boolean finish;\n private\ \ Process curl;\n private BufferedReader bf, responseLine;\n\n public BruteForce()\ \ {\n\n first();\n finish = true;\n charLen = chars.length();\n for(int i=0;\ \ i<charLen; i++)\n for(int j=0; j<passwdLength; j++)\n {\n data[j][i]\ \ = chars.charAt(i);\n }\n Runtime run = Runtime.getRuntime();\n n = 0;\n\n\ \ \n for(int i=0; i<charLen; i++)\n {\n password[n++] = chars.substring(i,i+1);\n\ \ }\n\n \n for(int j=0; j<charLen; j++)\n for(int k=0; k<charLen; k++)\n\ \ {\n pwdChar2[0] = data[0][j];\n pwdChar2[1] = data[1][k];\n\ \ password[n++] = String.copyValueOf(pwdChar2);\n }\n\n \n for(int\ \ i=0; i<charLen; i++)\n for(int j=0; j<charLen; j++)\n for(int k=0; k<charLen;\ \ k++)\n {\n pwdChar[0] = data[0][i];\n pwdChar[1] = data[1][j];\n\ \ pwdChar[2] = data[2][k];\n password[n++] = String.copyValueOf(pwdChar);\n\ \ }\n n = 0;\n startTime = new Date().getTime(); \n try {\n while(true)\ \ {\n url = commandLine+password[n++];\n if(n>=n3) {\n System.out.println(\"\ \\n not find the password for user .\");\n finish = false;\n break;\n\ \ }\n curl = run.exec(url); \n responseLine = new BufferedReader(new\ \ InputStreamReader(curl.getInputStream()));\n response = responseLine.readLine();\n\ \ \n \n if(response.substring(9,12).equals(\"200\")) break;\n responseLine\ \ = null;\n }\n }\n catch(IOException ioe){\n System.out.println(\"\\n\ \ IO Exception! \\n\");\n System.out.println(\"The current url is:\"+ url);\n\ \ System.out.println(\"The current trying password is:\"+password[n-1]);\n\ \ finish=false;\n }\n\n endTime = new Date().getTime(); \n totalTime\ \ = (endTime-startTime)/1000;\n System.out.println(\" The response time is:\"\ + totalTime + \" seconds\\n\");\n if(finish) {\n System.out.println(\" \ \ The password for is:\"+ password[n-1]);\n try {\n savePassword(password[n-1],\ \ totalTime);\n }\n catch (IOException ioec) {\n System.out.println(\"\ \ not save the password file BruteForce_pwd.txt \");\n }\n }\n }\n\n public\ \ void first() {\n\n System.out.println(\"\\n\\n---------------------------------------------------------------\"\ );\n System.out.println(\" Use curl command Brute Force the password for\ \ user .\");\n System.out.println(\" Attention: curl should able run at\ \ your directory\");\n System.out.println(\" without setting the Path\ \ for it.\");\n System.out.println(\"---------------------------------------------------------------\"\ );\n }\n\n\n public void savePassword(String passwdString, int time) throws\ \ IOException {\n DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(\"\ BruteForce_pwd.txt\"));\n outputStream.writeChars(\"The password is:\");\n outputStream.writeChars(passwdString+\"\ \\n\");\n outputStream.writeChars(\"The response time is: \");\n outputStream.writeChars(time1.toString(time));\n\ \ outputStream.writeChars(\" seconds\\n\");\n outputStream.close();\n }\n\n\ \ public static void main(String[] args) {\n new BruteForce();\n } \n}\n" - "import java.io.*;\nimport java.util.*;\nimport java.text.*;\n\n\npublic class\ \ Dictionary \n{\n\n \n \n \n private int verbose = 0;\n private\ \ int scanType = CrackingConstants.casedScan;\n private boolean leftThreeCharsOnly\ \ = false;\n private boolean fullScan = false;\n\n \n \n \n \n\ \ \n \n \n \n private int passwordsTried = 0;\n private int\ \ uniqueLetterSequencesTried = 0;\n\t\n\t\n\tpublic static void main (String args[])\n\ \t{\n\t\tint tIni;\n\t\tint tFinish;\n \t\tDateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL,\ \ DateFormat.FULL);\n\t Dictionary pwForcer = new Dictionary();\n\t \ \ \n\t if(0 < args.length)\n\t {\n\t for(int i = 0; i < args.length;\ \ i++)\n\t {\n \t\tif((args[i].indexOf(\"-h\") > -1) || (args[i].indexOf(\"\ -H\") > -1))\n \t\t {\n \t\t\tSystem.out.println(\"\\n-f -F\\\ tgenerates the three leftmost characters of the passwords as in -t/T \\nbut also\ \ appends the rest of the string ( duplicate checking is with this option).\"\ );\n \t\t\tSystem.out.println(\"\\n-s -S\\tonly tests lower passwords.\"\ );\n \t\t\tSystem.out.println(\"\\n-t -T\\tonly the three leftmost characters\ \ of the passwords.\");\n \t\t\tSystem.out.println(\"\\n-v -V\\tprints\ \ the passwords as tried.\\n\");\n \t\t\treturn;\n \t\t }\t\ \n \t\telse if((args[i].indexOf(\"-s\") > -1) || (args[i].indexOf(\"-S\"\ ) > -1))\n \t\t pwForcer.scanType = CrackingConstants.simpleScan;\n\ \ \t\telse if((args[i].indexOf(\"-v\") > -1) || (args[i].indexOf(\"-V\"\ ) > -1)) \n \t\t pwForcer.verbose = CrackingConstants.verboseMode2;\n\ \ \t\telse if((args[i].indexOf(\"-t\") > -1) || (args[i].indexOf(\"-T\"\ ) > -1))\n \t\t pwForcer.leftThreeCharsOnly = true;\n \t\telse\ \ if((args[i].indexOf(\"-f\") > -1) || (args[i].indexOf(\"-F\") > -1))\n \ \ \t\t pwForcer.fullScan = true;\n\t\t }\n\t }\n\t \n\t \n\ \t if (pwForcer.fullScan) \n\t \tpwForcer.leftThreeCharsOnly = false;\n\t\ \ \n \n\t System.out.println(\"\\n\\n********************************\\\ n\");\n\t\tSystem.out.println(\"Starting dictionary run at \" + \n\t\t longTimestamp.format(new\ \ Date()));\n\t\tif(0 < args.length)\n\t\t{\n\t\t\tString arguments = \"\";\n\t\ \t\tfor( i =0; i < args.length; i++)\n\t\t\t\targuments += args[i] + \" \";\n\t\ \t\tSystem.out.println(\"\\nOptions: \" + arguments + \"\\n\");\n\t\t}\n\t \ \ if (pwForcer.leftThreeCharsOnly)\n \t System.out.println(\"Only the first\ \ three letters of each password tried.\");\n\t\tif(pwForcer.scanType == CrackingConstants.simpleScan)\n\ \ \t System.out.println(\"Only lower passwords tried.\");\n \telse\n\ \ \t System.out.println(\"Both lower and upper passwords tried.\");\n\t\ \ System.out.println(\"\\n********************************\\n\");\n\n\t \ \ tIni = System.currentTimeMillis();\n\t pwForcer.run();\n\t tFinish = System.currentTimeMillis();\n\ \t \n if (CrackingConstants.casedScan == pwForcer.scanType)\n \ \ {\n\t \n \t \n\t \n\t \n\t System.out.println\ \ (\"\\n\\n\" + pwForcer.passwordsTried + \" capitalized passwords were tried.\"\ );\n\t System.out.println (\"That is \" + pwForcer.uniqueLetterSequencesTried\ \ + \" unique passwords were tried.\");\n\t \n\t \n }\n\ \ else\n {\n \t System.out.println (\"\\n\\n\" + pwForcer.passwordsTried\ \ + \" passwords were tried.\\n\");\n \t \n\t System.out.println\ \ (pwForcer.uniqueLetterSequencesTried + \" unique passwords were tried.\");\n\ \ }\n \n\t \n\t System.out.println(\"\\n********************************\\\ n\");\n\t\tSystem.out.println(\"Finished dictionary run at \" + \n\t\t longTimestamp.format(new\ \ Date()));\n\t\tSystem.out.println(\"Time taken: \" + ((tFinish - tIni )/1000)\ \ + \" seconds\");\n\t System.out.println(\"\\n********************************\"\ );\n\t} \n\n\t\n public Dictionary()\n {\n } \n\n\t\n private\ \ void run()\n {\n \n \n String fileName = \"/usr/share/lib/dict/words\"\ ;\n \n LoginAttemptResults results = new LoginAttemptResults();\n\ \ LoginAttempt login = new LoginAttempt();\n \n CasePasswords\ \ casedPasswords = new CasePasswords(verbose);\n \n \n try\n\ \ {\n boolean found = false;\n \n int\ \ lineCount = 0;\n \n String password = null;\n \ \ String lastPassword = \"\"; \n BufferedReader in = new BufferedReader(new\ \ FileReader(fileName));\n \n while((null != (password =\ \ in.readLine())) && (!found))\n {\n \n \ \ lineCount++;\n \n\t\t password = password.trim();\n\ \ \t \n \t if(\"\" != password)\n \t {\ \ \n \t if (leftThreeCharsOnly)\n \t {\n \ \ leftIndex = -1;\n midIndex = -1;\n\ \ rightIndex = -1;\n String tail\ \ = \"\";\n \n \n \ \ \n if(3 <= password.length())\n \ \ {\n if (!fullScan)\n \t\ \ \n\t \t \n \t \n\t\ \ \t if(lastPassword.equals(password.substring(0, 3).toLowerCase()))\n\ \ \t continue;\n \t else\n\ \ \t lastPassword = password.substring(0, 3).toLowerCase();\n\ \ \t char [] passwordChars = password.toCharArray();\n \ \ leftIndex = CrackingConstants.findIndex(passwordChars[0],\ \ 0, CrackingConstants.lowerChars.length);\n midIndex\ \ = CrackingConstants.findIndex(passwordChars[1], 0, CrackingConstants.lowerChars.length);\n\ \ rightIndex = CrackingConstants.findIndex(passwordChars[2],\ \ 0, CrackingConstants.lowerChars.length);\n \n \ \ \n \n\t \ \ if ((3 < password.length() ) && (fullScan))\n\t \ \ \ttail = password.substring(0, 3);\n }\n \ \ else if(2 == password.length())\n {\n \ \ if (!fullScan)\n\t \n\t \ \ if(lastPassword.equals(password.substring(0, 2).toLowerCase()))\n\ \ \t continue;\n \t else\n\ \ \t lastPassword = password.substring(0, 2).toLowerCase();\n\ \ char [] passwordChars = password.toCharArray();\n\ \ leftIndex = CrackingConstants.findIndex(passwordChars[0],\ \ 0, CrackingConstants.lowerChars.length);\n midIndex\ \ = CrackingConstants.findIndex(passwordChars[1], 0, CrackingConstants.lowerChars.length);\n\ \ }\n else if(1 == password.length())\n\ \ {\n if (!fullScan)\n\t \ \ \n \t if(lastPassword.equals(password.substring(0,\ \ 1).toLowerCase()))\n \t continue;\n \ \ \t else\n \t lastPassword = password.substring(0,\ \ 1).toLowerCase();\n char [] passwordChars = password.toCharArray();\n\ \ leftIndex = CrackingConstants.findIndex(passwordChars[0],\ \ 0, CrackingConstants.lowerChars.length);\n }\n \ \ else\n {\n \ \ System.out.println(\"Empty password from word file.\");\n \ \ continue;\n }\n \n\ \ \n if((CrackingConstants.notFound\ \ != rightIndex) && ((CrackingConstants.notFound == leftIndex) || (CrackingConstants.notFound\ \ == midIndex)))\n continue;\n \ \ if((CrackingConstants.notFound != midIndex) && (CrackingConstants.notFound\ \ == leftIndex))\n continue;\n \ \ \t\n \tresults = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex,\ \ midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars,\ \ scanType), passwordsTried);\n found = results.getSuccess();\n\ \ passwordsTried = results.getPasswordsTried();\n \ \ uniqueLetterSequencesTried++;\n \t }\n \ \ \t else\n \t {\n results\ \ = login.tryPasswords(casedPasswords.createCasedPasswords(password, scanType),\ \ passwordsTried);\n found = results.getSuccess();\n \ \ passwordsTried = results.getPasswordsTried();\n \ \ uniqueLetterSequencesTried++;\n } \n \ \ } \n } \n in.print();\n \n \ \ \n \n \n }\n catch(FileNotFoundException\ \ e)\n {\n System.out.println(\"File \" + fileName + \" was\ \ not found was unopenable.\");\n }\n catch(IOException e)\n \ \ {\n System.out.println(\"Error \" + e);\n }\n } \ \ \n \n \n} \n" - "\n\n\nimport java.io.*;\nimport java.util.*;\nimport java.*;\nimport java.net.*;\n\ \npublic class WatchDog\n{\n\n static Process p = null;\n static Process qproc\ \ = null;\n\n static BufferedReader bf = null;\n static StringTokenizer tok\ \ = null;\n\n static String Path = null;\n static String str = null;\n static\ \ String urlStr=null;\n static boolean changed = false;\n\n static File indexfile\ \ = new File(\"index.html\");\n static File tmpfile = new File(\"tmpindex.html\"\ );\n static File mdfile = new File(\"md5file.txt\");\n static File tmpmdfile\ \ = new File(\"tmpmd5file.txt\");\n static PrintWriter mailwriter = null;\n\n\ \n public static void main (String[] args) \n {\n\n urlStr = \"http://www.cs.rmit.edu./\"\ ;\n\n try\n {\n \n mailwriter = new PrintWriter(new\ \ BufferedWriter(new FileWriter(\"tomail.txt\", false)));\n\n getLatest(urlStr);\n\ \ parseFile(); \n\n mailwriter.read();\n\n if(changed)\n\ \ {\n System.out.println(\"Sending Mail\");\n p\ \ = Runtime.getRuntime().exec(\"./mailscript\");\n p.waitFor();\n\n\ \ }\n else\n System.out.println(\" mail sent\");\n\n\ \ } catch (IOException ioe)\n {\n System.out.println(\"\ IOException\");\n ioe.printStackTrace();\n }\n catch\ \ (InterruptedException intex)\n {\n System.out.println(\"\ Interrupted Exception\");\n intex.printStackTrace();\n }\n\n\ \n }\n\n\n static void getLatest(String urlStr)\n { \n \n URL\ \ url = null;\n \n try\n {\n url = new URL(urlStr);\n\n\ \ } catch (MalformedURLException mfurl)\n {\n System.out.println(\"\ Malformed URL\");\n mfurl.printStackTrace();\n }\n\n try\n\ \ {\n mailwriter.println();\n\n p = Runtime.getRuntime().exec(\"\ /usr//pwd\"); \n p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\ \ p.getInputStream()));\n\n Path=bf.readLine();\n\ \n if (indexfile.exists())\n {\n mailwriter.println(\"\ File with name 'index.html' found in directory.\");\n mailwriter.println(\"\ Renaming existing 'index.html' 'tmpindex.html...\");\n p = Runtime.getRuntime().exec(\"\ /usr//mv \"+indexfile+ \" \" + Path+\"/\"+tmpfile);\n p.waitFor();\n\ \ p = Runtime.getRuntime().exec(\"/usr//mv \"+mdfile+ \" \" + Path+\"\ /\"+tmpmdfile);\n mailwriter.println();\n mailwriter.println(\"\ File with name 'md5file.txt' found in directory.\");\n mailwriter.print(\"\ Renaming existing 'md5file.txt' 'tmpmd5file.txt...\");\n\n mailwriter.println(\"\ .\");\n\n mailwriter.println();\n }\n\n mailwriter.println(\"\ Downloading current version of site - \" + urlStr);\n p = Runtime.getRuntime().exec(\"\ /usr/local//wget \"+url);\n p.waitFor();\n if (!tmpfile.exists())\n\ \ {\n mailwriter.println(\"File - \" + urlStr + \"index.html\ \ saved disk for the first time.\");\n }\n\n\n } catch (IOException\ \ ioe)\n {\n System.out.println(\"IOException\");\n \ \ ioe.printStackTrace();\n }\n catch (IndexOutOfBoundsException\ \ iobe)\n {\n System.out.println(\"Index Out Of Bounds Exception\"\ );\n iobe.printStackTrace();\n }\n catch (Exception e)\n\ \ {\n System.out.println(\"Exception\");\n e.printStackTrace();\n\ \ }\n }\n\n static void parseFile()\n {\n\n Vector imgVect =\ \ new Vector();\n\n try\n {\n p = Runtime.getRuntime().exec(\"\ /usr//grep img \" + Path + \"/\"+ indexfile);\n p.waitFor();\n \ \ bf = new BufferedReader(new InputStreamReader(\n p.getInputStream()));\n\ \n while((str=bf.readLine())!=null)\n {\n bf = new\ \ StringTokenizer(str, \"\\\"\", false);\n \n while(bf.hasMoreTokens())\n\ \ {\n str=bf.nextToken();\n if ((str.indexOf(\"\ gif\") > 0) || (str.indexOf(\"jpg\") > 0))\n imgVect.addElement(str);\n\ \ }\n \n }\n\n }catch (IOException ioe)\n \ \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (Exception e)\n {\n System.out.println(\"\ Exception\");\n e.printStackTrace();\n }\n\n mailwriter.println(\"\ Creating file with md5sums of the webpage and images...\");\n md5Create(imgVect);\n\ \n }\n\n static void md5Create(Vector imgVect)\n {\n String tmpString\ \ = null;\n Vector imgNames = new Vector();\n\n try\n {\n \ \ PrintWriter pr = new PrintWriter(new BufferedWriter(new FileWriter(mdfile,\ \ false)));\n \n p=Runtime.getRuntime().exec(\"/usr/local//md5sum \"+indexfile);\n\ \ p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\ \ p.getInputStream()));\n pr.println(bf.readLine());\n\ \ \n for(int i=0; i<imgVect.size();i++)\n {\n imgNames.insertElementAt((getImgNames((String)imgVect.elementAt(i))),\ \ i);\n imgVect.setElementAt((getFullPath((String)imgVect.elementAt(i))),\ \ i);\n\n p=Runtime.getRuntime().exec(\"/usr/local//md5sum \"+(String)imgNames.elementAt(i));\n\ \ p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\ \ p.getInputStream()));\n pr.println(bf.readLine());\n\ \ rmImgFile(Path+\"/\"+(String)imgNames.elementAt(i));\n }\n\ \ pr.get();\n\n } catch (IOException ioe)\n {\n \ \ System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n\n if (tmpmdfile.exists())\n compVersions((imgVect.size())+1);\n\ \n }\n\n static void compVersions(int numlines)\n {\n\n int tmp = 0;\n\ \ int x = 0;\n String[] md5A = new String[numlines];\n Vector tmpmd5V\ \ = new Vector(); \n \n \ \ \n String[] tmpmd5A = null;\n StringTokenizer stoken\ \ = null;\n String mdImgName = null;\n String mdImgVal = null;\n \ \ String tmpImgName = null;\n String tmpImgVal = null;\n\n try\n\ \ {\n\n bf = new BufferedReader(new FileReader(mdfile));\n\n \ \ while((str = bf.readLine()) != null)\n {\n md5A[tmp]=str;\n\ \ tmp++;\n }\n\n bf = new BufferedReader(new FileReader(tmpmdfile));\n\ \ tmp=0;\n\n while ((str = bf.readLine()) !=null)\n {\n\ \ tmpmd5V.addElement(str);\n tmp++;\n }\n\n \ \ tmpmd5A = (String[])tmpmd5V.toArray(new String[tmpmd5V.size()]); \n\n\ \ if (tmpmd5A[0].compareTo(md5A[0]) != 0)\n {\n mailwriter.println(\"\ ---The file index.html has changed.---\");\n mailwriter.println(\"\ -Diff of old and new -\");\n changed=true;\n mailwriter.println();\n\ \ p=Runtime.getRuntime().exec(\"/usr/local//diff index.html tmpindex.html\"\ );\n p.waitFor();\n bf= new BufferedReader(new InputStreamReader(p.getInputStream()));\n\ \n while ((str = bf.readLine()) != null)\n mailwriter.println(str);\n\ \n }\n else\n {\n mailwriter.println(\"The\ \ file index.html hasn't changed.\");\n mailwriter.println();\n \ \ }\n\n mailwriter.println();\n mailwriter.println(\"Changes\ \ Images\");\n mailwriter.println(\"-----------------\");\n\n\n \ \ \n\n for (tmp=1; tmp<md5A.length; tmp++) \n {\n \ \ stoken = new StringTokenizer(md5A[tmp]);\n mdImgVal = stoken.nextToken();\n\ \ mdImgName = stoken.nextToken();\n for (x=1; x<tmpmd5A.length;\ \ x++)\n {\n stoken = new StringTokenizer(tmpmd5A[x]);\n\ \ tmpImgVal = stoken.nextToken();\n tmpImgName = stoken.nextToken();\n\ \n if (mdImgName.compareTo(tmpImgName) == 0)\n {\n\ \ if(mdImgVal.compareTo(tmpImgVal) == 0)\n {\n\ \ \n break;\n }\n \ \ else\n {\n mailwriter.println(\"\ The image \"+mdImgName+\" has changed.\");\n changed=true;\n\ \ break;\n }\n }\n \ \ if (x == ((tmpmd5A.length)-1))\n {\n mailwriter.println(\"\ The image \"+mdImgName+\" is new this \");\n changed=true;\n\ \ }\n }\n }\n\n for (tmp=1; tmp<tmpmd5A.length;\ \ tmp++) \n {\n stoken = new StringTokenizer(tmpmd5A[tmp]);\n\ \ tmpImgVal = stoken.nextToken();\n tmpImgName = stoken.nextToken();\n\ \ for (x=1; x<md5A.length; x++)\n {\n stoken\ \ = new StringTokenizer(md5A[x]);\n mdImgVal = stoken.nextToken();\n\ \ mdImgName = stoken.nextToken();\n if (tmpImgName.compareTo(mdImgName)\ \ == 0)\n {\n break;\n }\n \ \ if (x == ((md5A.length)-1))\n {\n mailwriter.println(\"\ The image \"+tmpImgName+\" is longer the \");\n changed=true;\n\ \ }\n }\n }\n\n\n } catch(IOException ioe)\n\ \ {System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch(InterruptedException iex)\n {System.out.println(\"\ Interrupted Exception\");\n iex.printStackTrace();\n }\n\n }\n\ \n\n static Object getFullPath(String fname)\n {\n \n\n if(fname.charAt(0)==\ \ '/') \n fname=urlStr+fname; \n else if(fname.charAt(0) != 'h')\n\ \ fname=urlStr+'/'+fname;\n\n getImgFile(fname);\n\n return\ \ (Object)fname; \n }\n\n static void getImgFile(String fullPath)\n {\n\ \ \n\n try\n {\n qproc=Runtime.getRuntime().exec(\"/usr/local//wget\ \ \"+fullPath);\n qproc.waitFor();\n\n } catch (IOException ioe)\n\ \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n }\n\n static void rmImgFile(String delpath)\n {\n \n\n\ \ try\n {\n qproc=Runtime.getRuntime().exec(\"/usr//rm \"+ delpath);\n\ \ qproc.waitFor();\n\n } catch (IOException ioe)\n {\n \ \ System.out.println(\"IOException\");\n ioe.printStackTrace();\n\ \ }\n catch (InterruptedException intex)\n {\n \ \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\ \ }\n \n }\n\n static Object getImgNames(String prsName)\n {\n\ \ \n \n String str = new StringTokenizer(prsName, \"/\", false);\n\ \n while(str.hasMoreTokens())\n {\n str=bgf.nextToken();\n \ \ if ((str.indexOf(\"gif\") > 0) || (str.indexOf(\"jpg\") > 0))\n \ \ prsName=str;\n }\n return (Object)prsName;\n }\n}\n" - source_sentence: "\nimport java.util.*;\n\npublic class WatchDog\n{\n private\ \ Timer t;\n\n public WatchDog()\n {\n t = new Timer();\n TimerTask\ \ task = new TimerTask()\n {\n public void run()\n\t {\n\t Dog\ \ doggy = new Dog();\n\t }\n };\n \n t.schedule(task, 0, 86400000);\n\ \ }\n public static void main( String[] args)\n {\n WatchDog wd = new\ \ WatchDog();\n }\n}\n" sentences: - "import\tjava.io.*;\n\nclass WatchDog {\n public static void main(String args[])\ \ {\n \n\t if (args.length<1)\n\t {\n System.out.println(\"Correct\ \ Format Filename email address <username@cs.rmit.edu.> of the recordkeeper\"\ ); \n System.exit(1);\t\n\t }\n\n\twhile (true)\n\t\t{\n\t\t\n\t\t\n FileInputStream\ \ stream=null;\n DataInputStream word=null;\n String input=\" \"; \n\n\n\t\ try {\n\n\n String ls_str;\n \n \t \n\t Process ls_proc = Runtime.getRuntime().exec(\"\ wget http://www.cs.rmit.edu./students\");\n \t\ttry {\n\t\tThread.sleep(2000);\n\ \t\t}catch (Exception e) {\n System.err.println(\"Caught ThreadException: \"\ \ +e.getMessage());\n\t }\n\n\t\tString[] cmd = {\"//sh\",\"-c\", \"diff Index2.html\ \ index.html >report.txt \"};\n\n\t ls_proc = Runtime.getRuntime().exec(cmd);\n\ \t\t \n\t\t\t\n\t\t\ttry {\n\t\tThread.sleep(2000);\n\t\t}catch (Exception\ \ e) {\n System.err.println(\"Caught ThreadException: \" +e.getMessage());\n\ \t }\n\t\t\n\t\t\n\t\t\n\t\tif (ls_proc.exitValue()==2) \n\t\t{\n\t\t \t System.out.println(\"\ The file was checked for first time, email sent\");\n\n Process move\ \ = Runtime.getRuntime().exec(\"mv index.html Index2.html\");\n\t\t \n\n\t\t\ }\n\t\telse\n\t\t{\n\n\t\t\t\tstream = new FileInputStream (\"report.txt\"); \n\ \t\t\t\tword =new DataInputStream(stream);\n\n\n\t\t\t\tif (word.available() !=0)\n\ \t\t\t\t{\n\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\n\t\t\t\t\tString[] cmd1 = {\"//sh\"\ ,\"-c\",\"diff Index2.html index.html | mail \"+args[0]};\n\t\t\t\t\t Process\ \ proc = Runtime.getRuntime().exec(cmd1);\n\t\t\t\t\t Thread.sleep(2000);\n\t\t\ \t\t\tProcess move = Runtime.getRuntime().exec(\"mv index.html Index2.html\");\n\ \t\t\t\t\tThread.sleep(2000);\n\t\t\t\t\tSystem.out.println(\"Difference Found\ \ , Email Sent\");\n\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception e1) {\n\t\t\t\t\ \t\t\tSystem.err.println(e1);\n\t\t\t\t\t\t\tSystem.exit(1);\n\t\t\t\t\t\t\n\t\ \t\t\t\t \n\t\t\t\t\t\t}\n\t\t\t\t\t \n\t \n\t \n\t\t\t\t }\n\t\t\t\t else\n\t\ \t\t\t\t{\n\t\t\t\t\t\t System.out.println(\" Differnce Detected\");\n\n\n\t\ \t\t\t\t}\n\t\t}\n\t}\n\t\n\n\t catch (IOException e1) {\n\t System.err.println(e1);\n\ \t System.exit(1);\n\t\n \n\t}\ntry\n{\nword.close();\nstream.close(); \n\t\ \n}\n \ncatch (IOException e)\n{ \nSystem.out.println(\"Error in closing input\ \ file:\\n\" + e.toString()); \n} \n \t\ntry {\nThread.sleep(20000); \n\ \ }\ncatch (Exception e) \n\t{\nSystem.err.println(\"Caught ThreadException:\ \ \" +e.getMessage());\n\t}\n\t\t\n\n } \n\n\t} \n\t\n }" - "\n\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\n\ import javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\n\ import javax.sql.DataSource;\n\n\n\n\npublic class BruteForcePropertyHelper {\n\ \n\tprivate static Properties bruteForceProps;\n\n\n\n\tpublic BruteForcePropertyHelper()\ \ {\n\t}\n\n\n\t\n\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\ \t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"\ Error init'ing the burteforce Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\ \treturn bruteForceProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps()\ \ throws Exception{\n\t\tif(bruteForceProps == null){\n\t\t\tbruteForceProps =\ \ new Properties();\n\n\t\t\tInputStream fis =\n\t\t\t\tBruteForcePropertyHelper.class.getResourceAsStream(\"\ /bruteforce.properties\");\n\t\t\tbruteForceProps.load(fis);\n\t\t}\n\t}\n}\n\n" - "import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.IOException;\n\ import java.io.InputStreamReader;\nimport java.util.Date;\nimport java.util.Properties;\n\ \nimport javax.mail.Message;\nimport javax.mail.Session;\nimport javax.mail.Transport;\n\ import javax.mail.Message.RecipientType;\nimport javax.mail.internet.InternetAddress;\n\ import javax.mail.internet.MimeMessage;\n\n\n\n\npublic class Mailsend\n{\n \ \ static final String SMTP_SERVER = MailsendPropertyHelper.getProperty(\"smtpServer\"\ );\n static final String RECIPIENT_EMAIL = MailsendPropertyHelper.getProperty(\"\ recipient\");\n static final String SENDER_EMAIL = MailsendPropertyHelper.getProperty(\"\ sender\");\n static final String MESSAGE_HEADER = MailsendPropertyHelper.getProperty(\"\ messageHeader\");\n\n\n\t\n\n\tpublic static void main(String args[])\n\t{\n\t\ \ttry\n\t\t{\n\t\t\t\n\t\t\tString smtpServer = SMTP_SERVER;\n\t\t\tString recip\ \ = RECIPIENT_EMAIL;\n\t\t\tString from = SENDER_EMAIL;\n\t\t\tString subject\ \ = MESSAGE_HEADER;\n\t\t\tString body = \"Testing\";\n\n\t\t\tSystem.out.println(\"\ Started sending the message\");\n\t\t\tMailsend.send(smtpServer,recip , from,\ \ subject, body);\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tSystem.out.println(\n\ \t\t\t\t\"Usage: java mailsend\"\n\t\t\t\t\t+ \" smtpServer toAddress fromAddress\ \ subjectText bodyText\");\n\t\t}\n\n\t\tSystem.exit(0);\n\t}\n\n\n\t\n\tpublic\ \ static void send(String smtpServer, String receiver,\tString from, String subject,\ \ String body)\n\n\t{\n\t\ttry\n\t\t{\n\t\t\tProperties props = System.getProperties();\n\ \n\t\t\t\n\n\t\t\tprops.put(\"mail.smtp.host\", smtpServer);\n\t\t\tprops.put(\"\ mail.smtp.timeout\", \"20000\");\n\t\t\tprops.put(\"mail.smtp.connectiontimeout\"\ , \"20000\");\n\n\t\t\t\n\t\t\tSession session = Session.getDefaultInstance(props,\ \ null);\n\n\n\t\t\t\n\t\t\tMessage msg = new MimeMessage(session);\n\n\t\t\t\n\ \t\t\tmsg.setFrom(new InternetAddress(from));\n\t\t\tmsg.setRecipients(Message.RecipientType.NORMAL,\t\ InternetAddress.parse(receiver, false));\n\n\n\n\t\t\t\n\t\t\tmsg.setSubject(subject);\n\ \n\t\t\tmsg.setSentDate(new Date());\n\n\t\t\tmsg.setText(body);\n\n\t\t\t\n\t\ \t\tTransport.send(msg);\n\n\t\t\tSystem.out.println(\"sent the email with the\ \ differences : \"+ + \"using the mail server: \"+ smtpServer);\n\n\t\t}\n\t\t\ catch (Exception ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t}\n\t}\n}\n" pipeline_tag: sentence-similarity library_name: sentence-transformers --- # SentenceTransformer based on uclanlp/plbart-java-cs This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [uclanlp/plbart-java-cs](https://huggingface.co/uclanlp/plbart-java-cs). It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more. ## Model Details ### Model Description - **Model Type:** Sentence Transformer - **Base model:** [uclanlp/plbart-java-cs](https://huggingface.co/uclanlp/plbart-java-cs) <!-- at revision 0426c742606ceb3c2e12de0ae9c46a969bba6023 --> - **Maximum Sequence Length:** 512 tokens - **Output Dimensionality:** 768 dimensions - **Similarity Function:** Cosine Similarity <!-- - **Training Dataset:** Unknown --> <!-- - **Language:** Unknown --> <!-- - **License:** Unknown --> ### Model Sources - **Documentation:** [Sentence Transformers Documentation](https://sbert.net) - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers) - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) ### Full Model Architecture ``` SentenceTransformer( (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: PLBartModel (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True}) ) ``` ## Usage ### Direct Usage (Sentence Transformers) First install the Sentence Transformers library: ```bash pip install -U sentence-transformers ``` Then you can load this model and run inference. ```python from sentence_transformers import SentenceTransformer # Download from the 🤗 Hub model = SentenceTransformer("buelfhood/SOCO-Java-PLBART-ST") # Run inference sentences = [ '\nimport java.util.*;\n\npublic class WatchDog\n{\n private Timer t;\n\n public WatchDog()\n {\n t = new Timer();\n TimerTask task = new TimerTask()\n {\n public void run()\n\t {\n\t Dog doggy = new Dog();\n\t }\n };\n \n t.schedule(task, 0, 86400000);\n }\n public static void main( String[] args)\n {\n WatchDog wd = new WatchDog();\n }\n}\n', 'import\tjava.io.*;\n\nclass WatchDog {\n public static void main(String args[]) {\n \n\t if (args.length<1)\n\t {\n System.out.println("Correct Format Filename email address <username@cs.rmit.edu.> of the recordkeeper"); \n System.exit(1);\t\n\t }\n\n\twhile (true)\n\t\t{\n\t\t\n\t\t\n FileInputStream stream=null;\n DataInputStream word=null;\n String input=" "; \n\n\n\ttry {\n\n\n String ls_str;\n \n \t \n\t Process ls_proc = Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students");\n \t\ttry {\n\t\tThread.sleep(2000);\n\t\t}catch (Exception e) {\n System.err.println("Caught ThreadException: " +e.getMessage());\n\t }\n\n\t\tString[] cmd = {"//sh","-c", "diff Index2.html index.html >report.txt "};\n\n\t ls_proc = Runtime.getRuntime().exec(cmd);\n\t\t \n\t\t\t\n\t\t\ttry {\n\t\tThread.sleep(2000);\n\t\t}catch (Exception e) {\n System.err.println("Caught ThreadException: " +e.getMessage());\n\t }\n\t\t\n\t\t\n\t\t\n\t\tif (ls_proc.exitValue()==2) \n\t\t{\n\t\t \t System.out.println("The file was checked for first time, email sent");\n\n Process move = Runtime.getRuntime().exec("mv index.html Index2.html");\n\t\t \n\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\t\tstream = new FileInputStream ("report.txt"); \n\t\t\t\tword =new DataInputStream(stream);\n\n\n\t\t\t\tif (word.available() !=0)\n\t\t\t\t{\n\n\t\t\t\t\ttry\n\t\t\t\t\t{\n\n\t\t\t\t\tString[] cmd1 = {"//sh","-c","diff Index2.html index.html | mail "+args[0]};\n\t\t\t\t\t Process proc = Runtime.getRuntime().exec(cmd1);\n\t\t\t\t\t Thread.sleep(2000);\n\t\t\t\t\tProcess move = Runtime.getRuntime().exec("mv index.html Index2.html");\n\t\t\t\t\tThread.sleep(2000);\n\t\t\t\t\tSystem.out.println("Difference Found , Email Sent");\n\n\t\t\t\t\t}\n\t\t\t\t\tcatch (Exception e1) {\n\t\t\t\t\t\t\tSystem.err.println(e1);\n\t\t\t\t\t\t\tSystem.exit(1);\n\t\t\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\t\t}\n\t\t\t\t\t \n\t \n\t \n\t\t\t\t }\n\t\t\t\t else\n\t\t\t\t\t{\n\t\t\t\t\t\t System.out.println(" Differnce Detected");\n\n\n\t\t\t\t\t}\n\t\t}\n\t}\n\t\n\n\t catch (IOException e1) {\n\t System.err.println(e1);\n\t System.exit(1);\n\t\n \n\t}\ntry\n{\nword.close();\nstream.close(); \n\t\n}\n \ncatch (IOException e)\n{ \nSystem.out.println("Error in closing input file:\\n" + e.toString()); \n} \n \t\ntry {\nThread.sleep(20000); \n }\ncatch (Exception e) \n\t{\nSystem.err.println("Caught ThreadException: " +e.getMessage());\n\t}\n\t\t\n\n } \n\n\t} \n\t\n }', '\n\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\nimport javax.sql.DataSource;\n\n\n\n\npublic class BruteForcePropertyHelper {\n\n\tprivate static Properties bruteForceProps;\n\n\n\n\tpublic BruteForcePropertyHelper() {\n\t}\n\n\n\t\n\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println("Error init\'ing the burteforce Props");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn bruteForceProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps() throws Exception{\n\t\tif(bruteForceProps == null){\n\t\t\tbruteForceProps = new Properties();\n\n\t\t\tInputStream fis =\n\t\t\t\tBruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");\n\t\t\tbruteForceProps.load(fis);\n\t\t}\n\t}\n}\n\n', ] embeddings = model.encode(sentences) print(embeddings.shape) # [3, 768] # Get the similarity scores for the embeddings similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] ``` <!-- ### Direct Usage (Transformers) <details><summary>Click to see the direct usage in Transformers</summary> </details> --> <!-- ### Downstream Usage (Sentence Transformers) You can finetune this model on your own dataset. <details><summary>Click to expand</summary> </details> --> <!-- ### Out-of-Scope Use *List how the model may foreseeably be misused and address what users ought not to do with the model.* --> <!-- ## Bias, Risks and Limitations *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.* --> <!-- ### Recommendations *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.* --> ## Training Details ### Training Dataset #### Unnamed Dataset * Size: 33,411 training samples * Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code> * Approximate statistics based on the first 1000 samples: | | sentence_0 | sentence_1 | label | |:--------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-----------------------------------------------| | type | string | string | int | | details | <ul><li>min: 35 tokens</li><li>mean: 413.67 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 35 tokens</li><li>mean: 432.24 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>0: ~99.70%</li><li>1: ~0.30%</li></ul> | * Samples: | sentence_0 | sentence_1 | label | |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------| | <code><br><br>import java.io.*;<br>import java.util.*;<br>import java.net.*;<br><br><br>public class Dictionary {<br><br> public static void main(String[] args) {<br><br> String attackURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";<br> String userID = "";<br> String Password="";<br> String userPassword="";<br><br> File inputFile = new File("/usr/share/lib/dict/words");<br> FileReader fin = null;<br> BufferedReader bf = null;<br><br> try {<br> startmillisecond = System.currentTimeMillis();<br> URL url = new URL(attackURL);<br> fin = new FileReader(inputFile);<br> bf = new BufferedReader(fin);<br> int count = 0;<br> while ((Password = bf.readLine()) !=null) {<br> if (Password.length() < 4) {<br> count++;<br> try {<br> userPassword = userID + ":" + Password;<br> System.out.println("User & Password :" + userPassword);<br> String encoding = Base64Converter.encode (userPassword.getBytes());<br> <br> URLConnection uc = url.openConnection();<br> uc.setRequestProperty ("Authorization", " " + enc...</code> | <code><br><br>public class Base64 {<br><br> final static String baseTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";<br><br> <br> public static String encode(byte[] bytes) {<br><br> String tmp = "";<br> int i = 0;<br> byte pos; <br><br> for(i=0; i < (bytes.length - bytes.length%3); i+=3) {<br><br> pos = (byte) ((bytes[i] >> 2) & 63); <br> tmp = tmp + baseTable.charAt(pos); <br><br> pos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); <br> tmp = tmp + baseTable.charAt( pos );<br> <br> pos = (byte) (((bytes[i+1] & 15) << 2) + ((bytes[i+2] >> 6) & 3));<br> tmp = tmp + baseTable.charAt(pos);<br> <br> pos = (byte) (((bytes[i+2]) & 63));<br> tmp = tmp + baseTable.charAt(pos);<br> <br> <br> <br> if(((i+2)%56) == 0) {<br> tmp = tmp + "\r\n";<br> }<br> }<br><br> if(bytes.length % 3 != 0) {<br><br> if(bytes.length % 3 == 2) {<br><br> pos = (byte) ((bytes[i] >> 2) & 63); <br> tmp = tmp + baseTable.charAt(pos); <br><br> pos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); <br> tmp = tmp + baseTable.charAt( pos );<br> <br> ...</code> | <code>0</code> | | <code><br>import java.io.*;<br><br>public class Dictionary<br>{<br> <br> public static void main(String args[])throws Exception<br> {<br> String s = null;<br> String pass="";<br> int at=0;<br> String strLine="";<br> int i=0;<br><br> BufferedReader in = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));<br> <br> start =System.currentTimeMillis();<br> try<br> {<br> while((pass=strLine = in.readLine()) != null)<br> {<br> <br> if(pass.length()==3)<br> {<br><br> System.out.println(pass);<br> at++;<br> <br> Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php");<br> p.waitFor();<br> i = p.exitValue();<br><br> if(i==0)<br> {<br> finish=System.currentTimeMillis();<br> ...</code> | <code>import java.util.*;<br>import java.io.*;<br><br><br><br>public class WatchDog {<br><br> public WatchDog() {<br><br> }<br> public static void main(String args[]) {<br> DataInputStream newin;<br><br> try{<br><br><br> System.out.println("Downloading first copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");<br> String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};<br> String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};<br> while(true){<br> Thread.sleep(24*60*60*1000);<br> System.out.println("Downloading new copy");<br> Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");<br> Thread.sleep(2000);<br> Runtime.getRuntime().exec(cmdDiff);<br> Thread.sleep(2000);<br> newin = new DataInputStream( new FileInputStream( "Diff.txt"));<br> if (newin.readLine() != null){<br> System.out.println("Sending Mail");<br> ...</code> | <code>0</code> | | <code><br><br>import java.Thread;<br>import java.io.*;<br>import java.net.*;<br><br>public class BruteForce extends Thread {<br> final char[] CHARACTERS = {'A','a','E','e','I','i','O','o','U','u','R','r','N','n','S','s','T','t','L','l','B','b','C','c','D','d','F','f','G','g','H','h','J','j','K','k','M','m','P','p','V','v','W','w','X','x','Z','z','Q','q','Y','y'};<br> final static int SUCCESS=1,<br> FAILED=0,<br> UNKNOWN=-1;<br> private static String host,<br> path,<br> user;<br> private Socket target;<br> private InputStream input;<br> private OutputStream output;<br> private byte[] data;<br> private int threads,<br> threadno,<br> response;<br> public static boolean solved = false;<br> BruteForce parent;<br><br><br> public BruteForce(String host, String path, String user, int threads, int threadno, BruteForce parent)<br> {<br> super();<br> this.parent = parent;<br> this.host = host;<br> this.path = path;<br> this.user ...</code> | <code><br><br><br><br><br><br><br><br>import java.io.*;<br>import java.net.*;<br>import javax.swing.Timer;<br>import java.awt.event.*;<br>import javax.swing.JOptionPane;<br><br>public class WatchDog <br>{<br> private static Process pro = null;<br> private static Runtime run = Runtime.getRuntime();<br> <br> public static void main(String[] args) <br> {<br> String cmd = null;<br> try<br> {<br> cmd = new String("wget -O original.txt http://www.cs.rmit.edu./students/");<br><br> pro = run.exec(cmd);<br> System.out.println(cmd);<br> }<br> catch (IOException e)<br> {<br> }<br> <br> class Watch implements ActionListener<br> {<br> BufferedReader in = null;<br> String str = null;<br> Socket socket;<br> public void actionPerformed (ActionEvent event)<br> {<br> <br> try<br> {<br> System.out.println("in Watch!");<br> String cmd = new String();<br> int ERROR = 1;<br> cmd = new String("wget -O new.txt http://www.cs.rmit.edu./students/");<br><br><br> System.out.println(cmd);<br> cmd = new String("diff original.txt new.txt");<br> pro = run.exec(cmd);<br> System.out.println(cmd);<br> in = new Buf...</code> | <code>0</code> | * Loss: [<code>BatchAllTripletLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#batchalltripletloss) ### Training Hyperparameters #### Non-Default Hyperparameters - `per_device_train_batch_size`: 32 - `per_device_eval_batch_size`: 32 - `num_train_epochs`: 1 - `fp16`: True - `multi_dataset_batch_sampler`: round_robin #### All Hyperparameters <details><summary>Click to expand</summary> - `overwrite_output_dir`: False - `do_predict`: False - `eval_strategy`: no - `prediction_loss_only`: True - `per_device_train_batch_size`: 32 - `per_device_eval_batch_size`: 32 - `per_gpu_train_batch_size`: None - `per_gpu_eval_batch_size`: None - `gradient_accumulation_steps`: 1 - `eval_accumulation_steps`: None - `torch_empty_cache_steps`: None - `learning_rate`: 5e-05 - `weight_decay`: 0.0 - `adam_beta1`: 0.9 - `adam_beta2`: 0.999 - `adam_epsilon`: 1e-08 - `max_grad_norm`: 1 - `num_train_epochs`: 1 - `max_steps`: -1 - `lr_scheduler_type`: linear - `lr_scheduler_kwargs`: {} - `warmup_ratio`: 0.0 - `warmup_steps`: 0 - `log_level`: passive - `log_level_replica`: warning - `log_on_each_node`: True - `logging_nan_inf_filter`: True - `save_safetensors`: True - `save_on_each_node`: False - `save_only_model`: False - `restore_callback_states_from_checkpoint`: False - `no_cuda`: False - `use_cpu`: False - `use_mps_device`: False - `seed`: 42 - `data_seed`: None - `jit_mode_eval`: False - `use_ipex`: False - `bf16`: False - `fp16`: True - `fp16_opt_level`: O1 - `half_precision_backend`: auto - `bf16_full_eval`: False - `fp16_full_eval`: False - `tf32`: None - `local_rank`: 0 - `ddp_backend`: None - `tpu_num_cores`: None - `tpu_metrics_debug`: False - `debug`: [] - `dataloader_drop_last`: False - `dataloader_num_workers`: 0 - `dataloader_prefetch_factor`: None - `past_index`: -1 - `disable_tqdm`: False - `remove_unused_columns`: True - `label_names`: None - `load_best_model_at_end`: False - `ignore_data_skip`: False - `fsdp`: [] - `fsdp_min_num_params`: 0 - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} - `fsdp_transformer_layer_cls_to_wrap`: None - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None} - `deepspeed`: None - `label_smoothing_factor`: 0.0 - `optim`: adamw_torch - `optim_args`: None - `adafactor`: False - `group_by_length`: False - `length_column_name`: length - `ddp_find_unused_parameters`: None - `ddp_bucket_cap_mb`: None - `ddp_broadcast_buffers`: False - `dataloader_pin_memory`: True - `dataloader_persistent_workers`: False - `skip_memory_metrics`: True - `use_legacy_prediction_loop`: False - `push_to_hub`: False - `resume_from_checkpoint`: None - `hub_model_id`: None - `hub_strategy`: every_save - `hub_private_repo`: None - `hub_always_push`: False - `gradient_checkpointing`: False - `gradient_checkpointing_kwargs`: None - `include_inputs_for_metrics`: False - `include_for_metrics`: [] - `eval_do_concat_batches`: True - `fp16_backend`: auto - `push_to_hub_model_id`: None - `push_to_hub_organization`: None - `mp_parameters`: - `auto_find_batch_size`: False - `full_determinism`: False - `torchdynamo`: None - `ray_scope`: last - `ddp_timeout`: 1800 - `torch_compile`: False - `torch_compile_backend`: None - `torch_compile_mode`: None - `include_tokens_per_second`: False - `include_num_input_tokens_seen`: False - `neftune_noise_alpha`: None - `optim_target_modules`: None - `batch_eval_metrics`: False - `eval_on_start`: False - `use_liger_kernel`: False - `eval_use_gather_object`: False - `average_tokens_across_devices`: False - `prompts`: None - `batch_sampler`: batch_sampler - `multi_dataset_batch_sampler`: round_robin </details> ### Training Logs | Epoch | Step | Training Loss | |:------:|:----:|:-------------:| | 0.4785 | 500 | 0.3437 | | 0.9569 | 1000 | 0.3653 | ### Framework Versions - Python: 3.11.13 - Sentence Transformers: 4.1.0 - Transformers: 4.52.4 - PyTorch: 2.6.0+cu124 - Accelerate: 1.7.0 - Datasets: 3.6.0 - Tokenizers: 0.21.1 ## Citation ### BibTeX #### Sentence Transformers ```bibtex @inproceedings{reimers-2019-sentence-bert, title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks", author = "Reimers, Nils and Gurevych, Iryna", booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing", month = "11", year = "2019", publisher = "Association for Computational Linguistics", url = "https://arxiv.org/abs/1908.10084", } ``` #### BatchAllTripletLoss ```bibtex @misc{hermans2017defense, title={In Defense of the Triplet Loss for Person Re-Identification}, author={Alexander Hermans and Lucas Beyer and Bastian Leibe}, year={2017}, eprint={1703.07737}, archivePrefix={arXiv}, primaryClass={cs.CV} } ``` <!-- ## Glossary *Clearly define terms in order to be accessible across audiences.* --> <!-- ## Model Card Authors *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.* --> <!-- ## Model Card Contact *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.* -->
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:33411
- loss:BatchAllTripletLoss
base_model: uclanlp/plbart-java-cs
widget:
- source_sentence: "\nimport java.io.*;\nimport java.net.*;\n\npublic class Copier\n\
{\n private URL target;\n\n public Copier( String fileName)\n {\n try\n\
\ {\n String line;\n BufferedReader ;\n\t BufferedWriter\
\ bout;\n target = new URL( \"http://www.cs.rmit.edu./students\");\n\t\
\ InputStream hm = target.openStream();\n\t HttpURLConnection urlcon = ( HttpURLConnection)\
\ target.openConnection();\n bf = new BufferedReader( new InputStreamReader(\
\ target.openStream()));\n\t bout = new BufferedWriter(new FileWriter(fileName));\n\
\ while((line = bf.readLine()) != null)\n {\n bout.write(\
\ line+\"\\n\"); \n }\n\t \n\t bout.print();\n }\n catch( Exception\
\ e)\n {\n System.out.println(\"Something wrong! \"+e);\n \
\ System.exit(0);\n }\n }\n public static void main (String[] args)\n\
\ {\n Copier c = new Copier(\"response.html\");\n }\n}\n\n \n\
\ \n\n \n\n\n \n\n\t\n"
sentences:
- "import java.io.*;\nimport java.net.*;\nimport java.util.*;\n\n\npublic class\
\ Dictionary\n{\n\tpublic static void main (String args[])\n\t{\n\t\t\n\t\t\n\
\ Calendar cal = Calendar.getInstance();\n Date now=cal.getTime();\n\
\ double startTime = now.getTime();\n\n\t\tString password=getPassword(startTime);\n\
\t\tSystem.out.println(\"The password is \" + password);\n\t}\n\n\tpublic static\
\ String getPassword(double startTime)\n\t{\n\t\tString password=\"\";\n\t\tint\
\ requests=0;\n\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\tFileReader fRead = new FileReader(\"\
/usr/share/lib/dict/words\");\n\t\t\tBufferedReader buf = new BufferedReader(fRead);\n\
\n\t\t\tpassword=buf.readLine();\n\n\t\t\twhile (password != null)\n\t\t\t{\n\t\
\t\t\t\n\t\t\t\tif (password.length()<=3)\n\t\t\t\t{\n\t\t\t\t\trequests++;\n\t\
\t\t\t\tif (testPassword(password, startTime, requests))\n\t\t\t\t\t\treturn password;\n\
\t\t\t\t}\n\n\t\t\t\tpassword = buf.readLine();\n\n\t\t\t}\n\t\t}\n\t\tcatch (IOException\
\ ioe)\n\t\t{\n\n\t\t}\n\n\t\treturn password;\n\t}\n\n\tprivate static boolean\
\ testPassword(String password, double startTime, int requests)\n\t{\n\t\ttry\n\
\t\t{\n\t\t\t\n\t\t\t\n\t\t\tURL url=new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\
);\n\n\t\t\tHttpURLConnection connection;\n\n \t\tString userPassword = \"\
:\" + password;\n\n \t\t\n \t\tString encoding = new url.misc.BASE64Encoder().encode\
\ (userPassword.getBytes());\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tconnection\
\ = (HttpURLConnection) url.openConnection();\n\t\t\t\t\n\t\t\t\tconnection.setRequestProperty(\"\
Authorization\", \" \" + encoding);\n\n\t\t\t\t\n\t\t\t\tint status=connection.getResponseCode();\n\
\n\t\t\t\tSystem.out.println(password + requests);\n\n\t\t\t\tif (status==200)\n\
\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"It took \" + getTime(startTime) + \"\
\ milliseconds find the password.\");\n\t\t\t\t\tSystem.out.println(\" were \"\
\ + requests + \" requests .\");\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\
\treturn false;\n\n\t\t\t}\n\n\t\t\tcatch (IOException ioe)\n\t\t\t{\n\t\t\t\t\
System.out.print(ioe);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\n\t\tcatch (IOException\
\ MalformedURLException)\n\t\t{\n\t\t\tSystem.out.print(\"Invalid URL\");\n\t\t\
\treturn false;\n\t\t}\n\t}\n\n\n\tprivate static double getTime(double startTime)\n\
\t{\n\t\t\n\t\t\n Calendar cal = Calendar.getInstance();\n Date\
\ now=cal.getTime();\n double endTime = now.getTime();\n\n return\
\ endTime-startTime;\n\n\t}\n\n}\n"
- "import java.io.*;\nimport java.net.*;\nimport java.util.*;\nimport java.*;\n\n\
\npublic class WatchDog {\n\n\npublic static final int interval = 79200000;\n\n\
public static void main(String[] args) {\n WatchDog wd = new WatchDog();\n\
\ Thread thread = new Thread();\n URLConnection conn = null;\n DataInputStream\
\ data = null;\n DataInputStream in = null;\n String line;\n String lines;\n\
\ String buffer = new String();\n String buffers = new String();\n String\
\ url = new String(\"http://www.cs.rmit.edu./students/\");\n boolean change;\n\
\ttry{\n\tURL myurl = new URL(url);\n conn = myurl.openConnection();\n\
\ conn.connect();\n Object content = null;\n \n System.out.println(\"\
Connection opened......\");\n System.out.println(\"Retrieving data from\
\ URL\");\n data = new DataInputStream(new BufferedInputStream(conn.getInputStream()));\n\
\ System.out.println(\" data from the URL......\");\n content =\
\ myurl.getContent();\n BufferedReader reader = null;\n\treader = new BufferedReader(new\
\ InputStreamReader((InputStream) content));\n\n \n while ((line\
\ = data.readLine()) != null)\n\n {\n System.out.println(line);\n\
\ FileWriter outnew = new FileWriter(\"watchdogresult.html\");\n \
\ outnew.write(line);\n }\n System.out.println(\"Waiting for\
\ any change....\");\n thread.sleep(79200000);\n conn = myurl.openConnection();\n\
\ conn.connect();\n in = new DataInputStream(new BufferedInputStream(conn.getInputStream()));\n\
\ while ((lines = in.readLine()) != null)\n {\n\n\t FileWriter newf\
\ = new FileWriter(\"watchdogresult.tmp\");\n newf.write(buffers);\n \
\ }\n\tchange = true;\n if(change);\n else{\n\tchange = false;\n\
\ \n\twd.mail();\n\t}\n}\n catch (InterruptedException e) {}\n catch (IOException\
\ e) {\n e.printStackTrace();\n String r = new String(e.getMessage());\n\
\ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n }\n\
\ else\n System.out.println(\"Other problems\");\n }\n }\n\n\npublic\
\ void mail(){\n\n try {\n\n String from = new String(\"Watchdog Reporter\"\
);\n String email = new String(\"@cs.rmit.edu.\");\n String subject\
\ = new String(\" is a change in \");\n\n \n URL u = new URL(\"mailto:\"\
\ + email);\n URLConnection c = u.openConnection();\n c.setDoInput(false);\n\
\ c.setDoOutput(true);\n System.out.println(\"Connecting...\");\n \
\ System.out.flush();\n c.connect();\n PrintWriter out =\n \
\ new PrintWriter(new OutputStreamWriter(c.getOutputStream()));\n\n \n \
\ out.println(\"From: \\\"\" + from + \"\\\" <\" +\n System.getProperty(\"\
user.name\") + \"@\" +\n InetAddress.getLocalHost().getHostName()\
\ + \">\");\n out.println(\": \" );\n out.println(\"Subject: \" + subject);\n\
\ out.println(); \n\n \n String line = new String(\"Watchdog observe\
\ that is a change in the web .\");\n out.close();\n System.out.println(\"\
Message sent.\");\n System.out.flush();\n }\n catch (Exception e) {\n\
\ System.err.println(e);\n }\n\n }\n\n}\n\n"
- "\n\n\n\n \n\n\nclass BasicAuth {\n\n public BasicAuth() {}\n\n\n private\
\ static byte[] cvtTable = {\n (byte)'A', (byte)'B', (byte)'C', (byte)'D',\
\ (byte)'E',\n (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J',\n\
\ (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O',\n (byte)'P',\
\ (byte)'Q', (byte)'R', (byte)'S', (byte)'T',\n (byte)'U', (byte)'V', (byte)'W',\