android 10 通过shell 权限获取imei ,imsi ,iccid等
程序员文章站
2024-02-10 23:33:22
...
java代码层已经不可以获取了,但是通过adb 命令还是可以的
imei
adb shell "service call iphonesubinfo 1 | grep -o '[0-9a-f]\{8\} ' | tail -n+3 | while read a; do echo -n \\u${a:4:4}\\u${a:0:4}; done" |
imsi
adb shell "service call iphonesubinfo 7 | grep -o '[0-9a-f]\{8\} ' | tail -n+3 | while read a; do echo -n \\u${a:4:4}\\u${a:0:4}; done"
|
adb shell "service call iphonesubinfo 8 | grep -o '[0-9a-f]\{8\} ' | tail -n+3 | while read a; do echo -n \\u${a:4:4}\\u${a:0:4}; done" |
iccid
adb shell "service call iphonesubinfo 11 | grep -o '[0-9a-f]\{8\} ' | tail -n+3 | while read a; do echo -n \\u${a:4:4}\\u${a:0:4}; done"
adb shell "service call iphonesubinfo 12 | grep -o '[0-9a-f]\{8\} ' | tail -n+3 | while read a; do echo -n \\u${a:4:4}\\u${a:0:4}; done"
以上代码在华为手机 p20 pro测试成功,不同厂家call iphonesubinfo x 的数值可能不同,可根据实际情况调整。
下一篇: Scheme宏的二三事