Common methods for detecting Android simulator

Source: Internet
Author: User

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
  1. Private static string[] Known_numbers = {"15555215554", "15555215556",
  2. "15555215558", "15555215560", "15555215562", "15555215564" ,
  3. "15555215566", "15555215568", "15555215570", "15555215572" ,
  4. "15555215574", "15555215576", "15555215578", "15555215580" ,
  5. " 15555215582", "15555215584"};

(2) Default ID:

[Java]View PlainCopy
    1. Private static string[] Known_device_ids = {"000000000000000"};

(3) Default IMSI:

[Java]View PlainCopy
    1. Private static string[] Known_imsi_ids = {"310260000000000"};

(4) Default file path:

[Java]View PlainCopy
    1. Private static string[] Known_files = {
    2. "/system/lib/libc_malloc_debug_qemu.so",
    3. "/sys/qemu_trace",
    4. "/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
  1. public static String Readcpuinfo () {
  2. String result = "";
  3. try {
  4. string[] args = {"/system/bin/cat", "/proc/cpuinfo"};
  5. Processbuilder cmd = new Processbuilder (args);
  6. Process Process = Cmd.start ();
  7. StringBuffer sb = new StringBuffer ();
  8. String readLine = "";
  9. BufferedReader responsereader = new BufferedReader (New InputStreamReader (Process.getinputstream (), "Utf-8"))  ;
  10. while ((readLine = responsereader.readline ()) = null) {
  11. Sb.append (ReadLine);
  12. }
  13. Responsereader.close ();
  14. result = sb.tostring (). toLowerCase ();
  15. } catch (IOException ex) {
  16. }
  17. return result;
  18. }

(2) to determine:

[Java]View PlainCopy
    1. String cpuInfo = Readcpuinfo ();
    2. if ((Cpuinfo.contains ("Intel") | | | cpuinfo.contains ("AMD")) {return true;}

Similarly, there are

[Java]View PlainCopy
    1. 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
  1. Private static string[] Known_bluestacks = {"/data/app/com.bluestacks.appmart-1.apk", "/data/app/ com.bluestacks.bstcommandprocessor-1.apk ",
  2. "/data/app/com.bluestacks.help-1.apk", "/data/app/com.bluestacks.home-1.apk", "/data/app/ com.bluestacks.s2p-1.apk ",
  3. "/data/app/com.bluestacks.searchapp-1.apk", "/data/bluestacks.prop", "/data/data/ Com.androVM.vmconfig ",
  4. "/data/data/com.bluestacks.accelerometerui", "/data/data/com.bluestacks.appfinder", "/data/data/ Com.bluestacks.appmart ",
  5. "/data/data/com.bluestacks.appsettings", "/data/data/com.bluestacks.bstcommandprocessor", "/data/ Data/com.bluestacks.bstfolder ",
  6. "/data/data/com.bluestacks.help", "/data/data/com.bluestacks.home", "/data/data/com.bluestacks.s2p", "/data/data/com.bluestacks.searchapp",
  7. "/data/data/com.bluestacks.settings", "/data/data/com.bluestacks.setup", "/data/data/ Com.bluestacks.spotlight ", "/mnt/prebundledapps/bluestacks.prop.orig "
  8. };


Detection method:

[Java]View PlainCopy
  1. Public Static Boolean checkbluestacksfiles () {
  2. For (int i = 0; i < known_bluestacks.length; i++) {
  3. String file_name = known_bluestacks[i];
  4. File Qemu_file = new File (file_name);
  5. if (qemu_file.exists ()) {
  6. FKLOG.E ("Result:find BlueStacks files!");
  7. return true;
  8. }
  9. }
  10. FKLOG.E ("Result:not Find BlueStacks files!");
  11. return false;
  12. }

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.