Advertisement
FlyFar

tools/GetDBKey.java

Oct 28th, 2023 (edited)
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | Cybersecurity | 0 0
  1.  // copy from https://bbs.pediy.com/thread-250714.htm
  2.  // copyright @ newx
  3.  
  4. import java.io.FileInputStream;
  5. import java.io.FileNotFoundException;
  6. import java.io.IOException;
  7. import java.io.ObjectInputStream;
  8. import java.security.MessageDigest;
  9. import java.util.HashMap;
  10. public class GetDBKey {
  11.  public static void main(String[] args) {
  12.   try {
  13.    ObjectInputStream in = new ObjectInputStream(new FileInputStream("CompatibleInfo.cfg"));
  14.    Object DL = in.readObject();
  15.    HashMap hashWithOutFormat = (HashMap) DL;
  16.    String s = String.valueOf(hashWithOutFormat.get(Integer.valueOf(258))); // 取手机的IMEI
  17.    System.out.println("IMEI:"+s);
  18.    ObjectInputStream in1 = new ObjectInputStream(new FileInputStream("systemInfo.cfg"));
  19.    Object DJ = in1.readObject();
  20.    HashMap hashWithOutFormat1 = (HashMap) DJ;
  21.    String t = String.valueOf(hashWithOutFormat1.get(Integer.valueOf(1))); // 取微信的uin
  22.    System.out.println("uin:"+t);
  23.    s = s + t; //合并到一个字符串
  24.    s = encode(s); // MD5
  25.    System.out.println("密码是 : " + s.substring(0, 7));
  26.    in.close();
  27.    in1.close();
  28.   } catch (Exception e) {
  29.    e.printStackTrace();
  30.   }
  31.  }
  32.  public static String encode(String content)
  33.   {
  34.    try {
  35.     MessageDigest digest = MessageDigest.getInstance("MD5");
  36.     digest.update(content.getBytes());
  37.     return getEncode32(digest);
  38.     }
  39.    catch (Exception e)
  40.    {
  41.     e.printStackTrace();
  42.    }
  43.    return null;
  44.   }
  45.   private static String getEncode32(MessageDigest digest)
  46.   {
  47.    StringBuilder builder = new StringBuilder();
  48.    for (byte b : digest.digest())
  49.    {
  50.     builder.append(Integer.toHexString((b >> 4) & 0xf));
  51.     builder.append(Integer.toHexString(b & 0xf));
  52.    }
  53.     return builder.toString();
  54.  
  55.   }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement