Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions tasks/AutoCheckinBigGod/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,19 @@ def _get_app_version(self):
return None

def _get_device_id(self, pid):
"""通过 Frida 获取 DeviceId"""
"""通过 Frida 获取 DeviceId,失败时使用UDID作为备选"""
script = """
Java.perform(function() {
try {
var YXFDeviceInfo = Java.use('com.netease.gl.glbase.build.YXFDeviceInfo');
console.log('GL_DEVICEID:' + YXFDeviceInfo.getDeviceId());
var id = YXFDeviceInfo.getDeviceId();
if (id && typeof id === 'string' && id != 'unknown') console.log('GL_DEVICEID:' + id);
} catch(e) {}
try {
var ctx = Java.use('android.app.ActivityThread').currentApplication().getApplicationContext();
var sp = ctx.getSharedPreferences('gl_user_info', 0);
var deviceId = sp.getString('deviceId', '');
if (deviceId && deviceId != 'unknown') console.log('GL_DEVICEID:' + deviceId);
} catch(e) {}
console.log('__DONE__');
});
Expand All @@ -846,7 +853,18 @@ def _get_device_id(self, pid):
if output:
for line in output.split('\n'):
if 'GL_DEVICEID:' in line:
return line.split('GL_DEVICEID:')[1].strip()
device_id = line.split('GL_DEVICEID:')[1].strip()
if device_id and device_id != 'unknown' and not device_id.startswith('Java.Field'):
return device_id

try:
udid = self._adb_shell(['settings', 'get', 'secure', 'android_id'])
if udid and udid != 'unknown':
logger.info(f'使用UDID作为DeviceId')
return udid
except Exception:
pass

return None

def _login_by_urs_token(self, pid, urs_creds):
Expand Down Expand Up @@ -1113,3 +1131,10 @@ def _claim_reward(self, bag_id, title):
logger.error(f' 领取异常: {title} - {e}')

return False
if __name__ == "__main__":
from module.config.config import Config
from module.device.device import Device
config = Config('oas1')
device = Device(config)
t = ScriptTask(config, device)
t.run()