Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // java; class file size 12731 bytes
- // this won't compile lol (just showing how much of the file is just GUI)
- package org.rsbot.gui;
- import java.io.File;
- import java.io.FileReader;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.net.InetAddress;
- import java.net.NetworkInterface;
- static private java.util.Map accounts;
- static private String key;
- static private String cipher(String s1, boolean b2) {
- byte[] b3;
- NoSuchAlgorithmException n4;
- UnsupportedEncodingException u1;
- String s1;
- byte[] b7;
- int i8;
- String[] s3;
- int i10;
- if (s1 == null) {
- return null;
- }
- try {
- b3 = SHA1(key);
- }
- catch (n4) {
- n4.printStackTrace();
- return s1;
- }
- catch (u1) {
- u1.printStackTrace();
- return s1;
- }
- if (b2) {
- s1 = "";
- b7 = s1.getBytes();
- i8 = 0;
- while (i8 < b3.length) {
- if (i8 < s1.length()) {
- s1 = new StringBuilder().append(s1).append(b3[i8] + b7[i8]).append("a").toString();
- }
- else {
- s1 = new StringBuilder().append(s1).append(b3[i8]).append("a").toString();
- }
- i8++;
- }
- return s1.substring(0, s1.length() - "a".length());
- }
- s3 = s1.split("a");
- b7 = new byte[s3.length];
- i8 = 0;
- for (;;) {
- {
- if (i8 < b3.length) {
- i10 = Integer.parseInt(s3[i8]);
- if (b3[i8] == i10) {
- }
- }
- break;
- }
- b7[i8] = (byte)(i10 - b3[i8]);
- i8++;
- }
- return new String(b7, 0, i8);
- }
- static private String fixName(String s1) {
- if (s1.charAt(0) > 91) {
- s1 = new StringBuilder().append((char) (s1.charAt(0) - 32)).append(s1.substring(1)).toString();
- }
- if (s1.contains("@") == false) {
- s1 = s1.replaceAll("\s", "_");
- }
- return s1;
- }
- static public String[] getAccountNames() {
- return (String[]) accounts.keySet().toArray(new String[accounts.size()]);
- }
- static public AccountManager getInstance() {
- return new AccountManager();
- }
- static public String getPassword(String s1) {
- Map m2;
- String s3;
- m2 = (java.util.Map) accounts.get(s1);
- s3 = (String) m2.get("password");
- if (s3 == null) {
- return "";
- }
- return s3;
- }
- static public String getPin(String s1) {
- Map m2;
- String s3;
- m2 = (java.util.Map) accounts.get(s1);
- s3 = (String) m2.get("pin");
- if (s3 == null) {
- s3 = "-1";
- }
- return s3;
- }
- static public String getReward(String s1) {
- Map m2;
- String s3;
- m2 = (java.util.Map) accounts.get(s1);
- s3 = (String) m2.get("reward");
- if (s3 == null) {
- return "Cash";
- }
- return s3;
- }
- static public boolean isMember(String s1) {
- Map m2;
- String s3;
- m2 = (java.util.Map) accounts.get(s1);
- s3 = (String) m2.get("member");
- return (s3 != null) && (s3.equalsIgnoreCase("true"));
- }
- static public boolean isTakingBreaks(String s1) {
- Map m2;
- String s3;
- m2 = (java.util.Map) accounts.get(s1);
- s3 = (String) m2.get("take_breaks");
- return (s3 != null) && (s3.equalsIgnoreCase("true"));
- }
- static private boolean isValidKey(String s1) {
- String[] s2;
- int i4;
- String s5;
- s2 = VALID_KEYS;
- l3 = s2.length;
- i4 = 0;
- while (i4 < l3) {
- s5 = s2[i4];
- if (s1.equalsIgnoreCase(s5)) {
- return true;
- }
- i4++;
- }
- return false;
- }
- static private boolean isValidPin(String s1) {
- int i2;
- char c3;
- if (s1.length() == 4) {
- i2 = 0;
- while (i2 < s1.length()) {
- c3 = s1.charAt(i2);
- if ((c3 < 48) || (c3 > 57)) {
- return false;
- }
- i2++;
- }
- return true;
- }
- return false;
- }
- static private java.util.Map loadAccounts() {
- TreeMap t1;
- java.util.TreeMap o2;
- File f3;
- BufferedReader b4;
- String s5;
- String s6;
- String[] s7;
- String s8;
- Exception e5;
- t1 = new java.util.TreeMap();
- o2 = null;
- f3 = new java.io.File(FILE_NAME);
- if (f3.exists()) {
- try {
- b4 = new java.io.BufferedReader(new java.io.FileReader(f3));
- s5 = "";
- while ((s6 = b4.readLine()) != null) {
- if ((s6.startsWith("[")) && (s6.endsWith("]"))) {
- if (s5.isEmpty() == false) {
- t1.put(fixName(s5), o2);
- }
- s5 = s6.trim().substring(1).substring(0, s6.length() - 2);
- o2 = new java.util.TreeMap();
- continue;
- }
- if ((o2 != null) && (s6.matches("^\w+=.+$"))) {
- if (s5.isEmpty()) {
- continue;
- }
- s7 = s6.trim().split("=");
- if (isValidKey(s7[0])) {
- s8 = s7[1];
- if ((s7[0].equals("pin")) && (isValidPin(s8) == false)) {
- log.warning(new StringBuilder().append("Invalid pin '").append(s8).append("' on account: ").append(s5).append(" (ignored)").toString());
- s8 = null;
- }
- if (s7[0].equals("password")) {
- s8 = cipher(s8, 0);
- }
- o2.put(s7[0], s8);
- }
- }
- }
- if (s5.isEmpty() == false) {
- t1.put(fixName(s5), o2);
- }
- b4.close();
- }
- catch (e5) {
- e5.printStackTrace();
- }
- }
- return t1;
- }
- static private byte[] SHA1(String s1) throws java.security.NoSuchAlgorithmException, java.io.UnsupportedEncodingException {
- MessageDigest m2;
- m2 = java.security.MessageDigest.getInstance("SHA-1");
- m2.update(s1.getBytes("iso-8859-1"), 0, s1.length());
- return m2.digest();
- }
- static String[] access$000() {
- return RANDOM_REWARDS;
- }
- static javax.swing.JTable access$100(AccountManager a1) {
- return a1.table;
- }
- static javax.swing.JButton access$200(AccountManager a1) {
- return a1.removeButton;
- }
- static java.util.Map access$300() {
- return accounts;
- }
- static String[] access$400() {
- return VALID_KEYS;
- }
- static {
- InetAddress i1;
- NetworkInterface n2;
- Exception e2;
- FILE_NAME = org.rsbot.util.GlobalConfiguration$Paths.getAccountsFile();
- RANDOM_REWARDS = {"Cash","Runes","Coal","Essence","Ore","Bars","Gems","Herbs","Seeds","Charms","Surprise","Emote","Costume","Attack","Defence","Strength","Constitution","Range","Prayer","Magic","Cooking","Woodcutting","Fletching","Fishing","Firemaking","Crafting","Smithing","Mining","Herblore","Agility","Thieving","Slayer","Farming","Runecrafting","Hunter","Construction","Summoning","Dungeoneering"};
- VALID_KEYS = {"password","pin","reward","member","take_breaks"};
- log = java.util.logging.Logger.getLogger(getName());
- try {
- i1 = java.net.InetAddress.getLocalHost();
- n2 = java.net.NetworkInterface.getByInetAddress(i1);
- key = new String(n2.getHardwareAddress());
- }
- catch (e2) {
- key = new StringBuilder().append(System.getProperty("user.name")).append(System.getProperty("user.language")).toString();
- }
- accounts = loadAccounts();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement