diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java b/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java index 0129f78..57d1cf4 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/EndMinecraftPlusV2.java @@ -8,7 +8,8 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager; import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs; public class EndMinecraftPlusV2 { - public static String ver = "1.2.5"; + public static String ver = "1.2.6"; + public static Integer CfgVer = 1; public static void main(String[] args) { System.out.println("========================-Forked by SerendipityR-========================"); diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java index ad6a24c..ab4d504 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/ConfigUtil.java @@ -16,6 +16,7 @@ import java.util.Scanner; public class ConfigUtil { public static File configFile; public static YamlConfiguration config; + public static Integer CfgVer; public static String AttackAddress; public static Integer AttackPort; public static Integer AttackMethod; @@ -27,6 +28,10 @@ public class ConfigUtil { public static String DoubleExploitPlayer; public static Boolean ShowFails; public static String BotName; + public static Integer RandomFlag; + public static Integer RandomMinLength; + public static Integer RandomMaxLength; + public static Boolean RandomTeleport; public static Integer BotCount; public static Boolean RegisterAndLogin; public static List RegisterCommands; @@ -55,6 +60,13 @@ public class ConfigUtil { config = YamlConfiguration.loadConfiguration(configFile); + CfgVer = config.getInt("CfgVer"); + + if (!EndMinecraftPlusV2.CfgVer.equals(CfgVer)) { + LogUtil.doLog(1, "载入配置文件失败! 配置文件版本不匹配,请前往发布页更新配置文件。", null); + EndMinecraftPlusV2.Exit(); + } + AttackAddress = config.getString("AttackSettings.Address"); AttackPort = config.getInt("AttackSettings.Port"); AttackMethod = config.getInt("AttackSettings.Method"); @@ -67,6 +79,10 @@ public class ConfigUtil { ShowFails = config.getBoolean("AttackSettings.ShowFails"); BotName = config.getString("BotSettings.BotName"); BotCount = config.getInt("BotSettings.BotCount"); + RandomTeleport = config.getBoolean("BotSettings.RandomTeleport"); + RandomFlag = config.getInt("BotSettings.RandomFlag"); + RandomMinLength = config.getInt("BotSettings.RandomMinLength"); + RandomMaxLength = config.getInt("BotSettings.RandomMaxLength"); RegisterAndLogin = config.getBoolean("BotSettings.Register&Login"); RegisterCommands = config.getStringList("BotSettings.RegisterCommands"); RejoinCount = config.getInt("BotSettings.RejoinCount"); diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java index 0baab17..14a3676 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/DataUtil.java @@ -23,7 +23,14 @@ public class DataUtil { botRegPasswords.remove(""); String lastBotName = data.getString("LastBotName"); - if (lastBotName != null && !ConfigUtil.BotName.equals(lastBotName)) { + Integer lastRandomFlag = data.getInt("LastRandomFlag"); + String lastRandomLength = data.getString("LastRandomLength"); + + boolean needReset; + + needReset = !ConfigUtil.BotName.equals(lastBotName) || !ConfigUtil.RandomFlag.equals(lastRandomFlag) || !(ConfigUtil.RandomMinLength + "|" + ConfigUtil.RandomMaxLength).equals(lastRandomLength); + + if (lastBotName != null && needReset) { LogUtil.doLog(-1, "检测到BotName已被修改,是否重置数据文件以使更改生效? [y/n]:", "DataUtil"); Scanner scanner = new Scanner(System.in); if (scanner.nextLine().contains("y")) { @@ -48,7 +55,24 @@ public class DataUtil { int count = ConfigUtil.BotCount - botRegPasswords.size(); for (int i = 0; i < count; i++) { - String newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString(3,5)); + String newBotName; + + switch (ConfigUtil.RandomFlag) { + case 2: + newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Ili(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); + break; + case 3: + newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_Abc(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); + break; + case 4: + newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString_123(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); + break; + case 1: + default: + newBotName = ConfigUtil.BotName.replace("$rnd", OtherUtils.getRandomString(ConfigUtil.RandomMinLength,ConfigUtil.RandomMaxLength)); + break; + } + String newBotPwd = OtherUtils.getRandomString(8,10); botRegPasswords.add(newBotName + "@" + newBotPwd); } @@ -72,6 +96,8 @@ public class DataUtil { if (!notModify) { data.set("LastBotName", ConfigUtil.BotName); + data.set("LastRandomFlag", ConfigUtil.RandomFlag); + data.set("LastRandomLength", ConfigUtil.RandomMinLength + "|" + ConfigUtil.RandomMaxLength); } try { diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java index 49e2e77..fc25a94 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/Tools/OtherUtils.java @@ -34,6 +34,42 @@ public class OtherUtils { return stringBuilder.toString(); } + public static String getRandomString_Ili(int minLength, int maxLength) { + String str = "Ili"; + Random random = new Random(); + int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; ++i) { + int number = random.nextInt(3); + sb.append(str.charAt(number)); + } + return sb.toString(); + } + + public static String getRandomString_Abc(int minLength, int maxLength) { + String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + Random random = new Random(); + int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; ++i) { + int number = random.nextInt(52); + sb.append(str.charAt(number)); + } + return sb.toString(); + } + + public static String getRandomString_123(int minLength, int maxLength) { + String str = "1234567890"; + Random random = new Random(); + int length = random.nextInt(maxLength) % (maxLength - minLength + 1) + minLength; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; ++i) { + int number = random.nextInt(10); + sb.append(str.charAt(number)); + } + return sb.toString(); + } + public static Integer getRandomInt(int min, int max) { return (int)(Math.random()*(max-min+1)+min); } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java index 9e1a8e6..6a5866e 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/NewVersion/AttackUtils/BotAttack.java @@ -324,7 +324,6 @@ public class BotAttack extends IAttack { } } } else if (ConfigUtil.ShowFails) { - //msg = e.getCause().getMessage(); LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack"); } diff --git a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java index 0286f17..5395102 100644 --- a/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java +++ b/src/cn/serendipityr/EndMinecraftPlusV2/VersionControl/OldVersion/AttackUtils/BotAttack.java @@ -82,18 +82,20 @@ public class BotAttack extends IAttack { OtherUtils.doSleep(ConfigUtil.ChatDelay); } - /*ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c.getSession()); - if (c.getSession().isConnected() && positionRotationPacket != null) { - new Thread(() -> { - try { - 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)); - Thread.sleep(500); - MultiVersionPacket.sendPosPacket(c.getSession(), 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(); - }*/ + if (ConfigUtil.RandomTeleport) { + ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c.getSession()); + if (c.getSession().isConnected() && positionRotationPacket != null) { + new Thread(() -> { + try { + 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)); + Thread.sleep(500); + MultiVersionPacket.sendPosPacket(c.getSession(), 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 if (c.getSession().hasFlag("join")) { if (ConfigUtil.RegisterAndLogin) { for (String cmd:ConfigUtil.RegisterCommands) { diff --git a/src/config.yml b/src/config.yml index 7f10bb2..6cac5a5 100644 --- a/src/config.yml +++ b/src/config.yml @@ -3,6 +3,8 @@ # Forked by SerendipityR # ############################## +CfgVer: 1 + AttackSettings: Address: "example.com" Port: 25565 @@ -29,6 +31,16 @@ BotSettings: # $pwd - 随机生成密码 BotName: "ImOldSix_$rnd" BotCount: 1000 + # 随机字符规则 (仅影响BotName): + # 1 - Normal - 简单随机化 + # 2 - Ili - iii混淆式 + # 3 - ABC - 纯字母 + # 4 - 123 - 纯数字 + RandomFlag: 1 + RandomMinLength: 4 + RandomMaxLength: 6 + # 尝试发送随机传送数据包 + RandomTeleport: true RejoinCount: 5 RejoinDelay: 2000 RejoinDetect: