In the Android development process, anti-cheating has always been a commonplace problem, and the simulator detection is often an important part of anti-cheating, followed by the test of the simulator, and everyone to do a simple sharing.
1. Traditional methods of detection.
The traditional detection method mainly is the imsi of simulator, IDS, the default files and so on several aspects to detect.
(1) Default number:
[Java]View PlainCopy
- Private static string[] Known_numbers = {"15555215554", "15555215556",
- "15555215558", "15555215560", "15555215562", "15555215564" ,
- "15555215566", "15555215568", "15555215570", "15555215572" ,
- "15555215574", "15555215576", "15555215578", "15555215580" ,
- " 15555215582", "15555215584"};
(2) Default ID:
[Java]View PlainCopy
- Private static string[] Known_device_ids = {"000000000000000"};
(3) Default IMSI:
[Java]View PlainCopy
- Private static string[] Known_imsi_ids = {"310260000000000"};
(4) Default file path:
[Java]View PlainCopy
- Private static string[] Known_files = {
- "/system/lib/libc_malloc_debug_qemu.so",
- "/sys/qemu_trace",
- "/system/bin/qemu-props"};
Once this information has been learned, it is only necessary to detect it at runtime, and if the test result matches the default value, then the test device is the simulator. However, with the anti-cheating technology iteration, many simulators can now change these values to avoid detection, so the above traditional methods in many cases did not achieve the expected effect of developers.
2. Based on the simulator CPU information detection.
The success rate has a higher success rate than the traditional method.
CPU information detection is mainly in the CPU information to see if it contains Intel, AMD and other fields, many emulators currently for the CPU information can not be simulated.
(1) Read CPU information:
[HTML]View PlainCopy
- public static String Readcpuinfo () {
- String result = "";
- try {
- string[] args = {"/system/bin/cat", "/proc/cpuinfo"};
- Processbuilder cmd = new Processbuilder (args);
- Process Process = Cmd.start ();
- StringBuffer sb = new StringBuffer ();
- String readLine = "";
- BufferedReader responsereader = new BufferedReader (New InputStreamReader (Process.getinputstream (), "Utf-8")) ;
- while ((readLine = responsereader.readline ()) = null) {
- Sb.append (ReadLine);
- }
- Responsereader.close ();
- result = sb.tostring (). toLowerCase ();
- } catch (IOException ex) {
- }
- return result;
- }
(2) to determine:
[Java]View PlainCopy
- String cpuInfo = Readcpuinfo ();
- if ((Cpuinfo.contains ("Intel") | | | cpuinfo.contains ("AMD")) {return true;}
Similarly, there are
[Java]View PlainCopy
- string[] blocklist = "google_sdk,sdk,sdk_x86,vbox86p". Split (",");
Same principle.
3. Critical path detection for specific simulator detection
The previous 2 methods have largely been able to identify many simulators, but for some of the same love of anti-cheating on the simulator, the need for a specific detection method.
Bluestacks successfully evaded the first two detection methods, so here to give its VIP treatment.
The following is a summary of some of the Bluestacks key paths:
[Java]View PlainCopy
- Private static string[] Known_bluestacks = {"/data/app/com.bluestacks.appmart-1.apk", "/data/app/ com.bluestacks.bstcommandprocessor-1.apk ",
- "/data/app/com.bluestacks.help-1.apk", "/data/app/com.bluestacks.home-1.apk", "/data/app/ com.bluestacks.s2p-1.apk ",
- "/data/app/com.bluestacks.searchapp-1.apk", "/data/bluestacks.prop", "/data/data/ Com.androVM.vmconfig ",
- "/data/data/com.bluestacks.accelerometerui", "/data/data/com.bluestacks.appfinder", "/data/data/ Com.bluestacks.appmart ",
- "/data/data/com.bluestacks.appsettings", "/data/data/com.bluestacks.bstcommandprocessor", "/data/ Data/com.bluestacks.bstfolder ",
- "/data/data/com.bluestacks.help", "/data/data/com.bluestacks.home", "/data/data/com.bluestacks.s2p", "/data/data/com.bluestacks.searchapp",
- "/data/data/com.bluestacks.settings", "/data/data/com.bluestacks.setup", "/data/data/ Com.bluestacks.spotlight ", "/mnt/prebundledapps/bluestacks.prop.orig "
- };
Detection method:
[Java]View PlainCopy
- Public Static Boolean checkbluestacksfiles () {
- For (int i = 0; i < known_bluestacks.length; i++) {
- String file_name = known_bluestacks[i];
- File Qemu_file = new File (file_name);
- if (qemu_file.exists ()) {
- FKLOG.E ("Result:find BlueStacks files!");
- return true;
- }
- }
- FKLOG.E ("Result:not Find BlueStacks files!");
- return false;
- }
This detection based on critical path can successfully detect the bluestacks.
4. Simulator Detection new ideas
Both simulator detection and emulator anti-detection are in constant update iterations, and there is no way to ensure that the method will be immortal and share the new ideas here.
Battery Information detection
It is possible to start with information such as the temperature and power of the battery to detect whether the temperature remains constant during use, or if the charge is constant and not absolute.
Pro-Test can identify the genymotion, Bluestacks and other mainstream simulator.
5. Written in the last
In fact, many times in the process of testing the simulator, are not only using a fixed method, one needs specific analysis of concrete problems, and secondly, we need to use a variety of methods to comprehensive detection. Words and in short, with the terrorize can see recruit demolition recruit.
PS: If there is any mistake or need to add the place, please correct me ~
http://blog.csdn.net/sinat_33150417/article/details/51320228
Common methods for detecting Android simulator