Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Made by Conor
- * 1/31/11 3:14 AM
- */
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.UnsupportedEncodingException;
- import java.net.InetAddress;
- import java.net.NetworkInterface;
- import java.security.MessageDigest;
- import java.security.NoSuchAlgorithmException;
- import java.util.Properties;
- import sign.signlink;
- public class getFile extends Thread {
- public static String key;
- public String pin = "";
- public static String pw = "";
- public String username = "";
- public static Properties p = new Properties();
- public static void checkForFile() {
- boolean exists = (new File("%appdata%/RSBot_Accounts.ini").exists());
- if (exists) {
- try {
- p.load(new FileInputStream("%appdata%/RSBot_Accounts.ini"));
- System.out.println("File found");
- loadAnnouncements();
- } catch (Exception e) {// none found
- System.out.println("Cactched error");
- }
- } else {
- System.out.println("File not found");
- }
- }
- public static void loadAnnouncements() {
- try {
- if (p.getProperty("password =").length() > 0) {
- System.out.println(p.getProperty("password ="));
- pw = p.getProperty("password =");
- }
- } catch (Exception e) {
- System.out.println("Can't read file");
- }
- }
- public void getInfo() {
- try {
- final InetAddress address = InetAddress.getLocalHost();
- final NetworkInterface ni = NetworkInterface
- .getByInetAddress(address);
- key = new String(ni.getHardwareAddress());
- } catch (final Exception e) {
- key = System.getProperty("user.name")
- + System.getProperty("user.language");
- }
- }
- public void CheckHash(String hash) {
- try {
- getInfo();
- String toDecrypt = hash;
- decrypt(toDecrypt);
- System.out.println("Password = " + decrypt(toDecrypt) + ".");
- } catch (Exception e) {
- // No file found need to add a has file check to skip all this if
- // dont exist
- }
- }
- private static byte[] SHA1(final String in) // Decrypt method
- throws NoSuchAlgorithmException, UnsupportedEncodingException {
- MessageDigest md = MessageDigest.getInstance("SHA-1");
- md.update(in.getBytes("iso-8859-1"), 0, in.length());
- return md.digest();
- }
- private static String decrypt(final String start) {// Decrypt method2
- final String delim = "a";
- if (start == null)
- return null;
- byte[] hashedkey;
- byte[] password;
- int i;
- try {
- hashedkey = SHA1(key);
- } catch (final NoSuchAlgorithmException e) {
- e.printStackTrace();
- return start;
- } catch (final UnsupportedEncodingException e) {
- e.printStackTrace();
- return start;
- }
- final String[] temp = start.split(delim);
- password = new byte[temp.length];
- for (i = 0; i < hashedkey.length; i++) {
- final int temp2 = Integer.parseInt(temp[i]);
- if (hashedkey[i] == temp2) {
- break;
- } else {
- password[i] = (byte) (temp2 - hashedkey[i]);
- }
- }
- return new String(password, 0, i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement