Function calling method, device and storage medium under Java

CN114281430BActive Publication Date: 2025-12-30武汉斗鱼鱼乐网络科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011035052.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-27
Publication Date
2025-12-30
Estimated Expiration
2040-09-27

AI Technical Summary

Benefits of technology

[0061]Compared to existing technologies, this application proposes a modification that designs all function addresses in the SO layer as a single function address. Each SO layer function address is assigned a unique number to distinguish multiple functions within the SO layer. This unique number can be obtained through a design scheme, such as adding the Java layer function name to the SO file's release version number and timestamp, and then calculating its MD5 hash. The purpose of this is to change the function numbers of all SO layers with each SO release, thus achieving variability. Since each function's parameters and return value are different during invocation, a single function for setting them up cannot be used. Therefore, the function parameters and return values ​​are modified to achieve consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114281430B_ABST
    Figure CN114281430B_ABST
Patent Text Reader

Abstract

The application relates to the field of software security, and provides a function calling method, device and equipment under Java and a storage medium. The method comprises the following steps: acquiring parameters of multiple target functions of an So file and function names of the multiple target functions; encoding the multiple target function parameters through protobuf to obtain multiple encoded parameters; acquiring a version number of the So file and a time stamp corresponding to the version number of the So file; calculating multiple target function numbers through a message digest algorithm Md5 based on the function names of the multiple target functions, the version number of the So file and the time stamp corresponding to the version number of the So file; taking each encoded parameter and each target function number as a new parameter of each target function to obtain multiple functions with completed settings; associating each function with completed settings and each target function to obtain a mapping relationship; acquiring a function called by a user to obtain an input function; and searching and calling the input function through a Shellcode and the mapping relationship. The safety of function calling is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software security, and more particularly to a method, apparatus, device, and storage medium for function calls in Java. Background Technology

[0002] For Android's current SO (Sort) framework, functions within the SO are dynamically registered for use by the Java layer. The purpose of using SO to write core functions for the Java layer is to ensure the security of these core functions. However, dynamic registration requires disclosing the memory addresses of all SO functions to the Java layer. This exposes all core interface functions of the SO layer, making it extremely easy for hackers to know the memory addresses of these core functions and thus reverse engineer their implementation. Summary of the Invention

[0003] This invention provides a method to protect the memory address of dynamically registered core functions. This prevents hackers from knowing the location of the core function code through dynamic registration, thus hindering their ability to reverse engineer the core function code.

[0004] Firstly, this application provides a method for function calls in Java, including:

[0005] Obtain the parameters and function names of multiple objective functions from the SO file;

[0006] The multiple objective function parameters are encoded using protobuf to obtain multiple encoded parameters;

[0007] Obtain the version number of the SO file and the timestamp corresponding to the version number of the SO file;

[0008] The message digest Md5 algorithm is used to calculate multiple target function numbers from the function names of the multiple target functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file.

[0009] Each encoded parameter and each target function number are used as new parameters for each target function to obtain multiple functions that have been configured.

[0010] Associating each of the completed functions with each of the target functions yields a mapping relationship;

[0011] Get the function called by the user and obtain the input function;

[0012] The input function is located and invoked from the SO file using the Shellcode and the mapping relationship.

[0013] In some possible designs, the step of calculating multiple objective function numbers using the Message Digest-based MD5 algorithm, taking the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file, includes:

[0014] The multiple target function numbers are calculated using the formula So_Name = Sha-128(java_function_name + version + timestamp), where java_function_name is the function name of the target function, version is the version number of the So file, timestamp is the timestamp corresponding to the version number of the So file, and So_Name is the target function number.

[0015] In some possible designs, associating each of the completed functions with each of the target functions to obtain a mapping relationship includes:

[0016] Obtain the memory address of the function that has been set;

[0017] The multiple target function numbers and the memory addresses of the functions that have been set are stored in an array to obtain a complete mapping relationship.

[0018] In some possible designs, the step of locating and calling the input function from the SO file using the shellcode and the mapping relationship includes:

[0019] Allocate memory space for the shellcode;

[0020] The memory address of the input function is found based on the complete mapping relationship, and the memory address of the input function is obtained.

[0021] The input function is called using the memory space and the memory address of the input function.

[0022] In some possible designs, the step of finding the memory address of the input function based on the complete mapping relationship to obtain the memory address of the input function includes:

[0023] Calculate the function number of the input function;

[0024] Match each of the target function numbers in the complete mapping relationship;

[0025] If a matching target function number exists, the address of the corresponding target function is used as the memory address of the input function.

[0026] In some possible designs, after the step of calculating the multiple objective function numbers using the message digest MD5 algorithm by combining the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file, the method further includes:

[0027] Obtain a preset target encryption algorithm and a corresponding decryption algorithm;

[0028] The target function numbers are encrypted using the target encryption algorithm to obtain the encrypted target function numbers;

[0029] The encrypted target function number is stored in the log code;

[0030] Accordingly, before the step of storing the multiple target function numbers and the memory addresses of the completed functions into an array to obtain the complete mapping relationship, the method further includes:

[0031] The encrypted target function number stored in the log code is decrypted using the decryption algorithm corresponding to the target encryption algorithm, thus obtaining the decrypted target function number.

[0032] In some possible designs, after calculating multiple objective function numbers using the message digest MD5 algorithm based on the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file, the method further includes:

[0033] If the target function number is 0, then obtain the corresponding function name, the corresponding timestamp, and the corresponding version number.

[0034] Secondly, this application provides an apparatus for function calls in Java, which has the functionality to implement a method for a platform corresponding to the function calls in Java provided in the first aspect above. The functionality can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functionality, and the modules can be software and / or hardware.

[0035] The device for function calls in Java includes:

[0036] The acquisition module is used to obtain the parameters of multiple objective functions in the SO file, as well as the function names of the multiple objective functions;

[0037] The processing module is used to encode the multiple target function parameters using protobuf to obtain multiple encoded parameters; obtain the version number of the SO file and the timestamp corresponding to the version number of the SO file; calculate multiple target function numbers using the message digest MD5 algorithm based on the function names of the multiple target functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file; use each encoded parameter and each target function number as a new parameter for each target function to obtain multiple completed functions; associate each completed function with each target function to obtain a mapping relationship; obtain the function called by the user to obtain the input function; and search for and call the input function from the SO file using Shellcode and the mapping relationship.

[0038] In some possible designs, the processing module is also used for:

[0039] The multiple target function numbers are calculated using the formula So_Name = Sha-128(java_function_name + version + timestamp), where java_function_name is the function name of the target function, version is the version number of the So file, timestamp is the timestamp corresponding to the version number of the So file, and So_Name is the target function number.

[0040] In some possible designs, the processing module is also used for:

[0041] Obtain the memory address of the function that has been set;

[0042] The multiple target function numbers and the memory addresses of the functions that have been set are stored in an array to obtain a complete mapping relationship.

[0043] In some possible designs, the processing module is also used for:

[0044] Allocate memory space for the shellcode;

[0045] The memory address of the input function is found based on the complete mapping relationship, and the memory address of the input function is obtained.

[0046] The input function is called using the memory space and the memory address of the input function.

[0047] In some possible designs, the processing module is also used for:

[0048] Calculate the function number of the input function;

[0049] Match each of the target function numbers in the complete mapping relationship;

[0050] If a matching target function number exists, the address of the corresponding target function is used as the memory address of the input function.

[0051] In some possible designs, the processing module is also used for:

[0052] Obtain a preset target encryption algorithm and a corresponding decryption algorithm;

[0053] The target function numbers are encrypted using the target encryption algorithm to obtain the encrypted target function numbers;

[0054] The encrypted target function number is stored in the log code;

[0055] Accordingly, before the step of storing the multiple target function numbers and the memory addresses of the completed functions into an array to obtain the complete mapping relationship, the method further includes:

[0056] The encrypted target function number stored in the log code is decrypted using the decryption algorithm corresponding to the target encryption algorithm, thus obtaining the decrypted target function number.

[0057] In some possible designs, the processing module is also used for:

[0058] If the target function number is 0, then obtain the corresponding function name, the corresponding timestamp, and the corresponding version number.

[0059] This application also provides a device for function calls in Java, which includes at least one connected processor, memory, and input / output unit, wherein the memory is used to store program code, and the processor is used to call the program code in the memory to execute the methods described in the above aspects.

[0060] In another aspect, this application provides a computer storage medium including instructions that, when executed on a computer, cause the computer to perform the methods described in the above aspects.

[0061] Compared to existing technologies, this application proposes a modification that designs all function addresses in the SO layer as a single function address. Each SO layer function address is assigned a unique number to distinguish multiple functions within the SO layer. This unique number can be obtained through a design scheme, such as adding the Java layer function name to the SO file's release version number and timestamp, and then calculating its MD5 hash. The purpose of this is to change the function numbers of all SO layers with each SO release, thus achieving variability. Since each function's parameters and return value are different during invocation, a single function for setting them up cannot be used. Therefore, the function parameters and return values ​​are modified to achieve consistency. Attached Figure Description

[0062] Figure 1 This is a flowchart illustrating the method of function calling in Java in the embodiments of this application;

[0063] Figure 2 This is a schematic diagram of the structure of the device for function calls in Java in the embodiments of this application;

[0064] Figure 3 This is a schematic diagram of the structure of the computer device in the embodiments of this application.

[0065] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0066] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of this application. The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The division of modules appearing in this application is merely a logical division; in practical applications, there may be other division methods. For example, multiple modules may be combined into or integrated into another system, or some features may be omitted or not performed.

[0067] Please refer to Figure 1 The following provides an example of a method for function calling in Java provided by this application. The method includes:

[0068] 101. Obtain the parameters and function names of multiple objective functions from the SO file.

[0069] In this embodiment, a function refers to a piece of program or code that can be directly referenced by another piece of program or code. It is also called a subroutine.

[0070] 102. The multiple objective function parameters are encoded using protobuf to obtain multiple encoded parameters.

[0071] In this embodiment, the parameter format of all existing functions called by the Java layer in the existing SO is modified to use protobuf to encode all parameters, thus ensuring that each function has only one parameter. Simultaneously, all function return values ​​are also encoded using protobuf. Protobuf is used to encode all function parameters and return values. Regardless of the type or number of parameters, they can all be encoded into a final byte array using protobuf. This byte array can then be converted into a String, and therefore a String can contain any number of parameter data from any function. protobuf serializes and encodes all parameters into a single string. The return values ​​are also encoded using the same scheme.

[0072] 103. Obtain the version number of the So file and the timestamp corresponding to the version number of the So file.

[0073] In this embodiment, a unique number is assigned to the function address of each SO layer to distinguish multiple functions within the SO layer. The unique number can be obtained by using a design scheme, such as adding the function name from the JAVA layer to the release version number and timestamp of the SO file, and then calculating the MD5 hash of the result.

[0074] 104. Calculate multiple objective function numbers using the message digest Md5 algorithm, taking the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file.

[0075] In this embodiment, when the Java layer makes a call, the native layer function number So_Name is calculated using the algorithm described in this paper: So_Name = Sha - 128(java_function_name + version + timestamp); So_Name corresponds to the function number of a native So. Here, java_function_name corresponds to the Java layer function name: "java_encrypt" or "java_decrypt", version is the version number of the So for each release, and timestamp is the timestamp for each So release.

[0076] 105. Each encoded parameter and each target function number are used as new parameters for each target function to obtain multiple functions that have been configured.

[0077] In this embodiment, a parameter is added to the native function of So to distinguish the native function number called by the JAVA layer. The native function is the one configured in this document. The native function uses the function number to distribute the specific native function functionality.

[0078] 106. Associate each of the functions that have been set and each of the target functions to obtain a mapping relationship.

[0079] In this embodiment, a lookup strategy for the actual corresponding native function is designed.

[0080] 107. Obtain the function called by the user to get the input function.

[0081] In the specific implementation, based on the caller of the So interface, the ordinal number of the function to be called is obtained, and the corresponding function of the So layer is called through the JAVA interface, and the ordinal number is passed into the interface as a parameter.

[0082] 108. Locate and call the input function from the SO file using the Shellcode and the mapping relationship.

[0083] In this embodiment, the search code is written and called using shellcode. If the target function numbers match, the corresponding function address is retrieved. Thus, the corresponding input function is found.

[0084] Compared to existing technologies, this application proposes a modification that designs all function addresses in the SO layer as a single function address. Each function address in the SO layer is assigned a unique number to distinguish multiple functions within the SO layer. This unique number can be obtained through a design scheme, such as adding the Java layer function name to the SO file's release version number and timestamp, and then calculating its MD5 hash. The purpose of this is to change the function numbers in all SO layers with each SO release, thus achieving variability. Since each function's parameters and return value are different during invocation, a single function for setting them up cannot be used. Therefore, the function parameters and return values ​​are modified to achieve consistency.

[0085] In some implementations, the step of calculating multiple objective function numbers using the Message Digest-MD5 algorithm, taking the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file, includes:

[0086] The multiple target function numbers are calculated using the formula So_Name = Sha-128(java_function_name + version + timestamp), where java_function_name is the function name of the target function, version is the version number of the So file, timestamp is the timestamp corresponding to the version number of the So file, and So_Name is the target function number.

[0087] In the above implementation, the ID value is calculated using a message digest algorithm.

[0088] In some implementations, associating each of the completed functions with each of the target functions to obtain a mapping relationship includes:

[0089] Obtain the memory address of the function that has been set;

[0090] The multiple target function numbers and the memory addresses of the functions that have been set are stored in an array to obtain a complete mapping relationship.

[0091] In the above implementation, the string in the log is then searched to decrypt it and obtain the plaintext ID. Therefore, multiple encryption and decryption algorithms need to be stored in the SO in advance. These algorithms have been pre-written into the SO, compiled, and released with the SO.

[0092] In some implementations, the step of locating and calling the input function from the SO file using the shellcode and the mapping relationship includes:

[0093] Allocate memory space for the shellcode;

[0094] The memory address of the input function is found based on the complete mapping relationship, and the memory address of the input function is obtained.

[0095] The input function is called using the memory space and the memory address of the input function.

[0096] In the above implementation, the shellcode's implementation logic is relatively simple; its encryption and decryption both call pre-compiled functions in the SO. Furthermore, based on the shellcode, dynamic memory allocation is possible. Therefore, during the dynamic loading and initialization of the SO, a code space is allocated within the function to execute the shellcode, and then the shellcode is copied into this space for execution. Simultaneously, based on the shellcode, we can easily distribute this code via a server, where the mapping table can be adjusted, including changes to encryption and decryption algorithms. It also ensures that the dynamically allocated memory for the code's execution cannot be found in the SO, so its memory location changes dynamically each time it is executed.

[0097] In some implementations, the step of finding the memory address of the input function based on the complete mapping relationship to obtain the memory address of the input function includes:

[0098] Calculate the function number of the input function;

[0099] Match each of the target function numbers in the complete mapping relationship;

[0100] If a matching target function number exists, the address of the corresponding target function is used as the memory address of the input function.

[0101] In the above implementation, the memory addresses of all native functions were obtained by searching.

[0102] At the same time, we also obtained its corresponding encrypted ID information, xxxxxx.

[0103] The first step is to decrypt xxxxxx to obtain the plaintext ID information.

[0104] After decryption, a mapping table can be generated. An array is used to store the mapping table between native functions and their IDs.

[0105] Structnative_id { Design a structure to store each item in the mapping table.}

[0106] Void*function; First, it takes the memory address of the native function.

[0107] String id; then store the id data}.

[0108] In some implementations, after the step of calculating the multiple objective function numbers using the message digest MD5 algorithm by combining the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file, the method further includes:

[0109] Obtain a preset target encryption algorithm and a corresponding decryption algorithm;

[0110] The target function numbers are encrypted using the target encryption algorithm to obtain the encrypted target function numbers;

[0111] The encrypted target function number is stored in the log code;

[0112] Accordingly, before the step of storing the multiple target function numbers and the memory addresses of the completed functions into an array to obtain the complete mapping relationship, the method further includes:

[0113] The encrypted target function number stored in the log code is decrypted using the decryption algorithm corresponding to the target encryption algorithm, thus obtaining the decrypted target function number.

[0114] In the above implementation, the value of "xxx" in the log is used to print a string, which corresponds to the unique ID data we calculated earlier. For security reasons, this string needs to be encrypted before printing; otherwise, directly writing it as a unique ID would expose its meaning. Therefore, encryption methods can be used. The ID corresponds to the result of the previous algorithm. For example: Id = Sha-128(java_encrypt+1.0.0+1598148812). The native_encrypt function then prints this ID. Finally, by encrypting the pre-calculated ID, the log("xxxxxx") is printed.

[0115] In some implementations, after calculating multiple objective function numbers using the message digest MD5 algorithm based on the function names of the multiple objective functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file, the method further includes:

[0116] If the target function number is 0, then obtain the corresponding function name, the corresponding timestamp, and the corresponding version number.

[0117] In the above implementation, we must first implement the specific functional code for each `native_encrypt` and `native_decrypt` function. Simultaneously, a string printing function needs to be added before the header of each specific function: `If(id == 0)log("xxxxxx");`. The printing statement must check `id`, comparing it to 0, etc., before printing. The purpose of this is that the `log` statement here will not be executed, because `id` can never be 0. This `id` is the unique code for each function we designed earlier; it is calculated as a SHA-128 hash, so it cannot be 0. This design is to avoid disrupting the original function content, so the added logic here must be non-executable. Furthermore, it must be based on parameter checks to prevent it from being optimized away by the compiler. The parameter check for `id` is dynamic; the value of `id` is unknown, so the compiler cannot optimize it.

[0118] like Figure 2 The diagram shows a structural schematic of a Java function call apparatus 20, which can be applied to function calls in Java. The Java function call apparatus in this embodiment can implement the functionality described above. Figure 1 The corresponding embodiments describe the steps of a Java function call method. The functionality implemented by the Java function call device 20 can be achieved through hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions; these modules can be software and / or hardware. The Java function call device may include an input / output module 201 and a processing module 202. The functional implementation of the processing module 202 and the input / output module 201 can be found in [reference needed]. Figure 1 The operations performed in the corresponding embodiments will not be described in detail here. The input / output module 201 can be used to control the input, output, and acquisition operations of the input / output module 201.

[0119] In some implementations, the input / output module 201 can be used to obtain the parameters of multiple objective functions in the So file and the function names of the multiple objective functions.

[0120] The processing module 202 can be used to encode the multiple target function parameters using protobuf to obtain multiple encoded parameters; obtain the version number of the SO file and the timestamp corresponding to the version number of the SO file; calculate multiple target function numbers using the message digest MD5 algorithm based on the function names of the multiple target functions, the version number of the SO file, and the timestamp corresponding to the version number of the SO file; use each encoded parameter and each target function number as a new parameter for each target function to obtain multiple completed functions; associate each completed function with each target function to obtain a mapping relationship; obtain the function called by the user to obtain the input function; and search for and call the input function from the SO file using Shellcode and the mapping relationship.

[0121] In some embodiments, the processing module 202 is further configured to:

[0122] The multiple target function numbers are calculated using the formula So_Name = Sha-128(java_function_name + version + timestamp), where java_function_name is the function name of the target function, version is the version number of the So file, timestamp is the timestamp corresponding to the version number of the So file, and So_Name is the target function number.

[0123] In some embodiments, the processing module 202 is further configured to:

[0124] Obtain the memory address of the function that has been set;

[0125] The multiple target function numbers and the memory addresses of the functions that have been set are stored in an array to obtain a complete mapping relationship.

[0126] In some embodiments, the processing module 202 is further configured to:

[0127] Allocate memory space for the shellcode;

[0128] The memory address of the input function is found based on the complete mapping relationship, and the memory address of the input function is obtained.

[0129] The input function is called using the memory space and the memory address of the input function.

[0130] In some embodiments, the processing module 202 is further configured to:

[0131] Calculate the function number of the input function;

[0132] Match each of the target function numbers in the complete mapping relationship;

[0133] If a matching target function number exists, the address of the corresponding target function is used as the memory address of the input function.

[0134] In some embodiments, the processing module 202 is further configured to:

[0135] Obtain a preset target encryption algorithm and a corresponding decryption algorithm;

[0136] The target function numbers are encrypted using the target encryption algorithm to obtain the encrypted target function numbers;

[0137] The encrypted target function number is stored in the log code;

[0138] Accordingly, before the step of storing the multiple target function numbers and the memory addresses of the completed functions into an array to obtain the complete mapping relationship, the method further includes:

[0139] The encrypted target function number stored in the log code is decrypted using the decryption algorithm corresponding to the target encryption algorithm, thus obtaining the decrypted target function number.

[0140] In some embodiments, the processing module 202 is further configured to:

[0141] If the target function number is 0, then obtain the corresponding function name, the corresponding timestamp, and the corresponding version number.

[0142] The above describes the creation apparatus in the embodiments of this application from the perspective of modular functional entities. The following describes a computer device from a hardware perspective, such as... Figure 3 As shown, it includes: a processor, memory, and an input / output unit (which can also be a transceiver). Figure 3 (Not identified in the text) and a computer program stored in the memory and executable on the processor. For example, the computer program could be... Figure 1 The corresponding example is the program corresponding to the function call method in Java. For example, when a computer device implements such... Figure 2 When the function call device 20 shown in Java performs its function, the processor executes the computer program to implement the above-mentioned... Figure 2 The corresponding embodiment refers to the steps in the Java function call method executed by the Java function call device 20. Alternatively, the processor implements the above when executing the computer program. Figure 2The corresponding embodiment describes the functions of each module in the Java function call apparatus 20. For example, the computer program can be... Figure 1 The corresponding program in the Java function call method in the example is shown.

[0143] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting various parts of the computer device via various interfaces and lines.

[0144] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, video data, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, Flash Card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0145] The input / output unit can also be replaced by a receiver and a transmitter, which can be the same or different physical entities. When they are the same physical entities, they can be collectively referred to as input / output units. This input / output can be a transceiver.

[0146] The memory can be integrated into the processor or it can be set up separately from the processor.

[0147] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0148] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many forms under the guidance of this application without departing from the spirit and scope of protection of the claims. All equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are within the protection scope of this application.

Claims

1. A method of function call under Java, characterized by, The method comprises: Obtaining parameters of a plurality of target functions of an So file and function names of the plurality of target functions; Encoding the plurality of target function parameters through protobuf to obtain a plurality of encoded parameters; Obtaining a version number of the So file and a timestamp corresponding to the version number of the So file; Calculating a plurality of target function numbers through a message digest algorithm Md5 from the function names of the plurality of target functions, the version number of the So file and the timestamp corresponding to the version number of the So file; Taking each of the encoded parameters and each of the target function numbers as new parameters of each of the target functions to obtain a plurality of completed setting functions; Associating each of the completed setting functions with each of the target functions to obtain a mapping relationship; Obtaining a function called by a user to obtain an input function; Searching for and calling the input function from the So file through a Shellcode and the mapping relationship; The associating each of the completed setting functions with each of the target functions to obtain a mapping relationship comprises: obtaining a memory address of the completed setting function; storing the plurality of target function numbers and the memory address of the completed setting function into an array to obtain a complete mapping relationship; The searching for and calling the input function from the So file through a Shellcode and the mapping relationship comprises: allocating a memory space for the Shellcode; finding a memory address of the input function according to the complete mapping relationship to obtain the memory address of the input function; and calling the input function through the memory space and the memory address of the input function; The finding a memory address of the input function according to the complete mapping relationship to obtain the memory address of the input function comprises: calculating a function number of the input function; matching each of the target function numbers in the complete mapping relationship; and if there is a matching target function number, taking a corresponding target function address as the memory address of the input function.

2. The method of claim 1, wherein, The calculating a plurality of target function numbers through a message digest algorithm Md5 from the function names of the plurality of target functions, the version number of the So file and the timestamp corresponding to the version number of the So file comprises: Calculating the plurality of target function numbers through So_Name = Sha-128(java_function_name + version + timestamp), wherein java_function_name is the function name of the target function, version is the version number of the So file, timestamp is the timestamp corresponding to the version number of the So file, and So_Name is the target function number.

3. The method of claim 2, wherein, The method further comprises the following steps after the calculating a plurality of target function numbers through a message digest algorithm Md5 from the function names of the plurality of target functions, the version number of the So file and the timestamp corresponding to the version number of the So file: Obtaining a preset target encryption algorithm and a decryption algorithm corresponding to the target encryption algorithm; Encrypting the target function numbers respectively through the target encryption algorithm to obtain encrypted target function numbers; Storing the encrypted target function numbers into log codes; Correspondingly, before the step of storing the plurality of target function numbers and the function memory addresses of the completed setting into an array to obtain a complete mapping relationship, the method further includes: Decrypting the encrypted target function numbers stored into the log codes through the decryption algorithm corresponding to the target encryption algorithm to obtain decrypted target function numbers.

4. The method of claim 3, wherein, After the plurality of target function numbers are calculated through the message digest algorithm Md5 algorithm, the method further includes: If the target function number is 0, obtaining a corresponding function name, a corresponding timestamp and a corresponding version number.

5. A computer device, comprising: The computer device includes: At least one processor, a memory and an input and output unit; The memory is configured to store program codes, and the processor is configured to call the program codes stored in the memory to execute the method according to any one of claims 1-4.

6. A computer storage medium, characterized in that, The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The computer device includes: The

Citation Information

Patent Citations

  • Method for publishing resources, updating method and device

    CN108710500A

  • Function processing method and device and related equipment

    CN108845843A