A detection method, mobile terminal and storage medium for anti-debugging of Android system

By compiling and loading the detection code in the Android system, it monitors network ports and process status in real time, blocks attacks from dynamic debugging tools, improves the security of Android applications, and solves the problem of insufficient security during application operation.

CN112199642BActive Publication Date: 2024-09-13BEIJING ZHI YOU WANG AN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910610301.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-08
Publication Date
2024-09-13
Estimated Expiration
2039-07-08

AI Technical Summary

Technical Problem

Android system applications have low security during operation. Attackers can tamper with applications through dynamic debugging technology, and existing defense measures are difficult to effectively prevent them.

Method used

Compile the detection code in the dynamic link library of the Android system, load and execute the code when the application starts, and determine whether it is being debugged by the debugging tool by detecting the network port status and application process status. If detected, a dialog box will pop up and the application will be terminated.

Benefits of technology

It achieves accurate detection and blocking of common and uncommon debugging tools, improves the runtime security of applications, and prevents attackers from tampering with applications through debugging tools.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112199642B
    Figure CN112199642B
Patent Text Reader

Abstract

The invention discloses an anti-debugging detection method for an Android system, a mobile terminal and a storage medium. Since a detection code is pre-compiled in an Android system dynamic link library and a loading link of the detection code is added in the startup code of an application, the application can load and execute the detection code after startup. The detection code can accurately and timely detect whether the application is being debugged by a common or uncommon debugging tool according to the state of a network port and the state of a main process of the application during the running of the application. Once it is detected that the application is being debugged by the debugging tool, a dialog box is immediately popped up and the program is terminated, thereby interrupting the debugging of the application by the debugging tool, effectively preventing the application from being attacked, and improving the security of the application when it is running.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mobile terminals, and in particular to an Android system anti-debugging detection method, a mobile terminal and a storage medium. Background Art

[0002] Since its release, the Android system has been favored by industry personnel due to its open source, openness and customizability. Today, the market share of the Android system is very high and is growing every year. However, due to its own openness and high market share, the applications on the Android system (hereinafter referred to as applications) have gradually become the main target of hacker attacks.

[0003] When an attacker attacks an application on the Android system, usually after obtaining the target application, the attacker will do a simple static decompilation and search for sensitive call interfaces, and then analyze the more critical code implementation logic. Finally, the attacker directly modifies the code or uses other modification tools to tamper with key information to achieve the purpose of the attack.

[0004] At present, in order to prevent being attacked, applications on the Android system mainly use code obfuscation, core parameter encryption or hardening (also known as shelling), so that attackers cannot obtain useful code implementation logic after static decompilation and viewing, which causes certain obstacles and difficulties for attackers in static analysis. However, in order to quickly and accurately implement attacks and tampering, attackers will use dynamic debugging technology and use one or more debugging tools (such as IDA, apktool) to debug the application, specifically locating the effective code in the process of application operation, and analyzing the key code implementation logic through single-step debugging or dynamic tracking, so as to achieve the purpose of attack. It can be seen that the security of Android system applications during operation is still relatively low.

[0005] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0006] In view of the above-mentioned deficiencies in the prior art, an object of the present invention is to provide an Android system anti-debugging detection method, a mobile terminal and a storage medium, aiming to solve the problem of low security of applications in the existing Android system during operation.

[0007] In a first aspect, the present invention provides an Android system anti-debugging detection method, the method comprising the following steps:

[0008] Compile detection code for detecting network port status and application process status in the initialization function of the Android system dynamic link library in advance, and add a loading link of the detection code in the startup code of the application;

[0009] After the application is started, the detection code is loaded and executed, and the detection code determines whether the application is debugged by a debugging tool according to the network port status and the application process status;

[0010] If it is detected that the application is being debugged by a debugging tool, a prompt dialog box will pop up and the application will be terminated.

[0011] Furthermore, the step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status includes:

[0012] Check whether the network port is occupied by the debugging tool. If so, the application is being debugged by the debugging tool.

[0013] Furthermore, the step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status includes:

[0014] Monitor and capture whether the debugging tool sends a process debugging signal to the main process of the application. If so, the application is being debugged by the debugging tool. The process debugging signal includes: a SIGCONT signal that allows the main process of the application to continue running, and a SIGSTOP signal that suspends the running of threads related to the main process of the application.

[0015] Furthermore, the step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status includes:

[0016] The status value of the main process of the application and the status values ​​of all threads related to the main process are detected. If at least one of the status value of the main process and the status values ​​of all threads is T, the application is being debugged by the debugging tool.

[0017] Furthermore, the step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status also includes:

[0018] A first process for reading the status value of the main process of the application is established, and it is detected whether the status value read by the first process is T. If so, the application is being debugged by a debugging tool.

[0019] Furthermore, the step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status includes:

[0020] Pre-establish the second process, and set the first time threshold and the first termination time.

[0021] After the second process sends the first inspection data to the application main process, the first end time is set to zero and then the timing starts.

[0022] After receiving the first verification data, the application main process sends second verification data to the second process,

[0023] After receiving the second inspection data, the second process stops timing and saves the first termination time.

[0024] Check whether the first termination time is greater than the first time threshold. If so, the application is being debugged by a debugging tool. If not, continue to execute the step of setting the termination time to zero and starting timing after the second process sends the first inspection data to the application main process.

[0025] Furthermore, the step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status includes:

[0026] Establish a third process in advance, and set a second time threshold and a second termination time.

[0027] After the application main process sends the first inspection data to the third process, the second end time is set to zero and then the timing starts.

[0028] After receiving the first verification data, the third process sends the second verification data to the application main process,

[0029] After receiving the second verification data, the application main process stops timing and saves the second termination time.

[0030] Check whether the second termination time is greater than the second time threshold. If so, the application is being debugged by a debugging tool. If not, continue to execute the step of setting the second termination time to zero and starting timing after the application main process sends the first verification data to the third process.

[0031] In a second aspect, the present invention provides a mobile terminal, comprising a processor, a memory and a communication bus;

[0032] The memory stores an Android system anti-debugging detection method program that can be executed by the processor;

[0033] The communication bus realizes the connection and communication between the processor and the memory;

[0034] When the processor executes the Android system anti-debugging detection method program, it implements any one of the steps in the Android system anti-debugging detection method.

[0035] In a third aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in any one of the Android system anti-debugging detection methods.

[0036] In a fourth aspect, the present invention provides an Android system anti-debugging detection device, which includes:

[0037] A startup unit, used to start the application and load the detection code;

[0038] A detection unit, used for detecting in real time whether an application is debugged by a debugging tool;

[0039] A processing unit, used to pop up a prompt dialog box and terminate the application.

[0040] Compared with the prior art, the present invention provides an Android system anti-debugging detection method, a mobile terminal and a storage medium. Since the detection code is pre-compiled in the Android system dynamic link library and a loading link of the detection code is added in the startup code of the application, the application can load and execute the detection code after startup. During the application running process, the detection code can accurately and timely detect whether the application is being debugged by a common or uncommon debugging tool according to the state of the network port and the state of the application main process. Once it is detected that the application is being debugged by the debugging tool, a dialog box is immediately popped up and the program is terminated, thereby interrupting the debugging of the application by the debugging tool, effectively preventing the application from being attacked, and improving the security of the application during runtime. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A flowchart of an Android system anti-debugging detection method provided by the present invention.

[0042] Figure 2 It is a functional module diagram of a preferred embodiment of the mobile terminal of the present invention.

[0043] Figure 3 A functional module diagram of a preferred embodiment of installing a mobile terminal of the present invention. DETAILED DESCRIPTION

[0044] The present invention provides an Android system anti-debugging detection method, a mobile terminal and a storage medium. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0045] See also Figure 1 The present invention provides an Android system anti-debugging detection method comprising the following steps:

[0046] S10, compile a detection code for detecting the network port status and the application process status in advance in the initialization function of the Android system dynamic link library, and add a loading link of the detection code in the startup code of the application;

[0047] In the Android system, the root directory of any application must contain an AndroidManifest.xml file, which contains the Application tag. When the application is started, the system will create one and only one Application class object for the application, and the life cycle of this object is equal to the life cycle of the application (from startup to termination). There is a special function _init function in the dynamic link library, also known as the initialization function. The initialization function will be automatically executed when the dynamic link library is loaded, and is mainly used to initialize the dynamic link library.

[0048] Specifically, add a loading link for the detection code in the attachBaseContext or onCreate function of the Application class specified in the AndroidManifest.xml file of the application, and compile the detection code in the initialization function of the system's dynamic link library. Since the application will load the dynamic link library after startup, and the dynamic link library will automatically run the initialization function after loading, and then run the detection code, it can be ensured that the detection code can be loaded and executed immediately after the application is started, and the detection code can keep running during the operation of the application, ensuring the reliability of subsequent real-time detection.

[0049] S20, after the application is started, the detection code is loaded and executed, and the detection code determines whether the application is debugged by a debugging tool according to the network port status and the application process status;

[0050] In one embodiment, the step S20 includes:

[0051] S201. Detect whether the network port is occupied by a debugging tool. If so, the application is being debugged by the debugging tool.

[0052] When an application is debugged by a debugging tool, the debugging tool and the application are in a state of communication. When the corresponding network ports on the Android system and the PC (the debugging tool usually runs on the PC) are forwarded, the debugging tool can communicate with the application through the Android system's android-server program. In addition, commonly used debugging tools have their own default port numbers. For example, the default network port number of the IDA debugging tool is 23946, and the default network port number of apktool is 5037 (apktool occupies the adb port).

[0053] Therefore, the default port numbers occupied by common debugging tools can be stored in an array or other forms in advance, and then some network ports of the Android system can be detected to see if they are occupied by common debugging tools. If so, the application is being debugged by the debugging tools; if not, continue to detect. This detection logic can effectively detect whether the application is being debugged by some common debugging tools.

[0054] In another embodiment, the step S20 includes:

[0055] S202, monitoring and capturing whether the debugging tool sends a process debugging signal to the main process of the application. If so, the application is being debugged by the debugging tool; wherein the process debugging signal includes: a SIGCONT signal that enables the main process of the application to continue running, and a SIGSTOP signal that suspends the running of threads related to the main process of the application.

[0056] When an application is debugged by a debugging tool, the main process of the application will be suspended due to debugging. At this time, if the debugger wants to resume the application, it is necessary to send a process debugging signal SIGCONT to the main process of the application, so it is necessary to monitor and capture this process signal; in addition, in order to prevent being detected during the debugging process, attackers usually send a process debugging signal SIGSTOP to threads related to the main process to stop the running of these threads. The detection code is a thread under the main thread at this time. If the detection code is stopped, the application will be debugged and then attacked, so it is also necessary to monitor and capture this process signal.

[0057] Therefore, by monitoring whether a debugging tool sends a process debugging signal to the main process of the application, if so, the signal is captured and detected to see if it is a SIGCONT signal or a SIGSTOP signal. If so, the application is being debugged by the debugging tool; if not, continue to monitor. This detection logic can effectively detect whether the application is being debugged by some common or uncommon debugging tools.

[0058] In another embodiment, the step S20 includes:

[0059] S203: Detect the status value of the main process of the application and the status values ​​of all threads related to the main process. If at least one of the status value of the main process and the status values ​​of all threads is T, the application is being debugged by a debugging tool.

[0060] When an application is being debugged by a debugging tool, attackers usually debug the main process of the application or some threads related to the main process. No matter which of the main process or thread is being debugged, the status value of the process or thread will become T (tracing stop, indicating that the process or thread is being debugged). In specific implementation, the id value of the current main process of the application can be obtained through the getpid function, and then the id values ​​of all threads related to the main process of the application are obtained, and finally the status values ​​of the main process and all threads are traversed and detected. For example, first use the getpid function to get the id value of the current application main process as 28363, and there are multiple threads such as 28363, 28371 and 28528 in the main process directory ( / proc / 28363 / task) (all threads related to the main process have been obtained at this time). Then you can read and detect the State value in the directory / proc / 28363 / status file (this value is the status value of the application main process), the State value in the directory / proc / 28371 / status file (this value is the status value of one of the threads related to the application main process) and the State value in the directory / proc / 28528 / status file (the State value in this folder can be read directly without unnecessary parsing and conversion operations).

[0061] Therefore, by traversing (which can be achieved by looping or other means) and detecting the status value of the application's main process and the status values ​​of all threads related to the main process, if at least one of the status value of the main process and the status values ​​of all threads is T, the application is being debugged by a debugging tool; if not, continue traversing and detecting. This detection logic can effectively detect whether the application is being debugged by some common or uncommon debugging tools.

[0062] In another embodiment, the step S20 includes:

[0063] S204: Establish a first process for reading the status value of the main process of the application, and detect whether the status value read by the first process is T. If so, the application is being debugged by a debugging tool.

[0064] If the application is being debugged by a debugging tool, there may be a situation where the main process and all its threads cannot obtain their own status values ​​after being suspended by the debugging tool. In order to prevent this situation, a process can be established, preferably as a child process of the application main process. Then, this process can read the id value of the main process through the getppid function, and then read the status value of the main process.

[0065] Therefore, the state value of the main process of the application is read by the first process to detect whether the state value is T. If so, the application is being debugged by the debugging tool; if not, the reading and detection are continued. This detection logic can effectively detect whether the application is being debugged by some common or uncommon debugging tools.

[0066] In another embodiment, the step S20 includes S203 and S204;

[0067] Specifically, through the first process, it is possible to ensure that the id of the main process of the application can be obtained, and then the ids of all threads related to the main process can be obtained, so that the traversal and detection of whether at least one of the status values ​​of the main process and all threads is T can be continued, so as to accurately determine whether the application is being debugged by a debugging tool. Through this detection logic, the reliability of the detection can be ensured, and whether the application is being debugged by some common or uncommon debugging tools can be effectively detected.

[0068] In another embodiment, the step S20 includes S205, and S205 specifically includes:

[0069] S2051, pre-establishing a second process, and setting a first time threshold and a first termination time;

[0070] When the main process of an application is debugged by a debugging tool, the main process will be in a suspended state. If a process is pre-established to communicate with the main process of the application in real time, it is preferred to establish a main process subprocess. If an abnormal communication operation is detected, it can be determined whether the application is being debugged. In order to detect this abnormal operation, a first time threshold and a first termination time are set for comparison and detection in subsequent steps, wherein the first time threshold only needs to be slightly greater than the time taken for a complete communication when the main process of the application is not debugged, and the first termination time is used to record the time taken for a complete communication.

[0071] S2052: After the second process sends the first inspection data to the application main process, the first end time is set to zero and then the timing starts;

[0072] S2053: After receiving the first verification data, the application main process sends second verification data to the second process;

[0073] S2054: After receiving the second inspection data, the second process stops timing and saves the first termination time;

[0074] The above steps are a complete communication process. When implemented, first, the second process sends the first check data to the main process, and sets the first end time to 0 and starts timing. The first end time is set to 0 to ensure that the first end time can accurately record the time spent in a complete communication process. The first check data can be set arbitrarily, for example, sending a string "1".

[0075] Then, after receiving the first verification data, the main process feeds back the second verification data to the second process, wherein the second verification data can also be set arbitrarily, such as the string "1"; or it can be obtained after a predetermined processing of the first verification data, for example, the first verification data is the string "1", and the preset processing flow is to add one to the first verification data, then the second verification data obtained is the string "2".

[0076] Finally, after receiving the second verification data, the second process stops timing and assigns the time spent in this process to the first termination time. At this time, the value of the first termination time becomes the time spent in a complete communication process.

[0077] S2055: Detect whether the first termination time is greater than the first time threshold. If so, the application is being debugged by a debugging tool. If not, continue to execute step S2052.

[0078] If the main process of the application is not debugged by the debugging tool, the communication process will not be abnormal, and the first termination time is less than the first time threshold; if the main process of the application is being debugged by the debugging tool, the communication process will be abnormal, and the first termination time is greater than the first time threshold. By comparing the size between the two, it can be accurately reflected whether the current main process of the application is debugged by the application tool. If the first termination time is less than the first time threshold during a complete communication process, step S2052 is continued to be executed, and the loop detection is continued. This detection logic can effectively detect whether the application is debugged by some common or uncommon debugging tools.

[0079] In another embodiment, the step S20 includes S206, and S206 specifically includes:

[0080] S2061, pre-establish a third process, and set a second time threshold and a second termination time; this step has the same design principle as S2051.

[0081] S2062, after the application main process sends the third inspection data to the third process, the second end time is set to zero and then the timing starts;

[0082] S2063: After receiving the third verification data, the third process sends fourth verification data to the application main process;

[0083] S2064: After receiving the fourth verification data, the application main process stops timing and saves the second end time;

[0084] The above steps are a complete communication process, which is similar to the communication process of step S205. The difference is that the application main process first sends the verification data to the third process, and the third process feeds back the verification data after receiving it.

[0085] S2065: Detect whether the second termination time is greater than the second time threshold. If so, the application is being debugged by a debugging tool. If not, continue to execute step S2062.

[0086] If the main process of the application is not debugged by the debugging tool, the communication process will not be abnormal, and the second termination time is less than the second time threshold; if the main process of the application is being debugged by the debugging tool, the communication process will be abnormal, and the second termination time is greater than the second time threshold. By comparing the size between the two, it can be accurately reflected whether the current main process of the application is debugged by the application tool. If the second termination time is less than the second time threshold during a complete communication process, step S2052 is continued to be executed, and the loop detection is continued. This detection logic can effectively detect whether the application is debugged by some common or uncommon debugging tools.

[0087] S30: If it is detected that the application is being debugged by a debugging tool, a prompt dialog box is popped up and the application is terminated.

[0088] If it is detected in the above step S20 that the application is being debugged by a debugging tool, a prompt dialog box is popped up and the application is terminated immediately to prevent the debugging tool from further debugging the application.

[0089] As can be seen from the above, the present invention provides an Android system anti-debugging detection method. Since the detection code is pre-compiled in the Android system dynamic link library and a loading link of the detection code is added in the startup code of the application, the application can load and execute the detection code after startup. During the application running process, the detection code can accurately and timely detect whether the application is being debugged by a common or uncommon debugging tool according to the state of the network port and the state of the application main process. Once it is detected that the application is being debugged by the debugging tool, a dialog box is immediately popped up and the program is terminated, thereby interrupting the debugging of the application by the debugging tool, effectively preventing the application from being attacked, and improving the security of the application during runtime.

[0090] See also Figure 2Based on the above-mentioned anti-debugging detection method of the Android system, the present invention also provides a mobile terminal, which can be a computing device such as a mobile phone, a desktop computer, a palm computer, and a server. The mobile terminal includes a processor 10, a memory 20, and a display screen 30. The processor 10 is connected to the memory 20 via a communication bus 50, and the display screen 30 is connected to the processor 10 via the communication bus 50. Figure 2 Only some of the components of the mobile terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0091] In some embodiments, the memory 20 may be an internal storage unit of the mobile terminal, such as the memory of the mobile terminal. In other embodiments, the memory 20 may also be an external storage device of the mobile terminal, such as a plug-in USB flash drive, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the mobile terminal. Further, the memory 20 may also include both an internal storage unit of the mobile terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the mobile terminal, such as the program code of the mobile terminal installed. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, the memory 20 stores an Android system anti-debugging detection method program 40, which can be executed by the processor 10, thereby realizing the Android system anti-debugging detection method in the present application.

[0092] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, a mobile phone baseband processor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the detection method based on Android system anti-debugging.

[0093] In some embodiments, the display screen 30 may be an LED display screen, a liquid crystal display screen, a touch-sensitive liquid crystal display screen, an OLED (Organic Light-Emitting Diode) touch screen, etc. The display screen 30 is used to display information on the mobile terminal and to display a visual user interface. The components 10-30 of the mobile terminal communicate with each other via a system bus.

[0094] In one embodiment, when the processor 10 executes the Android system anti-debugging detection method program 40 in the memory 20, the steps in any one of the Android system anti-debugging detection methods are implemented, as described above.

[0095] See also Figure 3 , which is a functional module diagram of a preferred embodiment of the present invention for installing a computer program for detecting a method for detecting an anti-debugging of an Android system on a mobile terminal. In this embodiment, the system for installing a computer program for detecting a method for detecting an anti-debugging of an Android system can be divided into one or more modules, and the one or more modules are stored in the memory 20 and executed by one or more processors (the processor 10 in this embodiment) to complete the present invention. For example, in Figure 3 In the embodiment, the mobile terminal in which the mobile terminal flashing control processing method computer program is installed can be divided into a startup unit 21, a detection unit 22, and a processing unit 23. The unit referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which is more suitable for describing the execution process of the Android system anti-debugging detection method program in the mobile terminal than a program. The following description will specifically introduce the functions of the modules 21-23.

[0096] A startup unit 21, used to start the application and load the detection code;

[0097] A detection unit 22, used for detecting in real time whether an application is debugged by a debugging tool;

[0098] The processing unit 23 is used to pop up a prompt dialog box and terminate the application, as described above.

[0099] Based on the above embodiments, the present invention also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the Android system anti-debugging detection method as described in any one of the above, as described above.

[0100] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A detection method for anti-debugging of an Android system, characterized in that: Includes steps: Compile detection code for detecting network port status and application process status in the initialization function of the Android system dynamic link library in advance, and add a loading link of the detection code in the startup code of the application. After the application is started, the dynamic link library is loaded, and the initialization function is automatically run when the dynamic link library is loaded, and then the detection code is run; After the application is started, the detection code is loaded and executed, and the detection code determines whether the application is debugged by a debugging tool according to the network port status and the application process status; The step of the detection code judging whether the application is debugged by the debugging tool according to the network port status and the application process status comprises: Monitor and capture whether the debugging tool sends a process debugging signal to the main process of the application. If so, the application is being debugged by the debugging tool. The process debugging signal includes: a SIGCONT signal that enables the main process of the application to continue running, and a SIGSTOP signal that suspends the running of threads related to the main process of the application. Check whether the network port is occupied by the debugging tool. If so, the application is being debugged by the debugging tool. Get the id value of the current application main process through the getpid function, and obtain the id values ​​of all threads related to the application main process, and finally traverse and detect the status values ​​of the main process and all threads to reduce the operation of parsing and conversion; Detecting a status value of the main process of the application and status values ​​of all threads related to the main process, if at least one of the status value of the main process and the status values ​​of all threads is T, the application is being debugged by a debugging tool; If it is detected that the application is being debugged by a debugging tool, a prompt dialog box will pop up and the application will be terminated.

2. The method for detecting anti-debugging of an Android system according to claim 1, characterized in that: The step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status also includes: A first process for reading the status value of the main process of the application is established, and it is detected whether the status value read by the first process is T. If so, the application is being debugged by a debugging tool.

3. The method for detecting anti-debugging of an Android system according to claim 1, characterized in that: The step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status comprises: Pre-establish the second process, and set the first time threshold and the first termination time. After the second process sends the first inspection data to the application main process, the first end time is set to zero and then the timing starts. After receiving the first inspection data, the application main process sends second inspection data to the second process, After receiving the second inspection data, the second process stops timing and saves the first termination time. Check whether the first termination time is greater than the first time threshold. If so, the application is being debugged by a debugging tool. If not, continue to execute the step of setting the termination time to zero and starting timing after the second process sends the first inspection data to the application main process.

4. The method for detecting anti-debugging of an Android system according to claim 1, characterized in that: The step of the detection code judging whether the application is attacked by the debugging tool according to the network port status and the application process status comprises: Establish a third process in advance, and set a second time threshold and a second termination time. After the application main process sends the third inspection data to the third process, the second end time is set to zero and then the timing starts. After receiving the third inspection data, the third process sends fourth inspection data to the application main process, After receiving the fourth verification data, the application main process stops timing and saves the second termination time. Check whether the second termination time is greater than the second time threshold. If so, the application is being debugged by a debugging tool. If not, continue to execute the step of setting the second termination time to zero and starting timing after the application main process sends the first verification data to the third process.

5. A mobile terminal, characterized in that: including, a processor, a memory and a communication bus; The memory stores an Android system anti-debugging detection method program that can be executed by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the Android system anti-debugging detection method program, the steps in the Android system anti-debugging detection method as described in any one of claims 1-4 are implemented.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the Android system anti-debugging detection method as described in any one of claims 1-4.

7. An Android system anti-debugging detection device, characterized in that: include: A startup unit, used to start the application and load the detection code; The steps of starting the application and loading the detection code include: Compile detection code for detecting network port status and application process status in the initialization function of the Android system dynamic link library in advance, and add a loading link of the detection code in the startup code of the application. After the application is started, the dynamic link library is loaded, and the initialization function is automatically run when the dynamic link library is loaded, and then the detection code is run; A detection unit, used for detecting in real time whether an application is debugged by a debugging tool; The step of detecting in real time whether the application is debugged by the debugging tool comprises: After the application is started, the detection code is loaded and executed, and the detection code determines whether the application is debugged by a debugging tool according to the network port status and the application process status; The step of the detection code judging whether the application is debugged by the debugging tool according to the network port status and the application process status comprises: Monitor and capture whether the debugging tool sends a process debugging signal to the main process of the application. If so, the application is being debugged by the debugging tool. The process debugging signal includes: a SIGCONT signal that enables the main process of the application to continue running, and a SIGSTOP signal that suspends the running of threads related to the main process of the application. Check whether the network port is occupied by the debugging tool. If so, the application is being debugged by the debugging tool. Get the id value of the current application main process through the getpid function, and obtain the id values ​​of all threads related to the application main process, and finally traverse and detect the status values ​​of the main process and all threads to reduce the operation of parsing and conversion; Detecting a status value of the main process of the application and status values ​​of all threads related to the main process, if at least one of the status value of the main process and the status values ​​of all threads is T, the application is being debugged by a debugging tool; A processing unit, used to pop up a prompt dialog box and terminate the application; The steps for popping up a prompt dialog box and terminating the application include: If it is detected that the application is being debugged by a debugging tool, a prompt dialog box will pop up and the application will be terminated.