当前位置:网站首页>Detection and analysis of simulator in an app
Detection and analysis of simulator in an app
2022-06-25 11:06:00 【Hua Weiyun】
The following is just part of the implementation of shared detection , And only for technology .
1. Implementation of test simulator
1. Test the simulator's imsi Of id Whether it is 310260000000000
Concrete implementation : Judge first if there is android.permission.READ_PHONE_STATE jurisdiction , In judging the current running environment imsi id Whether it is 310260000000000 This value , And judgment VoiceMailNumbe Is it equal to 15552175049 and GetDeviceId be equal to "000000000000000", "012345678912345" These two strings of values .
private static boolean a(Context context, String str, String[] strArr, String str2) { boolean z; boolean z2; boolean z3; String[] strArr2; if (context.getPackageManager().checkPermission("android.permission.READ_PHONE_STATE", context.getPackageName()) == 0) { z = true; } else { z = false; } if (z) { z2 = false; for (String str3 : d) { if (z2 || StringUtils.equal(str3, str)) { z2 = true; } else { z2 = false; } } } else { z2 = false; } if (strArr != null) { for (String equal : strArr) { if (StringUtils.equal(equal, "310260000000000") || z2) { z3 = true; } else { z3 = false; } } } if (z2 || StringUtils.equal(str2, "15552175049")) { return true; } return false;}
2. Check the driver file content of the simulator
Specific test steps : Judge /proc/tty/drivers Whether the file exists or can be read . Read out the specific content data to compare whether it contains goldfish character string
private static String[] b = {"goldfish"};
private static Boolean a() {
String str; File file = new File("/proc/tty/drivers"); if (!file.exists() || !file.canRead()) { String str2 = "EmulatorChecker"; StringBuilder sb = new StringBuilder("can not read file /proc/tty/drivers ,because"); if (file.exists()) { str = "not exist"; } else { str = "not readable"; } sb.append(str); Logger.e(str2, sb.toString()); } else { byte[] bArr = new byte[1024]; try { FileInputStream fileInputStream = new FileInputStream(file); fileInputStream.read(bArr); fileInputStream.close(); } catch (Exception unused) { } String str3 = new String(bArr); for (String contains : b) { if (str3.contains(contains)) { return Boolean.TRUE; } } } return Boolean.FALSE;}
3. Detect specific files and file attributes of the simulator
Specific steps : Judge to read the specified file and file properties , And judging the unique Genymotion Simulator , It's using ro.product.manufacturer Read the way of the mobile phone manufacturer
private static int a(h hVar) {
int i; int i2; String[] strArr = {"/system/bin/qemu_props", "/system/bin/androVM-prop", "/system/bin/microvirt-prop", "/system/lib/libdroid4x.so", "/system/bin/windroyed", "/system/bin/microvirtd", "/system/bin/nox-prop", "/system/bin/ttVM-prop", "/system/bin/droid4x-prop", "/data/.bluestacks.prop"}; String[] strArr2 = {"init.svc.vbox86-setup", "init.svc.droid4x", "init.svc.qemud", "init.svc.su_kpbs_daemon", "init.svc.noxd", "init.svc.ttVM_x86-setup", "init.svc.xxkmsg", "init.svc.microvirtd", "ro.kernel.android.qemud", "androVM.vbox_dpi", "androVM.vbox_graph_mode"}; int i3 = 0; for (int i4 = 0; i4 < 10; i4++) { if (a(strArr[i4])) { i2 = 1 << i4; } else { i2 = 0; } i3 |= i2; a(strArr[i4]); } int i5 = 10; for (int i6 = 0; i6 < 11; i6++) { String str = strArr2[i6]; if (StringUtils.isEmpty(hVar.a(str))) { i = 0; } else { i = 1 << i5; } i3 |= i; StringUtils.isEmpty(hVar.a(str)); i5++; } Pair pair = new Pair("ro.product.manufacturer", "Genymotion"); String a2 = hVar.a((String) pair.first); if (StringUtils.isEmpty(a2) || !a2.contains((CharSequence) pair.second)) { return i3; } return i3 | (1 << i5);}
4. Determine whether the specified device file exists
Determine whether the following three files exist
private static String[] c = {"/dev/socket/qemud", "/dev/qemu_pipe", "/dev/qemu_trace"};
private static boolean a(String str) {
if (StringUtils.isEmpty(str)) { return false; } File file = new File(str); if (file.exists()) { return true; } try { new FileInputStream(file); return true; } catch (FileNotFoundException e) { if (!e.getMessage().contains("No such file or directory")) { return true; } return false; }}
边栏推荐
- Application of global route guard
- Is it safe to open an account through mobile phone if you open an account through stock speculation? Who knows?
- 看完这篇 教你玩转渗透测试靶机Vulnhub——DriftingBlues-7
- 炒股票开户的话,手机开户安全吗?有谁知道啊?
- 每日3题(2)- 找出数组中的幸运数
- 手机办理长投学堂证券开户靠谱安全吗?
- GaussDB 如何统计用户sql的响应时间
- Task03 probability theory
- WPF binding expression and binding data source (I)
- 【系统分析师之路】第六章 复盘需求工程(综合知识概念)
猜你喜欢
[file inclusion vulnerability-04] classic interview question: how to getshell when a website is known to have only local file inclusion vulnerability?
报名开启|飞桨黑客马拉松第三期如约而至,久等啦
Opencv learning (I) -- environment building
之前字符串反转的题目
Oracle彻底卸载的完整步骤
Houdini graphic notes: could not create OpenCL device of type (houdini_ocl_devicetype) problem solving
龙书虎书鲸书啃不动?试试豆瓣评分9.5的猴书
网络远程访问的方式使用树莓派
Upload and modify the use of avatars
Explanation and use of kotlin syntax for Android
随机推荐
Performance file system
Previous string inversion topic
GaussDB others内存比较高的场景
Compilation of learning from Wang Shuang (1)
Opencv learning (I) -- environment building
Open source invites you to participate in the openssf Open Source Security Online Seminar
OODA working method
Opencv learning (II) -- installing opencv on raspberry pie
性能之内存篇
Shardingsphere proxy 5.0 sub database and sub table (I)
手机炒股安全吗?
Is it safe to open an account with Guangzhou securities by mobile phone?
Dependent properties, dependent additional properties, and type conversions
Technical practice and development trend of video conference all in one machine
GaussDB 如何统计用户sql的响应时间
CDN+COS搭建图床超详细步骤
GaussDB 集群维护案例集-sql执行慢
scrapy+scrapyd+gerapy 爬虫调度框架
WPF prism framework
【上云精品】节能提效!加速纺织业“智造”转型