Enhance `ChangeDeviceInfoUtil` and `HttpUtil` for dynamic property updates and robust utilities

Refactored `ChangeDeviceInfoUtil` to dynamically fetch and apply device properties from JSON inputs. Added flexible handling of runtime values, improved error handling, and introduced `HttpUtil` methods for URL placeholders and retrieving the local IP address. Updated `MainActivity` and scripts for streamlined execution flow and better integration.
This commit is contained in:
yjj38 2025-06-12 11:31:46 +08:00
parent 657bb2c2c1
commit b6e312cf9e
7 changed files with 1751 additions and 84 deletions

145
af.json Normal file
View File

@ -0,0 +1,145 @@
{
"code": 1,
"device": {
".brand": "samsung",
".product": "e3qsqw",
".af_events_api": "",
"persist.sys.cloud.battery.capacity": 4855,
".model": "SM-S928U",
".af_currentstore": "",
".registeredUninstall": "",
".cell.mnc": "",
".deviceData.sensors.[0].sN": "",
"ro.product.name": "e3qsqw",
".batteryLevel": "",
".network": "Unknown,LTE",
".deviceData.sensors.[0].sV": "",
".deviceData.sensors.[0].sT": "",
".meta.first_launch.init_to_fg": "",
".country": "US",
".advertiserIdEnabled": "",
".referrers.[0].api_ver_name": "",
".referrers.[0].source": "",
".af_timestamp": "",
".platformextension": "",
".isFirstCall": "",
".deviceData.dim.ydp": 378,
".timepassedsincelastlaunch": "",
"persist.sys.cloud.gpu.gl_vendor": "Qualcomm",
".referrers.[0].google_custom.install_version": "",
".deviceData.cpu_abi2": "",
".app_version_name": "",
".lang_code": "en",
".deviceData.arch": "",
".referrers.[0].google_custom.click_server_ts": "",
".referrers.[0].google_custom.install_begin_server_ts": "",
".sdk": "",
".deviceData.dim.x_px": 1080,
".installDate": "",
".firstLaunchDate": "",
"system.http.agent": "Dalvik/2.1.0 (Linux; U; Android 14; SM-S928U Build/UP1A.231005.007)",
".last_boot_time": "",
".rfr.clk": "",
".rfr.val": "",
".rfr.instant": "",
".referrers.[0].api_ver": "",
".deviceData.dim.size": "",
".af_v2": "",
".kef5e42": "",
".deviceData.btch": "",
".tokenRefreshConfigured": "",
"persist.sys.cloud.gpu.gl_version": "OpenGL ES-CM 1.1",
".referrers.[0].latency": "",
"ro.build.fingerprint": "samsung/e3qsqw/e3q:14/UP1A.231005.007/S928USQU1AWM9:user/release-keys",
".uid": "",
".exception_number": "",
".deviceData.btl": "",
".open_referrer": "",
".deviceData.dim.xdp": 381,
".disk": "",
".isGaidWithGps": "",
".advertiserId": "",
"persist.sys.cloud.gpu.gl_renderer": "Adreno (TM) 750",
".counter": "",
"ro.product.manufacturer": "samsung",
"screen": {
"densityDpi": 450,
"realWidthPixels": 1080,
"scaledDensity": 2.8125,
"density": 2.8125,
"heightPixels": 2129,
"ydpi": 378.572998046875,
"xdpi": 381,
"realHeightPixels": 2340,
"widthPixels": 1080
},
".referrers.[0].response": "",
".carrier": "",
".referrers.[0].type": "",
".deviceData.sensors.[0].sVE.[0]": "",
".referrers.[0].install_begin_ts": "",
".appsflyerKey": "",
"ro.board.platform": "pineapple",
".operator": "",
".lang": "en",
".deviceData.cpu_abi": "arm64-v8a",
".cell.mcc": "",
".deviceData.build_display_id": "UP1A.231005.007.S928USQU1AWM9",
".android_id": "13c9b03349bdd343",
".deviceData.sensors.[0].sVE.[2]": "",
".iaecounter": "",
".referrers.[0].click_ts": "",
".deviceData.sensors.[0].sVE.[1]": "",
".onelink_id": "",
".appUserId": "",
".cksm_v1": "",
".af_preinstalled": "",
"ro.build.version.incremental": "S928USQU1AWM9",
".installer_package": "",
".af_v": "",
".p_receipt.pr.ai": "0",
".p_receipt.pr.ah": "zygote64",
".p_receipt.pr.ak": "",
"code": 1,
".p_receipt.pr.aj": "",
".p_receipt.pr.am": "default",
".p_receipt.pr.al": "",
".p_receipt.pr.ao": "",
".p_receipt.pr.an": "kryo300",
".rfr.code": "",
".p_receipt.pr.aq": "0",
".p_receipt.pr.ap": "",
".p_receipt.pr.as": "arm64-v8a",
".p_receipt.pr.ar": "qcom",
".p_receipt.pr.au": "",
".meta.first_launch.start_with": "",
".device": "e3q",
".p_receipt.pr.at": "arm64-v8a",
".app_version_code": "",
".p_receipt.pr.av": "arm64-v8a",
".referrers.[0].referrer": "",
".af_installstore": "",
".sc_o": "",
"ro.product.brand": "samsung",
".rfr.install": "",
"ro.product.model": "SM-S928U",
"ro.product.device": "e3q",
".sig": "",
".deviceType": "user",
".referrers.[0].google_custom.instant": "",
".p_receipt.pr.aa": "",
".date1": "",
".p_receipt.pr.ac": "0",
".deviceData.dim.y_px": 2340,
".p_receipt.pr.ab": "",
".date2": "",
".p_receipt.an.dbg": "",
".p_receipt.pr.ae": "",
".p_receipt.an.hk": "",
".p_receipt.pr.ad": "",
".p_receipt.pr.ag": "",
".ivc": "",
".p_receipt.pr.af": "",
".deviceData.dim.d_dpi": 450
}
}

View File

@ -118,7 +118,7 @@ public class MainActivity extends AppCompatActivity {
// 初始化按钮
Button runScriptButton = findViewById(R.id.run_script_button);
if (runScriptButton != null) {
runScriptButton.setOnClickListener(v -> AutoJsUtil.runAutojsScript(this));
runScriptButton.setOnClickListener(v -> AutoJsUtil.runAutojsScript(this,""));
} else {
Toast.makeText(this, "Button not found", Toast.LENGTH_SHORT).show();
}
@ -253,17 +253,17 @@ public class MainActivity extends AppCompatActivity {
Log.i("MainActivity", "executeSingleLogic: Switching proxy group to " + proxyNames[i]);
try {
ClashUtil.switchProxyGroup("GLOBAL", proxyNames[i], "http://127.0.0.1:6170");
ClashUtil.switchProxyGroup("GLOBAL", "us", "http://127.0.0.1:6170");
} catch (Exception e) {
Log.e("MainActivity", "executeSingleLogic: Failed to switch proxy group", e);
runOnUiThread(() -> Toast.makeText(this, "切换代理组失败:" + e.getMessage(), Toast.LENGTH_SHORT).show());
}
Log.i("MainActivity", "executeSingleLogic: Changing device info");
ChangeDeviceInfoUtil.changeDeviceInfo(getPackageName(), this);
String url = ChangeDeviceInfoUtil.changeDeviceInfo(getPackageName(), this);
Log.i("MainActivity", "executeSingleLogic: Running AutoJs script");
AutoJsUtil.runAutojsScript(this);
AutoJsUtil.runAutojsScript(this, url);
runOnUiThread(() -> Toast.makeText(this, "" + (i + 1) + " 次执行完成", Toast.LENGTH_SHORT).show());

View File

@ -32,9 +32,9 @@ public class AutoJsUtil {
public static BroadcastReceiver scriptResultReceiver;
public static void runAutojsScript(Context context) {
public static void runAutojsScript(Context context,String url) {
// 检查脚本文件
File scriptFile = new File(Environment.getExternalStorageDirectory(), "autojs/chromium.js");
File scriptFile = new File(Environment.getExternalStorageDirectory(), "script/main.js");
if (!scriptFile.exists()) {
runOnUiThread(() -> Toast.makeText(context, "Script file not found: " + scriptFile.getAbsolutePath(), Toast.LENGTH_SHORT).show());
return;
@ -50,6 +50,7 @@ public class AutoJsUtil {
Intent intent = new Intent();
intent.setClassName("org.autojs.autojs6", "org.autojs.autojs.external.open.RunIntentActivity");
intent.putExtra("path", scriptFile.getAbsolutePath());
intent.putExtra("url",url);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
@ -65,19 +66,28 @@ public class AutoJsUtil {
// 停止运行脚本
Intent stopIntent = new Intent();
stopIntent.setClassName("org.autojs.autojs6", "org.autojs.autojs.external.open.StopServiceActivity");
stopIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); // 设置任务栈优先级
stopIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// 检查目标活动是否存在
if (isActivityAvailable(context, "org.autojs.autojs6", "org.autojs.autojs.external.open.StopServiceActivity")) {
try {
context.startActivity(stopIntent); // 发送停止脚本的 Intent
Toast.makeText(context, "脚本停止管理已发送", Toast.LENGTH_SHORT).show();
} catch (ActivityNotFoundException e) {
Toast.makeText(context, "目标活动未找到:请确认 AutoJs 配置", Toast.LENGTH_LONG).show();
Log.e("AutoJsUtil", "ActivityNotFoundException: 请确保目标应用的包名和活动名正确 (org.autojs.autojs6).", e);
} catch (Exception e) {
Toast.makeText(context, "无法发送停止命令,请检查 AutoJs 配置", Toast.LENGTH_SHORT).show();
Log.e("AutoJsUtil", "Error occurred when trying to stop AutoJs script", e);
}
} else {
Toast.makeText(context, "目标活动未找到:请确认 AutoJs 配置", Toast.LENGTH_LONG).show();
Log.e("AutoJsUtil", "Activity not found: org.autojs.autojs.external.open.StopServiceActivity");
}
}
private static boolean isActivityAvailable(Context context, String packageName, String className) {
Intent intent = new Intent();
intent.setClassName(packageName, className);
PackageManager pm = context.getPackageManager();
return pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null;
}
// 在主线程运行

View File

@ -12,13 +12,15 @@ import com.example.studyapp.utils.HttpUtil;
import com.example.studyapp.utils.ShellUtils;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class ChangeDeviceInfoUtil {
@ -70,28 +72,73 @@ public class ChangeDeviceInfoUtil {
public static void changeDeviceInfo(String current_pkg_name, Context context) {
public static String changeDeviceInfo(String current_pkg_name, Context context) {
if (bigoDeviceObject == null || afDeviceObject == null) {
Log.e("ChangeDeviceInfoUtil", "Required device JSON objects are not initialized");
throw new IllegalStateException("Device initialization failed");
}
try {
// BIGO
String cpuClockSpeed = bigoDeviceObject.getString("cpu_clock_speed");
String gaid = bigoDeviceObject.getString("gaid");
String userAgent = bigoDeviceObject.getString("User-Agent");
String osLang = bigoDeviceObject.getString("os_lang");
String osVer = bigoDeviceObject.getString("os_ver");
String tz = bigoDeviceObject.getString("tz");
String systemCountry = bigoDeviceObject.getString("system_country");
String simCountry = bigoDeviceObject.getString("sim_country");
long romFreeIn = bigoDeviceObject.getLong("rom_free_in");
String resolution = bigoDeviceObject.getString("resolution");
String vendor = bigoDeviceObject.getString("vendor");
int batteryScale = bigoDeviceObject.getInt("bat_scale");
//String model = deviceObject.getString("model");
String net = bigoDeviceObject.getString("net");
int dpi = bigoDeviceObject.getInt("dpi");
long romFreeExt = bigoDeviceObject.getLong("rom_free_ext");
String dpiF = bigoDeviceObject.getString("dpi_f");
int cpuCoreNum = bigoDeviceObject.getInt("cpu_core_num");
String cpuClockSpeed = bigoDeviceObject.optString("cpu_clock_speed");
String gaid = bigoDeviceObject.optString("gaid");
String userAgent = bigoDeviceObject.optString("User-Agent");
String osLang = bigoDeviceObject.optString("os_lang");
String osVer = bigoDeviceObject.optString("os_ver");
String tz = bigoDeviceObject.optString("tz");
String systemCountry = bigoDeviceObject.optString("system_country");
String simCountry = bigoDeviceObject.optString("sim_country");
long romFreeIn = bigoDeviceObject.optLong("rom_free_in");
String resolution = bigoDeviceObject.optString("resolution");
String vendor = bigoDeviceObject.optString("vendor");
int batteryScale = bigoDeviceObject.optInt("bat_scale");
//String model = deviceObject.optString("model");
String net = bigoDeviceObject.optString("net");
int dpi = bigoDeviceObject.optInt("dpi");
long romFreeExt = bigoDeviceObject.optLong("rom_free_ext");
String dpiF = bigoDeviceObject.optString("dpi_f");
int cpuCoreNum = bigoDeviceObject.optInt("cpu_core_num");
//AF
String advertiserId = afDeviceObject.optString(".advertiserId");
String model = afDeviceObject.optString(".model");
String brand = afDeviceObject.optString(".brand");
String androidId = afDeviceObject.optString(".android_id");
int xPixels = afDeviceObject.optInt(".deviceData.dim.x_px");
int yPixels = afDeviceObject.optInt(".deviceData.dim.y_px");
int densityDpi = afDeviceObject.optInt(".deviceData.dim.d_dpi");
String country = afDeviceObject.optString(".country");
String batteryLevel = afDeviceObject.optString(".batteryLevel");
String stackInfo = Thread.currentThread().getStackTrace()[2].toString();
String product = afDeviceObject.optString(".product");
String network = afDeviceObject.optString(".network");
String langCode = afDeviceObject.optString(".lang_code");
String cpuAbi = afDeviceObject.optString(".deviceData.cpu_abi");
int yDp = afDeviceObject.optInt(".deviceData.dim.ydp");
String lang = afDeviceObject.optString(".lang");
String url = "https://app.appsflyer.com/com.gateio.gateio?pid=seikoads_int&af_siteid={aff}&c=Cj4jwOBf&af_sub_siteid={aff_sub6}&af_c_id={offer_id}&af_ad={adx_bundle_id}&af_ad_id={affiliate_id}&af_adset_id={offer_id}&af_channel={adx_id}&af_cost_currency={currency}&af_cost_value={payout}&af_adset={transaction_id}&af_click_lookback=7d&af_ip={ip}&af_lang={aff_sub4}&af_ua={ua}&clickid={transaction_id}&advertising_id={aff_sub3}&idfa={aff_sub3}&af_model={model}&af_os_version={os_version}&is_incentivized=false&af_prt=huiimedia";
Map<String, String> params = new HashMap<>();
params.put("aff", "12345");
params.put("aff_sub6", "sub6Value");
params.put("offer_id", "offer123");
params.put("adx_bundle_id", "adxBundle123");
params.put("affiliate_id", "affiliateID123");
params.put("currency", "USD");
params.put("payout", "5.0");
params.put("transaction_id","");
params.put("ip",HttpUtil.getLocalIpAddress());
params.put("aff_sub4", "English");
params.put("aff_sub3", "AdvertisingID123");
params.put("adx_id", advertiserId);
params.put("ua",userAgent);
params.put("model", model);
params.put("os_version", osVer);
// 自动处理分辨率信息
// int widthPixels = Integer.parseInt(resolution.split("x")[0]);
// int heightPixels = Integer.parseInt(resolution.split("x")[1]);
@ -103,6 +150,7 @@ public class ChangeDeviceInfoUtil {
// displayMetrics.put("densityDpi", dpi);
// callVCloudSettings_put("screen.device.displayMetrics", displayMetrics.toString(), context);
//BIGO 替换写死的值为 JSON 动态值
callVCloudSettings_put(current_pkg_name + ".system_country", systemCountry, context);
callVCloudSettings_put(current_pkg_name + ".sim_country", simCountry, context);
callVCloudSettings_put(current_pkg_name + ".rom_free_in", String.valueOf(romFreeIn), context);
@ -127,24 +175,7 @@ public class ChangeDeviceInfoUtil {
// **tz** (时区)
callVCloudSettings_put(current_pkg_name + "_tz", tz, context);
// AF
String advertiserId = afDeviceObject.getString(".advertiserId");
String model = afDeviceObject.getString(".model");
String brand = afDeviceObject.getString(".brand");
String androidId = afDeviceObject.getString(".android_id");
int xPixels = afDeviceObject.optInt(".deviceData.dim.x_px");
int yPixels = afDeviceObject.optInt(".deviceData.dim.y_px");
int densityDpi = afDeviceObject.optInt(".deviceData.dim.d_dpi");
String country = afDeviceObject.getString(".country");
String batteryLevel = afDeviceObject.getString(".batteryLevel");
String stackInfo = Thread.currentThread().getStackTrace()[2].toString();
String product = afDeviceObject.getString(".product");
String network = afDeviceObject.getString(".network");
String langCode = afDeviceObject.getString(".lang_code");
String cpuAbi = afDeviceObject.getString(".deviceData.cpu_abi");
int yDp = afDeviceObject.getInt(".deviceData.dim.ydp");
String lang = afDeviceObject.getString(".lang");
// 替换写死的值为 JSON 动态值
//AF 替换写死的值为 JSON 动态值
callVCloudSettings_put(current_pkg_name + ".advertiserId", advertiserId, context);
callVCloudSettings_put(current_pkg_name + ".model", model, context);
callVCloudSettings_put(current_pkg_name + ".brand", brand, context);
@ -152,7 +183,7 @@ public class ChangeDeviceInfoUtil {
callVCloudSettings_put(current_pkg_name + ".lang", lang, context);
callVCloudSettings_put(current_pkg_name + ".country", country, context);
callVCloudSettings_put(current_pkg_name + ".batteryLevel", batteryLevel, context);
callVCloudSettings_put(current_pkg_name + "_screen.getMetrics.stack", stackInfo, context);
callVCloudSettings_put(current_pkg_name + "_screen.optMetrics.stack", stackInfo, context);
callVCloudSettings_put(current_pkg_name + ".product", product, context);
callVCloudSettings_put(current_pkg_name + ".network", network, context);
callVCloudSettings_put(current_pkg_name + ".cpu_abi", cpuAbi, context);
@ -168,37 +199,81 @@ public class ChangeDeviceInfoUtil {
displayMetrics.put("yDp", yDp);
callVCloudSettings_put("screen.device.displayMetrics", displayMetrics.toString(), context);
if (!ShellUtils.hasRootAccess()) {
Log.e("ChangeDeviceInfoUtil", "Root access is required to execute system property changes");
return null;
}
String ro_product_brand = afDeviceObject.optString("ro.product.brand", "");
String ro_product_model = afDeviceObject.optString("ro.product.model", "");
String ro_product_manufacturer = afDeviceObject.optString("ro.product.manufacturer", "");
String ro_product_device = afDeviceObject.optString("ro.product.device", "");
String ro_product_name = afDeviceObject.optString("ro.product.name", "");
String ro_build_version_incremental = afDeviceObject.optString("ro.build.version.incremental", "");
String ro_build_fingerprint = afDeviceObject.optString("ro.build.fingerprint", "");
String ro_odm_build_fingerprint = afDeviceObject.optString("ro.odm.build.fingerprint", "");
String ro_product_build_fingerprint = afDeviceObject.optString("ro.product.build.fingerprint", "");
String ro_system_build_fingerprint = afDeviceObject.optString("ro.system.build.fingerprint", "");
String ro_system_ext_build_fingerprint = afDeviceObject.optString("ro.system_ext.build.fingerprint", "");
String ro_vendor_build_fingerprint = afDeviceObject.optString("ro.vendor.build.fingerprint", "");
String ro_build_platform = afDeviceObject.optString("ro.board.platform", "");
String persist_sys_cloud_drm_id = afDeviceObject.optString("persist.sys.cloud.drm.id", "");
int persist_sys_cloud_battery_capacity = afDeviceObject.optInt("persist.sys.cloud.battery.capacity", -1);
String persist_sys_cloud_gpu_gl_vendor = afDeviceObject.optString("persist.sys.cloud.gpu.gl_vendor", "");
String persist_sys_cloud_gpu_gl_renderer = afDeviceObject.optString("persist.sys.cloud.gpu.gl_renderer", "");
String persist_sys_cloud_gpu_gl_version = afDeviceObject.optString("persist.sys.cloud.gpu.gl_version", "");
String persist_sys_cloud_gpu_egl_vendor = afDeviceObject.optString("persist.sys.cloud.gpu.egl_vendor", "");
String persist_sys_cloud_gpu_egl_version = afDeviceObject.optString("persist.sys.cloud.gpu.egl_version", "");
String global_android_id = afDeviceObject.optString(".android_id", "");
String anticheck_pkgs = afDeviceObject.optString(".anticheck_pkgs", "");
String pm_list_features = afDeviceObject.optString(".pm_list_features", "");
String pm_list_libraries = afDeviceObject.optString(".pm_list_libraries", "");
String system_http_agent = afDeviceObject.optString("system.http.agent", "");
String webkit_http_agent = afDeviceObject.optString("webkit.http.agent", "");
String com_fk_tools_pkgInfo = afDeviceObject.optString(".pkg_info", "");
String appsflyerKey = afDeviceObject.optString(".appsflyerKey", "");
String appUserId = afDeviceObject.optString(".appUserId", "");
String disk = afDeviceObject.optString(".disk", "");
String operator = afDeviceObject.optString(".operator", "");
String cell_mcc = afDeviceObject.optString(".cell.mcc", "");
String cell_mnc = afDeviceObject.optString(".cell.mnc", "");
String date1 = afDeviceObject.optString(".date1", "");
String date2 = afDeviceObject.optString(".date2", "");
String bootId = afDeviceObject.optString("BootId", "");
// 设置机型, 直接设置属性
ShellUtils.execRootCmd("setprop ro.product.brand " + ro_product_brand);
ShellUtils.execRootCmd("setprop ro.product.model "+ ro_product_model );
ShellUtils.execRootCmd("setprop ro.product.manufacturer "+ro_product_manufacturer );
ShellUtils.execRootCmd("setprop ro.product.device "+ ro_product_device);
ShellUtils.execRootCmd("setprop ro.product.name "+ro_product_name );
ShellUtils.execRootCmd("setprop ro.build.version.incremental "+ro_build_version_incremental);
ShellUtils.execRootCmd("setprop ro.build.fingerprint "+ro_build_fingerprint );
ShellUtils.execRootCmd("setprop ro.odm.build.fingerprint "+ro_odm_build_fingerprint );
ShellUtils.execRootCmd("setprop ro.product.build.fingerprint "+ro_product_build_fingerprint );
ShellUtils.execRootCmd("setprop ro.system.build.fingerprint "+ro_system_build_fingerprint );
ShellUtils.execRootCmd("setprop ro.system_ext.build.fingerprint "+ro_system_ext_build_fingerprint );
ShellUtils.execRootCmd("setprop ro.vendor.build.fingerprint "+ro_vendor_build_fingerprint );
ShellUtils.execRootCmd("setprop ro.board.platform "+ro_build_platform );
// Native.setBootId(bootId);
// 修改drm id
ShellUtils.execRootCmd("setprop persist.sys.cloud.drm.id "+persist_sys_cloud_drm_id);
// 电量模拟需要大于1000
ShellUtils.execRootCmd("setprop persist.sys.cloud.battery.capacity "+persist_sys_cloud_battery_capacity);
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.gl_vendor "+persist_sys_cloud_gpu_gl_vendor);
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.gl_renderer "+persist_sys_cloud_gpu_gl_renderer);
// 这个值不能随便改 必须是 OpenGL ES %d.%d 这个格式
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.gl_version "+persist_sys_cloud_gpu_gl_version);
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.egl_vendor "+persist_sys_cloud_gpu_egl_vendor);
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.egl_version "+persist_sys_cloud_gpu_egl_version);
// 填充占位符
return HttpUtil.fillUrlPlaceholders(url, params);
} catch (Throwable e) {
Log.e("ChangeDeviceInfoUtil", "Error occurred while changing device info", e);
throw new RuntimeException("Error occurred in changeDeviceInfo", e);
}
if (!ShellUtils.hasRootAccess()) {
Log.e("ChangeDeviceInfoUtil", "Root access is required to execute system property changes");
return;
}
// 设置机型, 直接设置属性
ShellUtils.execRootCmd("setprop ro.product.brand google");
ShellUtils.execRootCmd("setprop ro.product.model raven");
ShellUtils.execRootCmd("setprop ro.product.manufacturer google");
ShellUtils.execRootCmd("setprop ro.product.device raven");
ShellUtils.execRootCmd("setprop ro.product.name raven");
ShellUtils.execRootCmd("setprop ro.build.version.incremental 9325679");
ShellUtils.execRootCmd("setprop ro.build.fingerprint \"google/raven/raven:13/TQ1A.230105.002/9325679:user/release-keys\"");
ShellUtils.execRootCmd("setprop ro.board.platform acr980m");
Native.setBootId("400079ef55a4475558eb60a0544a43d5");
// 修改drm id
ShellUtils.execRootCmd("setprop persist.sys.cloud.drm.id 400079ef55a4475558eb60a0544a43d5171258f13fdd48c10026e2847a6fc7a5");
// 电量模拟需要大于1000
ShellUtils.execRootCmd("setprop persist.sys.cloud.battery.capacity 5000");
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.gl_vendor my_gl_vendor");
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.gl_renderer my_gl_renderer");
// 这个值不能随便改 必须是 OpenGL ES %d.%d 这个格式
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.gl_version \"OpenGL ES 3.2\"");
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.egl_vendor my_egl_vendor");
ShellUtils.execRootCmd("setprop persist.sys.cloud.gpu.egl_version my_egl_version");
}
private static void callVCloudSettings_put(String key, String value, Context context) {
@ -224,13 +299,13 @@ public class ChangeDeviceInfoUtil {
} catch (ClassNotFoundException e) {
Log.w("Reflection Error", "Class not found: android.provider.VCloudSettings$Global. This may not be supported on this device.");
} catch (NoSuchMethodException e) {
Log.w("Reflection Error", "Method putString not available. Ensure your target Android version supports it.");
Log.w("Reflection Error", "Method putString not available. Ensure your taropt Android version supports it.");
} catch (InvocationTargetException e) {
Throwable cause = e.getTargetException();
if (cause instanceof SecurityException) {
Log.e("Reflection Error", "Permission denied. Ensure WRITE_SECURE_SETTINGS permission is granted.", cause);
} else {
Log.e("Reflection Error", "InvocationTargetException during putString invocation", e);
Log.e("Reflection Error", "InvocationTaroptException during putString invocation", e);
}
} catch (Exception e) {
Log.e("Reflection Error", "Unexpected error during putString invocation: " + e.getMessage());

View File

@ -6,7 +6,11 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.URL;
import java.util.Enumeration;
import java.util.Map;
public class HttpUtil {
private static final String TAG = "HttpUtil";
@ -56,4 +60,38 @@ public class HttpUtil {
return byteArrayOutputStream.toString();
}
public static String fillUrlPlaceholders(String url, Map<String, String> params) {
// 遍历 Map将占位符替换成实际值
for (Map.Entry<String, String> entry : params.entrySet()) {
String placeholder = "{" + entry.getKey() + "}"; // 生成占位符格式
String value = entry.getValue(); // 要替换的实际值
url = url.replace(placeholder, value); // 替换
}
return url;
}
public static String getLocalIpAddress() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces.nextElement();
Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
InetAddress inetAddress = inetAddresses.nextElement();
if (!inetAddress.isLoopbackAddress() && inetAddress instanceof java.net.Inet4Address) {
// 如果不是回环地址且是 IPv4 地址
return inetAddress.getHostAddress();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return "0.0.0.0"; // 无法获取时返回默认值
}
}

32
bigo.json Normal file
View File

@ -0,0 +1,32 @@
{
"cpu_clock_speed": "1900800",
"country": "US",
"gaid": "c3182014-c331-4858-a431-0e37c196434b",
"tz": "gmt+05:00",
"isp": "",
"system_country": "US",
"User-Agent": "Mozilla/5.0 (Linux; Android 9; SM-G950U Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/123.0.6312.118 Mobile Safari/537.36",
"sim_country": "in",
"rom_free_in": 28318187520,
"resolution": "1080x2220",
"total_memory": "",
"lat_enable": 0,
"vendor": "samsung",
"bat_scale": 3000,
"os_lang": "en",
"model": "SM-G950U",
"fire_id": "",
"net": "LTE",
"dpi": 540,
"rom_free_ext": 28178726912,
"os_ver": "9",
"bat_num": "",
"fire_lat_enable": "",
"free_memory": "",
"bat_stat": "",
"dpi_f": "1080x2058",
"af_id": "",
"hw_lat_enable": "",
"hw_id": "",
"cpu_core_num": 8
}

1367
clash-ipidea-20250609.yaml Normal file

File diff suppressed because it is too large Load Diff