Advertisement
Guest User

Untitled

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