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-ep2-bs32-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-ep2-bs32-noEval with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("buelfhood/SOCO-Java-UnixCoder-Softmax-PairClass-VAST-ep2-bs32-noEval") sentences = [ "import java.io.*;\nimport java.net.*;\n\n\n\n\n\n\n\n\n\n\n\npublic class Dictionary\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 respCode; \n private static BufferedReader buf; \n\n public Dictionary()\n {\n FileReader fRead;\n Authenticator.setDefault(new DictionaryAuthenticator());\n t_counter = 0;\n f_counter = 0;\n length = 0;\n\n try\n {\n fRead = new FileReader(\"/usr/share/lib/dict/words\");\n buf = new BufferedReader(fRead);\n }\n catch (FileNotFoundException e)\n {\n System.out.println(\"File not found\");\n }\n }\n\n public static void main(String[] args)\n {\n Dictionary dict = new Dictionary();\n String file = \" \";\n while(respCode != 200 )\n {\n file = dict.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 DictionaryAuthenticator 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 String word = null;\n int chars;\n char c[] = null;\n \n chars = 0;\n \n if(f_counter == 0) \n \n \n { \n try\n {\n \n {\n word = buf.readLine();\n if(word != null)\n {\n length = word.length();\n chars = 0;\n for(int i=0; i<length; i++)\n {\n if(Character.isLetter(word.charAt(i))) chars++;\n }\n }\n }\n while( word != null && (length > 3 || chars != length));\n\n }\n catch (IOException ioe)\n {\n System.out.println(\"IO Error: \" + ioe);\n }\n\n if(word != null)\n {\n c = word.toCharArray(); \n password = new String(c);\n } \n else\n {\n System.out.println(\" more words in dictionary\");\n System.exit(0);\n }\n\n f_counter++;\n } \n else\n \n {\n c = password.toCharArray(); \n for(int i=0; i< length; i++)\n {\n if(Character.isLowerCase(c[i]))\n {\n c[i] = Character.toUpperCase(c[i]);\n }\n else\n {\n c[i] = Character.toLowerCase(c[i]);\n }\n }\n password = new String(c);\n f_counter = 0;\n }\n\n t_counter++;\n\n return c;\n }\n }\n}\n", "\nimport java.net.*;\nimport java.io.*;\nimport java.util.*;\n\n\npublic class Dictionary {\n\n public static void main(String args[])\n {\n int i,j,k;\n String pass = new String();\n String UserPass = new String();\n String status = new String();\n String status1 = new String();\n BasicAuth auth = new BasicAuth();\n URLConnection connect;\n int start,end,diff;\n try {\n URL url = new URL (\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n\n\n\n start =System.currentTimeMillis();\n\n BufferedReader dis = new BufferedReader(new FileReader(\"words\"));\n\n\n while ((pass = dis.readLine()) != null)\n {\n\n\n UserPass= auth.encode(\"\",pass);\n\n connect = url.openConnection();\n connect.setDoInput(true);\n connect.setDoOutput(true);\n\n connect.setRequestProperty(\"Host\",\"sec-crack.cs.rmit.edu.\");\n connect.setRequestProperty(\"Get\",\"/SEC/2/ HTTP/1.1\");\n connect.setRequestProperty(\"Authorization\",\" \" + UserPass);\n connect.connect();\n status =connect.getHeaderField(0);\n status1 = status.substring( 9,12);\n if (status.equalsIgnoreCase(\"HTTP/1.1 200 OK\"))\n {\n System.out.println(\"Password is \" + pass);\n end=System.currentTimeMillis();\n diff = end - start;\n System.out.println(\"Time Taken = \" + (diff/1000) + \" secs\");\n System.exit(0);\n }\n ((HttpURLConnection)connect).disconnect();\n connect = null;\n }\n\n System.out.println(\" match found\");\n\n dis.close();\n dis=null;\n\n connect = null;\n\n }\n\n catch (MalformedURLException malerr)\n {\n System.err.println(\"Unable Open URL\" + malerr);\n }\n\n catch (Exception ioerr)\n {\n System.err.println(\"Unable open file\" + ioerr);\n }\n\n\n\n\n }\n}", "\n\nimport java.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class BruteForce\n{\n public final static int TOTAL_TIMES=52*52*52;\n public char[] passwd;\n public static void main(String[] args) throws IOException\n {\n BruteForce bf=new BruteForce();\n System.out.println(\" cracking...\");\n time1=new Date().getTime();\n bf.doBruteForce(time1);\n\t time2=new Date().getTime();\n\tSystem.out.println(\"Finish cracking.\");\n\tSystem.out.println(\" password found.\");\n System.out.println(\"costs \"+(time2-time1)+\" milliseconds\");\n System.exit(1);\n }\n\n void doBruteForce(int time1) throws IOException\n {\n passwd=new char[3];\n Runtime rt=Runtime.getRuntime();\n num=0;\n for(int i=(int)'z';i>=(int)'A';i--)\n {\n if(i==96)\n i=90;\n passwd[0]=(char)i;\n for(int j=(int)'z';j>=(int)'A';j--)\n {\n if(j==96)\n j=90;\n passwd[1]=(char)j;\n for(int k=(int)'z';k>=(int)'A';k--)\n {\n if(k==96)\n k=90;\n passwd[2]=(char)k;\n String password=new String(passwd);\n\t\t\ttry\n {\n\t\t\t\tnum++;\n\n\t\t\t\t\n\t\t\t\tProcess p=rt.exec(\"lynx -auth=:\"+password+\" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t\t\t\t\n\t\t\t\tString ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine();\n\t p.destroy();\n\n\t\t\t\tif(ln!=null)\n \n if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o')\n {\n\n System.out.println(password);\n\t\t\t\t\tSystem.out.println(\"Finish cracking.\");\n\t\t\t\t\tSystem.out.println(ln);\n\t\t\t\t\tSystem.out.println(\"password is \"+password);\n time2=new Date().getTime();\n System.out.println(\"costs \"+(time2-time1)+\" milliseconds\");\n System.out.println(\"The number of attempts is \"+num);\n\t\t System.exit(1);\n }\n \n \n\n } catch (FileNotFoundException exc) {\n System.out.println (\"File Not Found\");\n\t\t\t\tk++;\n } catch (IOException exc) {\n\t\t System.out.println (\"IOException\");\n k++;\n } catch (NullPointerException exc) {\n\t\t System.out.println (\"NullPointerException\");\n k++;\n\t \t}\n\n }\n }\n }\n }\n}\n", "\n\nimport java.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class BruteForce\n{\n public final static int TOTAL_TIMES=52*52*52;\n public char[] passwd;\n public static void main(String[] args) throws IOException\n {\n BruteForce bf=new BruteForce();\n System.out.println(\" cracking...\");\n time1=new Date().getTime();\n bf.doBruteForce(time1);\n\t time2=new Date().getTime();\n\tSystem.out.println(\"Finish cracking.\");\n\tSystem.out.println(\" password found.\");\n System.out.println(\"costs \"+(time2-time1)+\" milliseconds\");\n System.exit(1);\n }\n\n void doBruteForce(int time1) throws IOException\n {\n passwd=new char[3];\n Runtime rt=Runtime.getRuntime();\n num=0;\n for(int i=(int)'z';i>=(int)'A';i--)\n {\n if(i==96)\n i=90;\n passwd[0]=(char)i;\n for(int j=(int)'z';j>=(int)'A';j--)\n {\n if(j==96)\n j=90;\n passwd[1]=(char)j;\n for(int k=(int)'z';k>=(int)'A';k--)\n {\n if(k==96)\n k=90;\n passwd[2]=(char)k;\n String password=new String(passwd);\n\t\t\ttry\n {\n\t\t\t\tnum++;\n\n\t\t\t\t\n\t\t\t\tProcess p=rt.exec(\"lynx -auth=:\"+password+\" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t\t\t\t\n\t\t\t\tString ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine();\n\t p.destroy();\n\n\t\t\t\tif(ln!=null)\n \n if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o')\n {\n\n System.out.println(password);\n\t\t\t\t\tSystem.out.println(\"Finish cracking.\");\n\t\t\t\t\tSystem.out.println(ln);\n\t\t\t\t\tSystem.out.println(\"password is \"+password);\n time2=new Date().getTime();\n System.out.println(\"costs \"+(time2-time1)+\" milliseconds\");\n System.out.println(\"The number of attempts is \"+num);\n\t\t System.exit(1);\n }\n \n \n\n } catch (FileNotFoundException exc) {\n System.out.println (\"File Not Found\");\n\t\t\t\tk++;\n } catch (IOException exc) {\n\t\t System.out.println (\"IOException\");\n k++;\n } catch (NullPointerException exc) {\n\t\t System.out.println (\"NullPointerException\");\n k++;\n\t \t}\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!