下载地址:https://www.pan38.com/share.php?code=pvvmX 提取码:8888
通过Java创建可执行JAR来修改安卓设备信息。核心功能包括读取系统属性、生成随机设备信息和写入修改后的配置。请注意实际使用,且可能违反某些平台政策。
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
public class DeviceModifier {
private static final String BUILD_PROP = "/system/build.prop";
private static final String TEMP_PROP = "/data/local/tmp/build.prop";
private Map<String, String> originalProps = new HashMap<>();
private Map<String, String> modifiedProps = new HashMap<>();
public DeviceModifier() {
loadOriginalProperties();
}
private void loadOriginalProperties() {
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
os.writeBytes("cat " + BUILD_PROP + "\n");
os.flush();
String line;
while ((line = in.readLine()) != null) {
if (line.contains("=")) {
String[] parts = line.split("=", 2);
originalProps.put(parts[0], parts.length > 1 ? parts[1] : "");
}
}
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
public void randomizeDeviceInfo() {
modifiedProps.putAll(originalProps);
// 生成随机设备信息
modifiedProps.put("ro.product.model", generateRandomModel());
modifiedProps.put("ro.product.brand", generateRandomBrand());
modifiedProps.put("ro.product.manufacturer", generateRandomManufacturer());
modifiedProps.put("ro.serialno", generateRandomSerial());
modifiedProps.put("ro.build.id", generateRandomBuildId());
modifiedProps.put("ro.build.display.id", "Custom_" + generateRandomBuildId());
modifiedProps.put("ro.build.version.incremental", generateRandomVersion());
}
private String generateRandomModel() {
String[] models = {"Pixel 6", "Galaxy S22", "Mi 12", "OnePlus 10", "Xperia 5"};
return models[new Random().nextInt(models.length)];
}
// 其他生成随机信息的方法...
public boolean applyChanges() {
try {
// 创建临时修改文件
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
// 写入新属性
os.writeBytes("echo '' > " + TEMP_PROP + "\n");
for (Map.Entry<String, String> entry : modifiedProps.entrySet()) {
os.writeBytes("echo '" + entry.getKey() + "=" + entry.getValue() + "' >> " + TEMP_PROP + "\n");
}
// 备份原始文件
os.writeBytes("cp " + BUILD_PROP + " " + BUILD_PROP + ".bak\n");
// 替换文件
os.writeBytes("mount -o remount,rw /system\n");
os.writeBytes("cp " + TEMP_PROP + " " + BUILD_PROP + "\n");
os.writeBytes("chmod 644 " + BUILD_PROP + "\n");
os.writeBytes("mount -o remount,ro /system\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
return process.exitValue() == 0;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static void main(String[] args) {
DeviceModifier modifier = new DeviceModifier();
modifier.randomizeDeviceInfo();
boolean success = modifier.applyChanges();
System.out.println("Device info modification " + (success ? "succeeded" : "failed"));
}
}
import java.util.Random;
public class DeviceInfoGenerator {
private static final String[] BRANDS = {
"Samsung", "Xiaomi", "Huawei", "Oppo", "Vivo",
"OnePlus", "Sony", "Google", "Asus", "Nokia"
};
private static final String[] MANUFACTURERS = {
"Samsung Electronics", "Xiaomi Inc.", "Huawei Technologies",
"BBK Electronics", "Sony Corporation", "Google LLC"
};
private static final String CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
private static Random random = new Random();
public static String generateRandomBrand() {
return BRANDS[random.nextInt(BRANDS.length)];
}
public static String generateRandomManufacturer() {
return MANUFACTURERS[random.nextInt(MANUFACTURERS.length)];
}
public static String generateRandomSerial() {
StringBuilder sb = new StringBuilder(16);
for (int i = 0; i < 16; i++) {
sb.append(CHARS.charAt(random.nextInt(CHARS.length())));
}
return sb.toString();
}
public static String generateRandomBuildId() {
return "RP1A." + random.nextInt(10) + random.nextInt(10) + random.nextInt(10)
+ "." + random.nextInt(100) + "." + random.nextInt(1000);
}
public static String generateRandomVersion() {
return "V" + random.nextInt(10) + "." + random.nextInt(20)
+ "." + random.nextInt(100) + "." + random.nextInt(1000);
}
}
4.0.0
com.example
device-modifier
1.0.0
1.8
1.8
org.apache.commons
commons-lang3
3.12.0
org.apache.maven.plugins
maven-shade-plugin
3.2.4
package
shade
com.example.DeviceModifier