Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.31 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.2)
  10. public class PINCracker extends Script implements PaintListener {
  11.  
  12.     private String username = "aka alacran"; // Change "username" to your RuneScape username
  13.     private String password = "yadas2011"; // Change "password" to your RuneScape password
  14.     private String pin = "0000"; // Change "0000" to the PIN you want to start cracking from
  15.     private boolean logout = false; // Change "false" to "true" if you want to be logged out after the PIN is cracked
  16.     private boolean useCommonPINs = true; // Change "false" to "true" if you want the bot to start by using the most common PIN's
  17.  
  18.     private String[] commonPINs = {"1950", "1951", "1952", "1953", "1954", "1955", "1956", "1957", "1958", "1959",
  19.                                    "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969",
  20.                                    "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979",
  21.                                    "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1989", "1990",
  22.                                    "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000",
  23.                                    "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2011",
  24.                                    "2012", "2468", "1337", "0101", "0202", "0303", "0404", "0505", "0606", "0707",
  25.                                    "0808", "0909", "1010", "1212", "1313", "1414", "1515", "1616", "1717", "1818",
  26.                                    "1919", "2020", "2121", "2323", "2424", "2525", "2626", "2727", "2828", "2929",
  27.                                    "3030", "3131", "3232", "3434", "3535", "3636", "3737", "3838", "3939", "4040",
  28.                                    "4141", "4242", "4343", "4545", "4646", "4747", "4848", "4949", "5050", "5151",
  29.                                    "5252", "5353", "5454", "5656", "5757", "5858", "5959", "6060", "6161", "6262",
  30.                                    "6363", "6464", "6565", "6767", "6868", "6969", "7070", "7171", "7272", "7373",
  31.                                    "7474", "7575", "7676", "7878", "7979", "8080", "8181", "8282", "8383", "8484",
  32.                                    "8585", "8686", "8787", "8989", "9090", "9191", "9292", "9393", "9494", "9595",
  33.                                    "9696", "9797", "9898", "9119", "6667", "1800", "8008"};
  34.    
  35.     private int state;
  36.     private int tried = 0;
  37.     private long banktimeout = 10;
  38.     private String startPIN = pin;
  39.     private boolean commonPINsFinished = true;
  40.    
  41.     //Paint variables
  42.     public long startTime = 0;
  43.     public long millis = 0;
  44.     public long hours = 0;
  45.     public long minutes = 0;
  46.     public long seconds = 0;
  47.     public long last = 0;
  48.     public int totalTried = 0;
  49.     public int pinsPerHour = 0;
  50.     public String currentPIN = pin;
  51.     public boolean pinIsCracked = false;
  52.  
  53.     public boolean activateCondition() {
  54.     return interfaces.get(13).isValid() || interfaces.getComponent(14, 34).isValid();
  55.     }
  56.  
  57.     public long bankTimeout() {
  58.         return banktimeout;
  59.     }
  60.  
  61.     public void enterCode(final String aPin) {
  62.         if (!interfaces.get(13).isValid())
  63.             return;
  64.     final RSComponent[] children = interfaces.get(13).getComponents();
  65.     state = 0;
  66.     for (int i = 1; i < 5; i++) {
  67.             if (children[i].containsText("?")) {
  68.                 state++;
  69.             }
  70.     }
  71.     state = 4 - state;
  72.         currentPIN = pin;
  73.     if (!interfaces.get(759).isValid())
  74.             return;
  75.     final RSComponent[] bankPin = interfaces.get(759).getComponents();            
  76.     for (int i = 0; i < bankPin.length; i++) {
  77.             if (bankPin[i].containsText(aPin.substring(state, state + 1))) {
  78.                 final RSComponent[] childrenBefore = interfaces.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].doClick();
  86.                 sleep(500);
  87.                 while (stateBefore == stateAfter) {
  88.                     final RSComponent[] childrenAfter = interfaces.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.             sleep(300, 600);
  100.             tried++;
  101.             totalTried++;
  102.             if (tried == 2)
  103.                 sleep(12000);
  104.             else if(tried >= 3) {
  105.                 sleep(2000);
  106.                 if(interfaces.get(762).isValid() || (interfaces.get(211).containsText("has been cancelled")))
  107.                     pinIsCracked();
  108.                 else {
  109.                     sleep(14000);
  110.                     tried = 0;
  111.                     while(game.isLoggedIn())
  112.                         game.logout(true);
  113.                 }
  114.             }
  115.             int temp = 0;
  116.             if (useCommonPINs && (totalTried <= commonPINs.length)) {
  117.                 if (totalTried == commonPINs.length) {
  118.                     temp = Integer.parseInt(startPIN);
  119.                     commonPINsFinished = true;
  120.                 }
  121.                 else
  122.                     temp = Integer.parseInt(commonPINs[totalTried]);
  123.             }
  124.             else {
  125.                 temp = Integer.parseInt(pin);
  126.                 temp++;
  127.                 if (useCommonPINs) {
  128.                     for (int i=0; i<commonPINs.length; i++) {
  129.                         if (temp == Integer.parseInt(commonPINs[i])) {
  130.                             temp++;
  131.                         }
  132.                     }
  133.                 }
  134.             }
  135.             if (temp >= 0 && temp <= 9)
  136.                 pin = String.format("000%d", temp);
  137.             else if(temp >= 10 && temp <= 99)
  138.                 pin = String.format("00%d", temp);
  139.             else if(temp >= 100 && temp <= 999)
  140.                 pin = String.format("0%d", temp);
  141.             else if(temp >= 1000 && temp <= 9999)
  142.                 pin = "" + temp;
  143.         }
  144.     }
  145.  
  146.     public void login() {
  147.         if (interfaces.get(906).containsText("account has not logged out") || interfaces.get(596).containsText("account has not logged out"))
  148.             mouse.click(382, 322, true);
  149.         else if(interfaces.get(596).containsText("Error connecting"))
  150.             mouse.click(382, 305, true);
  151.         else if(interfaces.get(906).isValid()) {
  152.             interfaces.get(906).getComponent(171).doClick();
  153.             while(interfaces.get(906).containsText("Entering game"))
  154.                 sleep(500);
  155.         }
  156.         else if (interfaces.get(596).isValid()) {
  157.             if(interfaces.get(596).getComponent(65).getText().length() == 0) {
  158.                 interfaces.get(596).getComponent(65).doClick();
  159.                 sleep(1000);
  160.                 keyboard.sendText(username, false);
  161.             }
  162.             if(interfaces.get(596).getComponent(71).getText().length() == 0) {
  163.                 interfaces.get(596).getComponent(71).doClick();
  164.                 sleep(1000);
  165.                 keyboard.sendText(password, false);
  166.             }
  167.             interfaces.get(596).getComponent(51).doClick();
  168.             sleep(3000);
  169.         }
  170.     }
  171.  
  172.     public void pinIsCracked() {
  173.         pinIsCracked = true;
  174.         log("PIN SUCCESSFULLY CRACKED!");
  175.         log.warning("PIN: " + currentPIN);
  176.         try {
  177.             BufferedWriter out = new BufferedWriter(new FileWriter(new File(GlobalConfiguration.Paths.getSettingsDirectory(),"PINCracker.txt")));
  178.             out.write("Username: " + username);
  179.             out.newLine();
  180.             out.write("Password: " + password);
  181.             out.newLine();
  182.             out.write("PIN: " + currentPIN);
  183.             log("Info wrote to " + GlobalConfiguration.Paths.getSettingsDirectory() + "\\PINCracker.txt");
  184.             out.close();
  185.         }
  186.         catch (IOException e) {
  187.             log.warning(e.getMessage());
  188.         }
  189.         if (logout) {
  190.             log("Logging out...");
  191.             while(game.isLoggedIn())
  192.                 game.logout(false);
  193.             stopScript();
  194.         }
  195.         else {
  196.             log("Staying logged in...");
  197.             mouse.setSpeed(8);
  198.             while(true) {
  199.                 sleep(1000);
  200.                 if (random(0,60) == 50) {
  201.                     camera.setAngle(random(0,360));
  202.                     mouse.moveRandomly(300);
  203.                 }
  204.                 while(!game.isLoggedIn())
  205.                     login();
  206.             }
  207.         }
  208.     }
  209.  
  210.     public boolean onStart() {
  211.         startTime = System.currentTimeMillis();
  212.         mouse.setSpeed(1);
  213.         if (useCommonPINs) {
  214.             pin = commonPINs[0];
  215.             currentPIN = commonPINs[0];
  216.             commonPINsFinished = false;
  217.         }
  218.         return true;
  219.     }
  220.  
  221.     @Override
  222.     public int loop() {
  223.         if (game.isLoggedIn()) {
  224.             if (interfaces.get(13).isValid()) {
  225.                 enterCode(pin);
  226.                 sleep(500,1000);
  227.             }
  228.             else if(interfaces.get(762).isValid() || (interfaces.get(211).containsText("has been cancelled")))
  229.                 pinIsCracked();
  230.             else
  231.                 bank.open();
  232.         }
  233.         else
  234.             login();
  235.         return random(200,500);
  236.     }
  237.  
  238.     public void onRepaint(Graphics g1) {
  239.         Graphics2D g = (Graphics2D)g1;
  240.        
  241.         millis = System.currentTimeMillis() - startTime;
  242.         hours = millis / (1000 * 60 * 60);
  243.         millis -= hours * (1000 * 60 * 60);
  244.         minutes = millis / (1000 * 60);
  245.         millis -= minutes * (1000 * 60);
  246.         seconds = millis / 1000;
  247.         String hoursString = "" + hours;
  248.         String minutesString = "" + minutes;
  249.         String secondsString = "" + seconds;
  250.         if (hours < 10)
  251.             hoursString = "0" + hours;
  252.         if (minutes < 10)
  253.             minutesString = "0" + minutes;
  254.         if (seconds < 10)
  255.             secondsString = "0" + seconds;
  256.  
  257.         if (!pinIsCracked) {
  258.             if (commonPINsFinished) {
  259.                 g.setColor(new Color(0, 0, 255, 220));
  260.                 g.fillRect(5, 5, 190, 65);
  261.                 g.setFont(new Font("Arial", Font.BOLD, 15));
  262.                 g.setColor(Color.WHITE);
  263.                 g.drawString("Runtime: " + hoursString + ":" + minutesString + ":" + secondsString, 10, 20);
  264.                 g.drawString("# of PIN Attempts: " + totalTried, 10, 35);
  265.                 g.drawString("Current PIN Attempt: " + currentPIN, 10, 50);
  266.                 g.drawString("PINs/hour: " + ((totalTried) * 3600000 / (System.currentTimeMillis() - startTime)), 10, 65);
  267.             }
  268.             else {
  269.                 g.setColor(new Color(0, 0, 255, 220));
  270.                 g.fillRect(5, 5, 190, 75);
  271.                 g.setFont(new Font("Arial", Font.BOLD, 15));
  272.                 g.setColor(Color.WHITE);
  273.                 g.drawString("Runtime: " + hoursString + ":" + minutesString + ":" + secondsString, 10, 20);
  274.                 g.drawString("# of PIN Attempts: " + totalTried, 10, 35);
  275.                 g.drawString("Current PIN Attempt: " + currentPIN, 10, 50);
  276.                 g.setFont(new Font("Arial", Font.BOLD, 10));
  277.                 g.drawString("(Trying common PINs first)", 10, 60);
  278.                 g.setFont(new Font("Arial", Font.BOLD, 15));
  279.                 g.drawString("PINs/hour: " + ((totalTried) * 3600000 / (System.currentTimeMillis() - startTime)), 10, 75);
  280.             }
  281.         }
  282.         else {
  283.             g.setColor(new Color(0, 255, 0, 220));
  284.             g.fillRect(5, 5, 190, 65);
  285.             g.setFont(new Font("Arial", Font.BOLD, 20));
  286.             g.setColor(Color.WHITE);
  287.             g.drawString("PIN CRACKED", 34, 25);
  288.             g.setFont(new Font("Arial", Font.BOLD, 40));
  289.             g.drawString(currentPIN, 56, 62);
  290.         }
  291.     }
  292. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement