Method and device for realizing hook
A unique and unique technology, applied in the field of Android security, which can solve the problems of hardening server overhead, high configuration complexity, and long APK hardening time.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0062] like figure 1 As shown, it is a flowchart of a method for implementing hook provided in Embodiment 1 of the present application, including the following steps:
[0063] Step 101: Determine the return value type of the hook function to be generated.
[0064] In the specific implementation, since the return value type between the hooked Java function and the hook function needs to be consistent when hooking the Java layer function, the return value of the Java function can be determined first before generating the hook function type, and then it can be determined that the type of the return value of the hook function to be generated is the same as the type of the return value of the determined Java function.
[0065] Specifically, there are 10 return value types of the determined Java function, and correspondingly, the following 10 return value types of hook functions need to be generated respectively. Wherein, the corresponding relationship between the hook function to...
Embodiment 2
[0088] When the terminal device runs any repackaged APK, it can refer to the following figure 2 The steps shown to hook:
[0089] Step 201: The terminal device loads the so library according to the instruction for loading the so library included in the Android installation package APK of the hook, wherein the so library contains different return value types and the parameter types are all variable parameters. hook function.
[0090] Step 202: traverse all Java functions that need to be hooked in the APK, and execute steps 203 to 204 for each Java function that needs to be hooked.
[0091] Step 203: Select an unused hook function that has the same return value type as the Java function from the so library.
[0092] In the specific implementation, according to the return value type extracted from the APK corresponding to the Java function that needs to be hooked, select the same return value type from the hook functions pointed to by the 10 function pointer arrays in the so l...
Embodiment 3
[0100] like image 3 As shown, the schematic structural diagram of the device for implementing hook provided in Embodiment 3 of the present application includes:
[0101] Determine module 31, be used for determining the return value type of the hook function that needs to generate;
[0102] The first generation module 32 is used to generate a hook function whose parameter type is a variable parameter and has the return value type for each return value type;
[0103] The second generation module 33 is used to generate the so library based on the hook function corresponding to each return value type;
[0104] The extraction module 34 is used for each Android installation package APK that needs to be hooked, and extracts the return value type of each Java function that needs to be hooked in the APK and saves it in the APK, so that when the terminal runs the APK, from Select an unused hook function that has the same return value type as the Java function that needs to be hooked ...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com