Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.79 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.1)
  10. public class PINCracker extends Script implements PaintListener {
  11.  
  12.     private String username = "[color=red]username[/color]"; // Change [i]username[/i] to your RuneScape username
  13.     private String password = "[color=red]password[/color]"; // Change [i]password[/i] to your RuneScape password
  14.     private String pin = "[color=red]0000[/color]"; // Change [i]0000[/i] to the PIN you want to start cracking from
  15.     private boolean logout = [color=red]true[/color]; // Change [i]true[/i] to [i]false[/i] if you want to stay logged in after PIN is cracked
  16.  
  17.     private int state;
  18.     private int tried = 0;
  19.     private long banktimeout = 10;
  20.    
  21.     //Paint variables
  22.     public long startTime = 0;
  23.     public long millis = 0;
  24.     public long hours = 0;
  25.     public long minutes = 0;
  26.     public long seconds = 0;
  27.     public long last = 0;
  28.     public int totalTried = 0;
  29.     public int pinsPerHour = 0;
  30.     public String currentPin = pin;
  31.     public long attemptTime = 0;
  32.     public boolean pinIsCracked = false;
  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("has 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).containsText("account has not logged out") || interfaces.get(596).containsText("account has not logged out"))
  112.             mouse.click(382, 322, true);
  113.         else if(interfaces.get(596).containsText("Error connecting"))
  114.             mouse.click(382, 305, true);
  115.         else if(interfaces.get(906).isValid()) {
  116.             interfaces.get(906).getComponent(171).doClick();
  117.             while(interfaces.get(906).containsText("Entering game"))
  118.                 sleep(500);
  119.         }
  120.         else if (interfaces.get(596).isValid()) {
  121.             if(interfaces.get(596).getComponent(65).getText().length() == 0) {
  122.                 interfaces.get(596).getComponent(65).doClick();
  123.                 sleep(1000);
  124.                 keyboard.sendText(username, false);
  125.             }
  126.             if(interfaces.get(596).getComponent(71).getText().length() == 0) {
  127.                 interfaces.get(596).getComponent(71).doClick();
  128.                 sleep(1000);
  129.                 keyboard.sendText(password, false);
  130.             }
  131.             interfaces.get(596).getComponent(51).doClick();
  132.             sleep(3000);
  133.         }
  134.     }
  135.  
  136.     public void pinIsCracked() {
  137.         pinIsCracked = true;
  138.         log("PIN SUCCESSFULLY CRACKED!");
  139.         log.warning("PIN: " + pin);
  140.         try {
  141.             BufferedWriter out = new BufferedWriter(new FileWriter(new File(GlobalConfiguration.Paths.getSettingsDirectory(),"PINCracker.txt")));
  142.             out.write("Username: " + username);
  143.             out.newLine();
  144.             out.write("Password: " + password);
  145.             out.newLine();
  146.             out.write("PIN: " + pin);
  147.             log("Info wrote to " + GlobalConfiguration.Paths.getSettingsDirectory() + "\\PINCracker.txt");
  148.             out.close();
  149.         }
  150.         catch (IOException e) {
  151.             log.warning(e.getMessage());
  152.         }
  153.         if (logout) {
  154.             log("Logging out...");
  155.             while(game.isLoggedIn())
  156.                 game.logout(false);
  157.             stopScript();
  158.         }
  159.         else {
  160.             log("Staying logged in...");
  161.             mouse.setSpeed(8);
  162.             while(true) {
  163.                 sleep(1000);
  164.                 if (random(0,50) == 50) {
  165.                     camera.setAngle(random(0,360));
  166.                     mouse.moveRandomly(300);
  167.                 }
  168.                 while(!game.isLoggedIn())
  169.                     login();
  170.             }
  171.         }
  172.     }
  173.  
  174.     public boolean onStart() {
  175.         startTime = System.currentTimeMillis();
  176.         mouse.setSpeed(1);
  177.         return true;
  178.     }
  179.  
  180.     @Override
  181.     public int loop() {
  182.         if (game.isLoggedIn()) {
  183.             if (interfaces.get(13).isValid()) {
  184.                 enterCode(pin);
  185.                 sleep(500,1000);
  186.             }
  187.             else if(interfaces.get(762).isValid() || (interfaces.canContinue() && interfaces.getContinueComponent().containsText("has been cancelled")))
  188.                 pinIsCracked();
  189.             else
  190.                 bank.open();
  191.         }
  192.         else
  193.             login();
  194.         return random(200,500);
  195.     }
  196.  
  197.     public void onRepaint(Graphics g1) {
  198.         Graphics2D g = (Graphics2D)g1;
  199.        
  200.         millis = System.currentTimeMillis() - startTime;
  201.         hours = millis / (1000 * 60 * 60);
  202.         millis -= hours * (1000 * 60 * 60);
  203.         minutes = millis / (1000 * 60);
  204.         millis -= minutes * (1000 * 60);
  205.         seconds = millis / 1000;
  206.         String hoursString = "" + hours;
  207.         String minutesString = "" + minutes;
  208.         String secondsString = "" + seconds;
  209.         if (hours < 10)
  210.             hoursString = "0" + hours;
  211.         if (minutes < 10)
  212.             minutesString = "0" + minutes;
  213.         if (seconds < 10)
  214.             secondsString = "0" + seconds;
  215.  
  216.         if (!pinIsCracked) {
  217.             g.setColor(new Color(0, 0, 255, 220));
  218.             g.fillRect(5, 5, 190, 65);
  219.             g.setFont(new Font("Arial", Font.BOLD, 15));
  220.             g.setColor(Color.WHITE);
  221.             g.drawString("Runtime: " + hoursString + ":" + minutesString + ":" + secondsString, 10, 20);
  222.             g.drawString("# of PIN Attempts: " + totalTried, 10, 35);
  223.             g.drawString("Current PIN Attempt: " + currentPin, 10, 50);
  224.             g.drawString("PINs/hour: " + ((totalTried) * 3600000 / (System.currentTimeMillis() - startTime)), 10, 65);
  225.         }
  226.         else {
  227.             g.setColor(new Color(0, 255, 0, 220));
  228.             g.fillRect(5, 5, 190, 65);
  229.             g.setFont(new Font("Arial", Font.BOLD, 20));
  230.             g.setColor(Color.WHITE);
  231.             g.drawString("PIN CRACKED", 34, 25);
  232.             g.setFont(new Font("Arial", Font.BOLD, 40));
  233.             g.drawString(pin, 56, 62);
  234.         }
  235.     }
  236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement