CN112596739A - Data processing method and device - Google Patents
Data processing method and device Download PDFInfo
- Publication number
- CN112596739A CN112596739A CN202011497993.XA CN202011497993A CN112596739A CN 112596739 A CN112596739 A CN 112596739A CN 202011497993 A CN202011497993 A CN 202011497993A CN 112596739 A CN112596739 A CN 112596739A
- Authority
- CN
- China
- Prior art keywords
- function
- address
- symbol
- acquiring
- instruction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/53—Decompilation; Disassembly
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The embodiment of the invention provides a data processing method and a device, by acquiring a project file of an application program and a function list corresponding to the project file, if an OC function exists in the function list, acquiring a symbol table matched with the project file, wherein the symbol table comprises an original symbol corresponding to the OC function, disassembling the symbol table to obtain an assembly instruction corresponding to the original symbol, then selecting a target symbol aiming at the OC function from the symbol table according to the assembly instruction corresponding to the original symbol, acquiring address information of the target symbol, then generating a class name table aiming at the project file according to the address information of the target symbol, disassembling the content in the symbol table to effectively improve the efficiency of function positioning, ensure the comprehensiveness of function search, acquiring the target symbol through disassembling, and searching a class name corresponding to the OC function through the address information of the target symbol, the full search of the project files is realized, and the comprehensiveness and accuracy of the search results are ensured.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data processing method and a data processing apparatus.
Background
The Xcode is an integrated development environment provided by apple Inc. for developers, can be used for developing application programs of macOS, iOS, Watch OS and tvOS, and is a user operation interface with unified user interface design, coding, testing and debugging. In the project development process of the application program, when a developer wants to search a related function in a project, the developer can only search through an Xcode search box, however, in the search process, the project cannot be searched in a full amount, the search coverage is not comprehensive enough, and missed detection is easy to occur.
Disclosure of Invention
The embodiment of the invention provides a data processing method and device, electronic equipment and a computer readable storage medium, and aims to solve or partially solve the problems that in the process of searching a related function of a project file, full search cannot be performed, search coverage is not comprehensive enough, and missing detection is easy to occur.
The embodiment of the invention discloses a data processing method, which comprises the following steps:
acquiring a project file of an application program and a function list corresponding to the project file;
if an OC function exists in the function list, a symbol table matched with the project file is obtained, and the symbol table comprises an original symbol corresponding to the OC function;
disassembling the symbol table to obtain an assembly instruction corresponding to the original symbol;
selecting a target symbol aiming at the OC function from the symbol table according to an assembly instruction corresponding to the original symbol, and acquiring address information of the target symbol;
and generating a class name table aiming at the project file according to the address information of the target symbol.
Optionally, the address information includes a start address and a compile address, and the selecting, according to an assembly instruction corresponding to the original symbol, a target symbol for the OC function from the symbol table and obtaining address information of the target symbol includes:
respectively acquiring a first initial address and a first compiling address of each original symbol;
acquiring an assembly instruction corresponding to the original symbol by adopting the first initial address and the first compiling address;
acquiring a function address of the OC function by adopting the assembly instruction;
and taking the original symbol corresponding to the OC function with the function address in the symbol table as a target symbol, and acquiring a second initial address and a second compiling address of the target symbol.
Optionally, the assembly instruction at least includes a high order address and a low order address, and the obtaining, by using the assembly instruction, the function address of the OC function includes:
acquiring an instruction interval aiming at the assembly instruction;
and if the bit number difference between the high-order address and the low-order address of the assembler instruction falls into the instruction interval, generating the function address of the OC function by adopting the high-order address and the low-order address of the assembler instruction.
Optionally, the obtaining, by using the assembler instruction, a function address of the OC function further includes:
and if the bit difference between the high-order address and the low-order address of the assembly instruction is outside the instruction interval, judging that the function address does not exist in the OC function corresponding to the original symbol.
Optionally, the selecting, by the function address of the OC function, a target symbol for the OC function from the symbol table, and obtaining a second start address and a second compile address of the target symbol includes:
and taking the original symbol with the function address as a target symbol, and acquiring a second starting address and a second compiling address of the target symbol.
Optionally, the project file includes a character string table, and the generating a category name table for the project file according to the address information of the target symbol includes:
acquiring a class name corresponding to the OC function from the character string table through a second starting address and a second compiling address of the target symbol;
and outputting a class name table aiming at the project file by adopting the class name corresponding to each OC function.
Optionally, the method further comprises:
acquiring a Hook function aiming at the class file;
and in the process of compiling the project file, acquiring dynamic library data corresponding to the class file through the Hook function.
The embodiment of the invention also discloses a data processing device, which comprises:
the file information acquisition module is used for acquiring project files of an application program and function lists corresponding to the project files;
a symbol table obtaining module, configured to obtain a symbol table matched with the item file if an OC function exists in the function list, where the symbol table includes an original symbol corresponding to the OC function;
the disassembling module is used for disassembling the symbol table to obtain an assembling instruction corresponding to the original symbol;
an address information obtaining module, configured to select a target symbol for the OC function from the symbol table according to an assembly instruction corresponding to the original symbol, and obtain address information of the target symbol;
and the class name table generating module is used for generating a class name table aiming at the project file according to the address information of the target symbol.
Optionally, the address information includes a start address and a compiling address, and the address information obtaining module includes:
a first address information obtaining submodule, configured to obtain a first start address and a first compiling address of each original symbol, respectively;
the assembly instruction obtaining submodule is used for obtaining an assembly instruction corresponding to the original symbol by adopting the first starting address and the first compiling address;
a function address obtaining submodule, configured to obtain a function address of the OC function by using the assembly instruction;
and the second address information acquisition submodule is used for taking an original symbol corresponding to the OC function with the function address in the symbol table as a target symbol and acquiring a second starting address and a second compiling address of the target symbol.
Optionally, the assembler instruction at least includes a high-order address and a low-order address, and the function address obtaining submodule is specifically configured to:
acquiring an instruction interval aiming at the assembly instruction;
and if the bit number difference between the high-order address and the low-order address of the assembler instruction falls into the instruction interval, generating the function address of the OC function by adopting the high-order address and the low-order address of the assembler instruction.
Optionally, the function address obtaining sub-module is further specifically configured to:
and if the bit difference between the high-order address and the low-order address of the assembly instruction is outside the instruction interval, judging that the function address does not exist in the OC function corresponding to the original symbol.
Optionally, the second address information obtaining sub-module is specifically configured to:
and taking the original symbol with the function address as a target symbol, and acquiring a second starting address and a second compiling address of the target symbol.
Optionally, the project file includes a character string table, and the class name table generating module includes:
the class name acquisition submodule is used for acquiring a class name corresponding to the OC function from the character string table through a second initial address and a second compiling address of the target symbol;
and the class name table generating submodule is used for outputting a class name table aiming at the project file by adopting the class names corresponding to the OC functions.
Optionally, the method further comprises:
a Hook function acquisition module, configured to acquire a Hook function for the class file;
and the dynamic library data acquisition module is used for acquiring the dynamic library data corresponding to the class file through the Hook function in the process of compiling the project file.
The embodiment of the invention also discloses an electronic device, which comprises:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform the method as described above.
Embodiments of the present invention also disclose a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method as described above.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, by acquiring the project file of the application program and the function list corresponding to the project file, if an OC function exists in the function list, acquiring a symbol table matched with the project file, wherein the symbol table comprises an original symbol corresponding to the OC function, disassembling the symbol table to obtain an assembly instruction corresponding to the original symbol, then selecting a target symbol aiming at the OC function from the symbol table according to the assembly instruction corresponding to the original symbol, acquiring the address information of the target symbol, then generating a class name table aiming at the project file according to the address information of the target symbol, disassembling the content in the symbol table to effectively improve the efficiency of function positioning, ensure the comprehensiveness of function search, obtain the target symbol by disassembling, and search the class name corresponding to the OC function by the address information of the target symbol, the full search of the project files is realized, and the comprehensiveness and accuracy of the search results are ensured.
Drawings
Fig. 1 is a flowchart illustrating steps of a data processing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another data processing method provided by the embodiment of the invention;
fig. 3 is a block diagram of a data processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Mach-O is a file Format that is the Format of Executable files on the macOS operating system, similar to the PE Format on windows (Portable Executable), the elf Format on linux (Executable and Linking Format). C, C + +, swift and OC written by a project developer can be finally compiled and linked to generate a Mach-O executable file.
Assembly Language (Assembly Language) is a low-level Language used in electronic computers, microprocessors, microcontrollers or other programmable devices, also known as a symbolic Language. In assembly language, the operation code of a machine instruction is replaced by a mnemonic and the address of the instruction or operand is replaced by an address symbol or label. In different devices, the assembly language corresponds to different machine language instruction sets and is converted into machine instructions through an assembly process. The specific assembly language and the specific machine language instruction set are in one-to-one correspondence, and the direct migration between different platforms is not available.
Xcode is an integrated development tool (IDE) running on the operating system Mac OS X, developed by AppleInc. Xcode is the fastest way to develop macOS and iOS applications. The Xcode has a uniform user interface design, and the encoding, the testing and the debugging are completed in a simple window.
The Hook technology is also called Hook function, before the system calls the relevant function, the information corresponding to the function can be captured through the Hook function, the Hook function obtains the control right first, and at the moment, the Hook function can process (change) the execution behavior of the function and can also forcibly end the transfer of the information.
The OC function can be an Objective-C function which can be used as an editing language of an iOS operating system, an iOS application program, an iPad OS operating system, an iPad OS application program, a Mac OS X operating system, an application program on the Mac OSX and the like, and the function integrity, the function and the like of the project file can be effectively detected by detecting the class name of the OC function in the project file, so that the stability of the project file is ensured.
As an example, when a developer wants to search the positions of all target OC function calls in a project engineering file, the search for the target OC function is mainly implemented by the name of a search box input function provided by Xcode; or replacing the OC function by adding a Hook function, and then acquiring the stack information of the target OC function so as to obtain the related content of the OC function. However, in the search process of the OC function, the Xcode search box cannot achieve full coverage of the project engineering file, for example, the m file in the library is not exposed to the outside, and the OC function in the file cannot be searched; moreover, for the Hook function, the comparison depends on the operation, and if the search process is not operated to the search stage, the missing detection is easy to occur.
Therefore, one of the core invention points of the embodiment of the present invention is that the content of the symbol table in the Mach-O file is disassembled, the target symbol with the function address is found in an address matching manner, the content in the character string table is calculated according to the address information of the target symbol, the class name corresponding to the OC function is obtained, and the calling class of the target OC function is obtained, so that the efficiency of function positioning is effectively improved by disassembling the content in the symbol table, the comprehensiveness of function search is ensured, the class name corresponding to the OC function is obtained according to the address information of the target symbol, the comprehensiveness and the accuracy of the search result are ensured, and the full search of the project file is realized.
Referring to fig. 1, a flowchart illustrating steps of a data processing method according to an embodiment of the present invention is shown, which may specifically include the following steps:
in the embodiment of the invention, the project file can be an executable file generated after a developer develops the application program at a terminal of the macOS operating system, namely a Mach-O file. For the Mach-O file, the method provides stronger expansibility and improves the access speed of information in the symbol table, and when a developer wants to search a target OC function in the Mach-O file, the developer can judge whether the function list contains the OC function by acquiring the function list corresponding to the Mach-O file.
In the Mach-O file, all the called OC functions can exist in the function list selrefs, and then whether the function names of the OC functions exist in the list or not can be detected by acquiring the function list selrefs and traversing the list. Alternatively, function names of all functions in the item file may be recorded in the function list, for example, function names of OC functions are recorded.
102, if an OC function exists in the function list, obtaining a symbol table matched with the project file, wherein the symbol table comprises an original symbol corresponding to the OC function;
in a specific implementation, different naming modes may be adopted for different types of functions, for example, naming of an OC function, a C + + function, and the like may be different, and then, by traversing all function names in the function list, whether an OC function exists in the function list is searched for, for example, the function name of the OC function may include a function name + a parameter name, and the C + + function only includes a function name, and then, according to the different naming modes, the function list may be quickly traversed to determine whether an OC function exists.
When the function name of the OC function exists in the function list, a symbol table matched with the item file can be obtained, so that the function address of the OC function can be searched through the symbol table, and the class name corresponding to the OC function can be further obtained. A symbol table may be a data structure used in language translators (e.g., compilers and interpreters) in which each identifier in the program source code is bound to its declaration or usage information, such as its data type, scope, and memory address.
In addition, the original symbols corresponding to the OC function and the assembler instruction of the original symbols may be included in the symbol table, and may further include the symbol name, type, storage category, scope, visibility of the original symbols, storage allocation information of symbol variables, and other attributes of the symbols, and the like.
103, disassembling the symbol table to obtain an assembly instruction corresponding to the original symbol;
in the specific implementation, the content of the symbol table is a code written in a machine language, and the content in the symbol table is converted from the machine language to an assembly language code by disassembling the symbol table, so that a target symbol table is obtained.
104, selecting a target symbol aiming at the OC function from the symbol table according to an assembly instruction corresponding to the original symbol, and acquiring address information of the target symbol;
in the embodiment of the present invention, the assembler instruction corresponding to each original symbol may be obtained by traversing the symbol table after disassembly, and the target symbol for the OC function is selected from the symbol table according to the assembler instruction corresponding to the original symbol, and then the address information of the target symbol is obtained, so that the class name corresponding to the OC function is obtained through the address information of the target symbol. Optionally, the symbol table before assembly is used as the first symbol table, and the symbol table after assembly is used as the second symbol table, which is not limited by the present invention.
In a specific implementation, in the first symbol table, each original symbol may correspond to a start address and a compilation address, wherein, the start address can be the start position of the symbol in the first symbol table, the symbol can be positioned by the start position, the compiling address can be the memory address of the symbol after compiling, the data content corresponding to the symbol can be obtained by the memory address, so that the first start address and the first compile address of each original symbol can be obtained separately, then, the first start address corresponding to each original symbol is used for positioning and data acquisition is carried out through the first compiling address, corresponding assembling instructions are searched from the second symbol table after compiling, for example, the start address A and the compiling address A1 of the original symbol (r), then the assembly instruction I corresponding to the original symbol (r) can be found in the second symbol table through the initial address A and the compiling address A1; the initial address B and the compiling address B1 of the original symbol (c) can search the assembling instruction ii and the like corresponding to the original symbol (c) in the second symbol table through the initial address B and the compiling address B1.
After the assembly instruction corresponding to the original symbol is obtained, searching a function address corresponding to the OC function through the assembly instruction, wherein for the original symbol, the corresponding OC function does not necessarily have the corresponding function address in the symbol table, if the OC function does not have the corresponding function address in the symbol table, judging that the OC function corresponding to the original symbol does not have the function address in the second symbol table, and filtering the original symbol; if the OC function has a corresponding function address in the symbol table, the original symbol corresponding to the OC function having the function address in the symbol table is used as a target symbol, and a second initial address and a second compiling address of the target symbol in the first symbol table are obtained, so that the target symbol having the function address is found in an address matching manner, so that the class name corresponding to the OC function is obtained through the address information of the target symbol, and the comprehensiveness and accuracy of a function searching result are ensured.
Specifically, the assembler instruction of the original symbol may include a high address and a low address of the OC function, where the low address and the high address are respectively used for a write start point and a write end point of the OC function, for example, the function address of the OC function is 0x3f08c06, which may be represented as 0x3f8000 and 0xc60 in the assembler instruction, and the function address of the OC function may be generated by reading the high address and the low address of the OC function recorded in the assembler instruction.
Optionally, because different assembler instructions have the same high-order address or low-order address, in the process of generating the function address of the OC function, an instruction interval for the assembler instruction may be obtained, and if a bit number difference between the high-order address and the low-order address of the assembler instruction falls into the instruction interval, the high-order address and the low-order address of the assembler instruction are adopted to generate the function address of the OC function; if the address bit number difference between the high-order address and the low-order address of the assembler instruction falls outside the instruction interval, the function address corresponding to the assembler instruction does not exist, the function address corresponding to the OC function does not exist, the function address corresponding to the original symbol does not exist, the OC function corresponding to the original symbol can be judged, the address bit number difference is detected through the instruction interval, errors can be effectively filtered, the accuracy of function detection is improved, the content in the symbol table is disassembled, the target symbol corresponding to the OC function is selected, and the efficiency of function positioning is effectively improved
After the target symbol with the function address of the OC function is obtained by screening the original symbol, a second start address and a second compiling address of the target symbol can be obtained so as to obtain the class name corresponding to the OC function.
And 105, generating a class name table aiming at the project file according to the address information of the target symbol.
In the embodiment of the present invention, the class name corresponding to the OC function may be obtained by an address calculation, and specifically, the class name corresponding to the OC function may be searched from the character string table corresponding to the project file by using the second start address and the second compiled address in the target symbol, so that the class name corresponding to the OC function is obtained by using the address information of the target symbol, thereby implementing a full search of the project file and ensuring the completeness and accuracy of the search result.
In an example, in the process of developing an application program, there may be a plurality of character string tables, one for each language or each condition, which may include lists of IDs, values, and titles of all character strings in the application program, and after obtaining a start address and a compiling address of a target symbol, positioning may be performed in the character string tables through the start address, and a corresponding class name may be obtained through the compiling address, so that a class name corresponding to the target symbol is found in an address matching manner, and a name of a calling class corresponding to the target OC function is obtained.
After the class name corresponding to the OC function is obtained, all the searched class names can be saved as a class name table for the project file, and the class name table contains the class name of the calling class corresponding to the OC function having the function address, the OC function, the symbol, the assembly instruction corresponding to the symbol and the like, so that a developer can detect the calling of the function through the file and judge whether the calling of the function has a problem.
In an optional embodiment of the invention, because the Mach-O file is a binary file, but the dynamic library is linked during the running and does not appear in the Mach-O file, the Hook function for the class file can be obtained, and the dynamic library data corresponding to the class file can be obtained through the Hook function in the process of compiling the project file, so that the dynamic library data can be obtained in the way of the Hook function, the pertinence of data acquisition is improved, especially, a developer can add the Hook function to the OC function needing to obtain the dynamic library data according to actual requirements to obtain the dynamic library data during the running, omission in data acquisition is avoided, and the comprehensiveness of data acquisition is ensured.
It should be noted that the embodiments of the present invention include, but are not limited to, the above examples, and it is understood that, under the guidance of the idea of the present invention, those skilled in the art may also set the embodiments according to actual needs, and the present invention is not limited to these.
In the embodiment of the invention, by acquiring the project file of the application program and the function list corresponding to the project file, if an OC function exists in the function list, acquiring a symbol table matched with the project file, wherein the symbol table comprises an original symbol corresponding to the OC function, disassembling the symbol table to obtain an assembly instruction corresponding to the original symbol, then selecting a target symbol aiming at the OC function from the symbol table according to the assembly instruction corresponding to the original symbol, acquiring the address information of the target symbol, then generating a class name table aiming at the project file according to the address information of the target symbol, disassembling the content in the symbol table to effectively improve the efficiency of function positioning, ensure the comprehensiveness of function search, obtain the target symbol by disassembling, and search the class name corresponding to the OC function by the address information of the target symbol, the full search of the project files is realized, and the comprehensiveness and accuracy of the search results are ensured.
In order to make those skilled in the art better understand the technical solutions of the embodiments of the present invention, the following description is made by way of an example.
Referring to fig. 2, a flowchart of another data processing method provided in the embodiment of the present invention is shown, where original symbols such as symbol 1, symbol 2, symbol 3, and the like are obtained by traversing a symbol table corresponding to a project file, the symbol table is disassembled by a disassembling instruction to obtain a symbol table after disassembling, an assembling instruction corresponding to each original symbol, such as a symbol 1 instruction, a symbol 2 instruction, a symbol 3 instruction, and the like, is obtained from the table, then a function address corresponding to an OC function is determined by using a high-order address and a low-order address recorded by each assembling instruction, an original symbol corresponding to an OC function having the function address is used as a target symbol n, a start address and a compiling address of each target symbol are obtained, then a class name corresponding to the OC function is obtained from a string table corresponding to the project file, and all class names and corresponding contents are stored as a class name table, by disassembling the content in the symbol table, the efficiency of function positioning is effectively improved, the comprehensiveness of function searching is ensured, the target symbol is obtained through disassembling, the class name corresponding to the OC function is searched through the address information of the target symbol, the comprehensiveness of the item file is realized, and the comprehensiveness and the accuracy of the searching result are ensured.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 3, a block diagram of a data processing apparatus according to an embodiment of the present invention is shown, which may specifically include the following modules:
a file information obtaining module 301, configured to obtain a project file of an application program and a function list corresponding to the project file;
a symbol table obtaining module 302, configured to obtain a symbol table matched with the item file if an OC function exists in the function list, where the symbol table includes an original symbol corresponding to the OC function;
a disassembling module 303, configured to disassemble the symbol table to obtain an assembling instruction corresponding to the original symbol;
an address information obtaining module 304, configured to select a target symbol for the OC function from the symbol table according to an assembly instruction corresponding to the original symbol, and obtain address information of the target symbol;
a class name table generating module 305, configured to generate a class name table for the project file according to the address information of the target symbol.
In an optional embodiment of the present invention, the address information includes a start address and a compiling address, and the address information obtaining module 304 includes:
a first address information obtaining submodule, configured to obtain a first start address and a first compiling address of each original symbol, respectively;
the assembly instruction obtaining submodule is used for obtaining an assembly instruction corresponding to the original symbol by adopting the first starting address and the first compiling address;
a function address obtaining submodule, configured to obtain a function address of the OC function by using the assembly instruction;
and the second address information acquisition submodule is used for taking an original symbol corresponding to the OC function with the function address in the symbol table as a target symbol and acquiring a second starting address and a second compiling address of the target symbol.
In an optional embodiment of the present invention, the assembler instruction at least includes a high address and a low address, and the function address obtaining submodule is specifically configured to:
acquiring an instruction interval aiming at the assembly instruction;
and if the bit number difference between the high-order address and the low-order address of the assembler instruction falls into the instruction interval, generating the function address of the OC function by adopting the high-order address and the low-order address of the assembler instruction.
In an optional embodiment of the present invention, the function address obtaining sub-module is further specifically configured to:
and if the bit difference between the high-order address and the low-order address of the assembly instruction is outside the instruction interval, judging that the function address does not exist in the OC function corresponding to the original symbol.
In an optional embodiment of the present invention, the second address information obtaining sub-module is specifically configured to:
and taking the original symbol with the function address as a target symbol, and acquiring a second starting address and a second compiling address of the target symbol.
In an optional embodiment of the present invention, the project file includes a character string table, and the class name table generating module 305 includes:
the class name acquisition submodule is used for acquiring a class name corresponding to the OC function from the character string table through a second initial address and a second compiling address of the target symbol;
and the class name table generating submodule is used for outputting a class name table aiming at the project file by adopting the class names corresponding to the OC functions.
In an optional embodiment of the present invention, further comprising:
a Hook function acquisition module, configured to acquire a Hook function for the class file;
and the dynamic library data acquisition module is used for acquiring the dynamic library data corresponding to the class file through the Hook function in the process of compiling the project file.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
An embodiment of the present invention further provides an electronic device, including:
one or more processors; and
one or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform methods as described in embodiments of the invention.
Embodiments of the present invention also provide a computer-readable storage medium having stored thereon instructions, which, when executed by one or more processors, cause the processors to perform a method according to embodiments of the present invention.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The foregoing describes in detail a data processing method and a data processing apparatus provided by the present invention, and specific examples are applied herein to explain the principles and embodiments of the present invention, and the descriptions of the foregoing examples are only used to help understand the method and the core ideas of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A method for processing data, comprising:
acquiring a project file of an application program and a function list corresponding to the project file;
if an OC function exists in the function list, a symbol table matched with the project file is obtained, and the symbol table comprises an original symbol corresponding to the OC function;
disassembling the symbol table to obtain an assembly instruction corresponding to the original symbol;
selecting a target symbol aiming at the OC function from the symbol table according to an assembly instruction corresponding to the original symbol, and acquiring address information of the target symbol;
and generating a class name table aiming at the project file according to the address information of the target symbol.
2. The method according to claim 1, wherein the address information includes a start address and a compile address, and the selecting a target symbol for the OC function from the symbol table according to a compile instruction corresponding to the original symbol and obtaining the address information of the target symbol includes:
respectively acquiring a first initial address and a first compiling address of each original symbol;
acquiring an assembly instruction corresponding to the original symbol by adopting the first initial address and the first compiling address;
acquiring a function address of the OC function by adopting the assembly instruction;
and taking the original symbol corresponding to the OC function with the function address in the symbol table as a target symbol, and acquiring a second initial address and a second compiling address of the target symbol.
3. The method of claim 2, wherein said assembler instruction includes at least a high order address and a low order address, and wherein said obtaining a function address of said OC function using said assembler instruction comprises:
acquiring an instruction interval aiming at the assembly instruction;
and if the bit number difference between the high-order address and the low-order address of the assembler instruction falls into the instruction interval, generating the function address of the OC function by adopting the high-order address and the low-order address of the assembler instruction.
4. The method of claim 3, wherein said obtaining a function address of said OC function using said assembler instruction further comprises:
and if the bit difference between the high-order address and the low-order address of the assembly instruction is outside the instruction interval, judging that the function address does not exist in the OC function corresponding to the original symbol.
5. The method according to claim 2, 3 or 4, wherein the selecting a target symbol for the OC function from the symbol table by the function address of the OC function, and obtaining a second start address and a second compile address of the target symbol comprises:
and taking the original symbol with the function address as a target symbol, and acquiring a second starting address and a second compiling address of the target symbol.
6. The method of claim 5, wherein the project file comprises a character string table, and wherein generating a class name table for the project file according to the address information of the target symbol comprises:
acquiring a class name corresponding to the OC function from the character string table through a second starting address and a second compiling address of the target symbol;
and outputting a class name table aiming at the project file by adopting the class name corresponding to each OC function.
7. The method of claim 1, further comprising:
acquiring a Hook function aiming at the class file;
and in the process of compiling the project file, acquiring dynamic library data corresponding to the class file through the Hook function.
8. An apparatus for processing data, comprising:
the file information acquisition module is used for acquiring project files of an application program and function lists corresponding to the project files;
a symbol table obtaining module, configured to obtain a symbol table matched with the item file if an OC function exists in the function list, where the symbol table includes an original symbol corresponding to the OC function;
the disassembling module is used for disassembling the symbol table to obtain an assembling instruction corresponding to the original symbol;
an address information obtaining module, configured to select a target symbol for the OC function from the symbol table according to an assembly instruction corresponding to the original symbol, and obtain address information of the target symbol;
and the class name table generating module is used for generating a class name table aiming at the project file according to the address information of the target symbol.
9. An electronic device, comprising:
one or more processors; and
one or more machine-readable media having instructions stored thereon that, when executed by the one or more processors, cause the electronic device to perform the method of any of claims 1-7.
10. A computer-readable storage medium having stored thereon instructions, which when executed by one or more processors, cause the processors to perform the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011497993.XA CN112596739B (en) | 2020-12-17 | 2020-12-17 | Data processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011497993.XA CN112596739B (en) | 2020-12-17 | 2020-12-17 | Data processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112596739A true CN112596739A (en) | 2021-04-02 |
CN112596739B CN112596739B (en) | 2022-03-04 |
Family
ID=75199192
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011497993.XA Active CN112596739B (en) | 2020-12-17 | 2020-12-17 | Data processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112596739B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113190235A (en) * | 2021-05-27 | 2021-07-30 | 武汉斗鱼鱼乐网络科技有限公司 | Code analysis method and device, electronic terminal and storage medium |
CN113946346A (en) * | 2021-09-30 | 2022-01-18 | 北京五八信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
CN113946347A (en) * | 2021-09-29 | 2022-01-18 | 北京五八信息技术有限公司 | Function call detection method and device, electronic equipment and readable medium |
CN114020693A (en) * | 2021-10-19 | 2022-02-08 | 北京五八信息技术有限公司 | Header file address acquisition method and device, electronic equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030065976A1 (en) * | 2001-10-01 | 2003-04-03 | Bennett David L. | Logic analyzer having a disassembler employing symbol table information for identifying op-codes |
CN108132790A (en) * | 2017-12-22 | 2018-06-08 | 广州酷狗计算机科技有限公司 | Detect the method, apparatus and computer storage media of dead code |
CN109918083A (en) * | 2019-03-07 | 2019-06-21 | 北京智游网安科技有限公司 | A kind of security processing based on application programming, intelligent terminal and storage medium |
CN110532774A (en) * | 2019-07-24 | 2019-12-03 | 阿里巴巴集团控股有限公司 | Hook inspection method, device, server and readable storage medium storing program for executing |
CN110879709A (en) * | 2019-11-29 | 2020-03-13 | 五八有限公司 | Detection method and device of useless codes, terminal equipment and storage medium |
US20200278875A1 (en) * | 2017-11-20 | 2020-09-03 | Huawei Technologies Co., Ltd. | Dynamic loading method, and target file creation method and apparatus |
CN111881455A (en) * | 2020-07-27 | 2020-11-03 | 绿盟科技集团股份有限公司 | Firmware security analysis method and device |
-
2020
- 2020-12-17 CN CN202011497993.XA patent/CN112596739B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030065976A1 (en) * | 2001-10-01 | 2003-04-03 | Bennett David L. | Logic analyzer having a disassembler employing symbol table information for identifying op-codes |
US20200278875A1 (en) * | 2017-11-20 | 2020-09-03 | Huawei Technologies Co., Ltd. | Dynamic loading method, and target file creation method and apparatus |
CN108132790A (en) * | 2017-12-22 | 2018-06-08 | 广州酷狗计算机科技有限公司 | Detect the method, apparatus and computer storage media of dead code |
CN109918083A (en) * | 2019-03-07 | 2019-06-21 | 北京智游网安科技有限公司 | A kind of security processing based on application programming, intelligent terminal and storage medium |
CN110532774A (en) * | 2019-07-24 | 2019-12-03 | 阿里巴巴集团控股有限公司 | Hook inspection method, device, server and readable storage medium storing program for executing |
CN110879709A (en) * | 2019-11-29 | 2020-03-13 | 五八有限公司 | Detection method and device of useless codes, terminal equipment and storage medium |
CN111881455A (en) * | 2020-07-27 | 2020-11-03 | 绿盟科技集团股份有限公司 | Firmware security analysis method and device |
Non-Patent Citations (1)
Title |
---|
皮拉夫大王: "Mach-O简介及实际应用", 《HTTPS://WWW.CNBLOGS.COM/DENGZHULI/P/9952202.HTML》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113190235A (en) * | 2021-05-27 | 2021-07-30 | 武汉斗鱼鱼乐网络科技有限公司 | Code analysis method and device, electronic terminal and storage medium |
CN113190235B (en) * | 2021-05-27 | 2022-05-10 | 武汉斗鱼鱼乐网络科技有限公司 | Code analysis method and device, electronic terminal and storage medium |
CN113946347A (en) * | 2021-09-29 | 2022-01-18 | 北京五八信息技术有限公司 | Function call detection method and device, electronic equipment and readable medium |
CN113946346A (en) * | 2021-09-30 | 2022-01-18 | 北京五八信息技术有限公司 | Data processing method and device, electronic equipment and storage medium |
CN114020693A (en) * | 2021-10-19 | 2022-02-08 | 北京五八信息技术有限公司 | Header file address acquisition method and device, electronic equipment and storage medium |
CN114020693B (en) * | 2021-10-19 | 2022-07-08 | 北京五八信息技术有限公司 | Header file address acquisition method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112596739B (en) | 2022-03-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112596739B (en) | Data processing method and device | |
US7296261B2 (en) | Method for determining the degree to which changed code has been exercised | |
EP3365772B1 (en) | Missing include suggestions for external files | |
CN112100072B (en) | Static detection method, device, equipment and medium for application program code | |
US8266588B2 (en) | Creating projects in a rational application developer workspace | |
US11579856B2 (en) | Multi-chip compatible compiling method and device | |
CN107273176B (en) | Compiling method and device adaptive to hardware architecture | |
CN105183592B (en) | Method and apparatus for supporting performance evaluation | |
CN112799677B (en) | Method, device, equipment and storage medium for hook of compiling period | |
US7730451B2 (en) | Source server | |
CN111736812A (en) | Document code execution method and device, computer equipment and storage medium | |
CN112000367B (en) | Binary library file version compatibility identification method and device | |
CN116501378B (en) | Implementation method and device for reverse engineering reduction source code and electronic equipment | |
US9122550B2 (en) | Method and device for program installation | |
CN112052007A (en) | Source code debugging method, device, server and storage medium | |
JP2018156133A (en) | Compiler program, information processing apparatus and compilation method | |
CN114791811B (en) | Assembler realization method based on meta-function template | |
CN116578282A (en) | Code generation method, device, electronic equipment and medium | |
CN111240987A (en) | Migration program detection method and device, electronic equipment and computer readable storage medium | |
CN114817047A (en) | Compiler test method, case generation method and device and instruction storage structure | |
US7873949B2 (en) | In source code suppression of binary analysis | |
Linford et al. | Performance analysis of openshmem applications with tau commander | |
CN113946347B (en) | Function call detection method and device, electronic equipment and readable medium | |
JP5891976B2 (en) | Compile execution / management method, apparatus, and program | |
JP2009258796A (en) | Program development device and program development method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |