旧版本支持发送随机传送数据包 配置文件更新
This commit is contained in:
parent
3b0d16a822
commit
8686f7943c
|
@ -8,7 +8,8 @@ import cn.serendipityr.EndMinecraftPlusV2.VersionControl.AttackManager;
|
||||||
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs;
|
import cn.serendipityr.EndMinecraftPlusV2.VersionControl.ProtocolLibs;
|
||||||
|
|
||||||
public class EndMinecraftPlusV2 {
|
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) {
|
public static void main(String[] args) {
|
||||||
System.out.println("========================-Forked by SerendipityR-========================");
|
System.out.println("========================-Forked by SerendipityR-========================");
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Scanner;
|
||||||
public class ConfigUtil {
|
public class ConfigUtil {
|
||||||
public static File configFile;
|
public static File configFile;
|
||||||
public static YamlConfiguration config;
|
public static YamlConfiguration config;
|
||||||
|
public static Integer CfgVer;
|
||||||
public static String AttackAddress;
|
public static String AttackAddress;
|
||||||
public static Integer AttackPort;
|
public static Integer AttackPort;
|
||||||
public static Integer AttackMethod;
|
public static Integer AttackMethod;
|
||||||
|
@ -27,6 +28,10 @@ public class ConfigUtil {
|
||||||
public static String DoubleExploitPlayer;
|
public static String DoubleExploitPlayer;
|
||||||
public static Boolean ShowFails;
|
public static Boolean ShowFails;
|
||||||
public static String BotName;
|
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 Integer BotCount;
|
||||||
public static Boolean RegisterAndLogin;
|
public static Boolean RegisterAndLogin;
|
||||||
public static List<String> RegisterCommands;
|
public static List<String> RegisterCommands;
|
||||||
|
@ -55,6 +60,13 @@ public class ConfigUtil {
|
||||||
|
|
||||||
config = YamlConfiguration.loadConfiguration(configFile);
|
config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
|
|
||||||
|
CfgVer = config.getInt("CfgVer");
|
||||||
|
|
||||||
|
if (!EndMinecraftPlusV2.CfgVer.equals(CfgVer)) {
|
||||||
|
LogUtil.doLog(1, "载入配置文件失败! 配置文件版本不匹配,请前往发布页更新配置文件。", null);
|
||||||
|
EndMinecraftPlusV2.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
AttackAddress = config.getString("AttackSettings.Address");
|
AttackAddress = config.getString("AttackSettings.Address");
|
||||||
AttackPort = config.getInt("AttackSettings.Port");
|
AttackPort = config.getInt("AttackSettings.Port");
|
||||||
AttackMethod = config.getInt("AttackSettings.Method");
|
AttackMethod = config.getInt("AttackSettings.Method");
|
||||||
|
@ -67,6 +79,10 @@ public class ConfigUtil {
|
||||||
ShowFails = config.getBoolean("AttackSettings.ShowFails");
|
ShowFails = config.getBoolean("AttackSettings.ShowFails");
|
||||||
BotName = config.getString("BotSettings.BotName");
|
BotName = config.getString("BotSettings.BotName");
|
||||||
BotCount = config.getInt("BotSettings.BotCount");
|
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");
|
RegisterAndLogin = config.getBoolean("BotSettings.Register&Login");
|
||||||
RegisterCommands = config.getStringList("BotSettings.RegisterCommands");
|
RegisterCommands = config.getStringList("BotSettings.RegisterCommands");
|
||||||
RejoinCount = config.getInt("BotSettings.RejoinCount");
|
RejoinCount = config.getInt("BotSettings.RejoinCount");
|
||||||
|
|
|
@ -23,7 +23,14 @@ public class DataUtil {
|
||||||
botRegPasswords.remove("");
|
botRegPasswords.remove("");
|
||||||
|
|
||||||
String lastBotName = data.getString("LastBotName");
|
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");
|
LogUtil.doLog(-1, "检测到BotName已被修改,是否重置数据文件以使更改生效? [y/n]:", "DataUtil");
|
||||||
Scanner scanner = new Scanner(System.in);
|
Scanner scanner = new Scanner(System.in);
|
||||||
if (scanner.nextLine().contains("y")) {
|
if (scanner.nextLine().contains("y")) {
|
||||||
|
@ -48,7 +55,24 @@ public class DataUtil {
|
||||||
int count = ConfigUtil.BotCount - botRegPasswords.size();
|
int count = ConfigUtil.BotCount - botRegPasswords.size();
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
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);
|
String newBotPwd = OtherUtils.getRandomString(8,10);
|
||||||
botRegPasswords.add(newBotName + "@" + newBotPwd);
|
botRegPasswords.add(newBotName + "@" + newBotPwd);
|
||||||
}
|
}
|
||||||
|
@ -72,6 +96,8 @@ public class DataUtil {
|
||||||
|
|
||||||
if (!notModify) {
|
if (!notModify) {
|
||||||
data.set("LastBotName", ConfigUtil.BotName);
|
data.set("LastBotName", ConfigUtil.BotName);
|
||||||
|
data.set("LastRandomFlag", ConfigUtil.RandomFlag);
|
||||||
|
data.set("LastRandomLength", ConfigUtil.RandomMinLength + "|" + ConfigUtil.RandomMaxLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -34,6 +34,42 @@ public class OtherUtils {
|
||||||
return stringBuilder.toString();
|
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) {
|
public static Integer getRandomInt(int min, int max) {
|
||||||
return (int)(Math.random()*(max-min+1)+min);
|
return (int)(Math.random()*(max-min+1)+min);
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,6 @@ public class BotAttack extends IAttack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ConfigUtil.ShowFails) {
|
} else if (ConfigUtil.ShowFails) {
|
||||||
//msg = e.getCause().getMessage();
|
|
||||||
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
|
LogUtil.doLog(0,"[假人断开连接] [" + username + "] " + e.getCause(), "BotAttack");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,18 +82,20 @@ public class BotAttack extends IAttack {
|
||||||
OtherUtils.doSleep(ConfigUtil.ChatDelay);
|
OtherUtils.doSleep(ConfigUtil.ChatDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c.getSession());
|
if (ConfigUtil.RandomTeleport) {
|
||||||
if (c.getSession().isConnected() && positionRotationPacket != null) {
|
ServerPlayerPositionRotationPacket positionRotationPacket = positionPacket.get(c.getSession());
|
||||||
new Thread(() -> {
|
if (c.getSession().isConnected() && positionRotationPacket != null) {
|
||||||
try {
|
new Thread(() -> {
|
||||||
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));
|
try {
|
||||||
Thread.sleep(500);
|
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));
|
||||||
MultiVersionPacket.sendPosPacket(c.getSession(), positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
|
Thread.sleep(500);
|
||||||
} catch (InterruptedException e) {
|
MultiVersionPacket.sendPosPacket(c.getSession(), positionRotationPacket.getX(), positionRotationPacket.getY(), positionRotationPacket.getZ(), OtherUtils.getRandomFloat(0.00, 1.00), OtherUtils.getRandomFloat(0.00, 1.00));
|
||||||
throw new RuntimeException(e);
|
} catch (InterruptedException e) {
|
||||||
}
|
throw new RuntimeException(e);
|
||||||
}).start();
|
}
|
||||||
}*/
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (c.getSession().hasFlag("join")) {
|
} else if (c.getSession().hasFlag("join")) {
|
||||||
if (ConfigUtil.RegisterAndLogin) {
|
if (ConfigUtil.RegisterAndLogin) {
|
||||||
for (String cmd:ConfigUtil.RegisterCommands) {
|
for (String cmd:ConfigUtil.RegisterCommands) {
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
# Forked by SerendipityR #
|
# Forked by SerendipityR #
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
|
CfgVer: 1
|
||||||
|
|
||||||
AttackSettings:
|
AttackSettings:
|
||||||
Address: "example.com"
|
Address: "example.com"
|
||||||
Port: 25565
|
Port: 25565
|
||||||
|
@ -29,6 +31,16 @@ BotSettings:
|
||||||
# $pwd - 随机生成密码
|
# $pwd - 随机生成密码
|
||||||
BotName: "ImOldSix_$rnd"
|
BotName: "ImOldSix_$rnd"
|
||||||
BotCount: 1000
|
BotCount: 1000
|
||||||
|
# 随机字符规则 (仅影响BotName):
|
||||||
|
# 1 - Normal - 简单随机化
|
||||||
|
# 2 - Ili - iii混淆式
|
||||||
|
# 3 - ABC - 纯字母
|
||||||
|
# 4 - 123 - 纯数字
|
||||||
|
RandomFlag: 1
|
||||||
|
RandomMinLength: 4
|
||||||
|
RandomMaxLength: 6
|
||||||
|
# 尝试发送随机传送数据包
|
||||||
|
RandomTeleport: true
|
||||||
RejoinCount: 5
|
RejoinCount: 5
|
||||||
RejoinDelay: 2000
|
RejoinDelay: 2000
|
||||||
RejoinDetect:
|
RejoinDetect:
|
||||||
|
|
Loading…
Reference in New Issue