Advertisement
Guest User

Untitled

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