A method for verifying assembly code and related devices

By using preset communication rules to transmit assembly code to decompilation software during the development process, and simulating the execution of the assembly code to obtain results, the problem of difficulty in locating errors in assembly code during development is solved, thus improving development efficiency.

CN115129578BActive Publication Date: 2026-07-03WUHAN DOUYU NETWORK TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WUHAN DOUYU NETWORK TECHNOLOGY CO LTD
Filing Date
2021-03-25
Publication Date
2026-07-03

Smart Images

  • Figure CN115129578B_ABST
    Figure CN115129578B_ABST
Patent Text Reader

Abstract

This application provides a method and related equipment for verifying assembly code, belonging to the field of process development technology. It solves the problems in existing technologies where assembly code is unreadable, the compiler cannot verify it, leading to low efficiency in assembly code development, and difficulties in debugging and locating errors in the assembly code. The method includes: acquiring assembly code data, wherein the assembly code data includes assembly code and control instructions; simulating the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code; converting the execution result into graphical data; and calling a graphical interface to display the graphical data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of process development technology, and in particular to a method and related equipment for verifying assembly code. Background Technology

[0002] For security and special programs, some assembly code is mixed in during program development. However, assembly code is different from other code. As part of machine code, it is not easy to read, it is inconvenient to print logs, and the compiler does not help check for syntax errors. This leads to low efficiency in developing assembly code, and it is difficult to debug and locate errors when problems occur.

[0003] Existing decompilation software provides program analysis for released programs, displaying all the program's assembly code and data information for each section, including strings used in the program, imported and exported functions, etc. However, program analysis for released programs is lagging, and existing decompilation software lacks inter-process communication and control capabilities, making it impossible for another process to control and manipulate the decompilation software. Consequently, it is impossible to detect errors in the assembly code in a timely manner during program development, and the problem of difficulty in locating errors in the assembly code has not been solved. Summary of the Invention

[0004] The purpose of this application is to provide a method for verifying assembly code, which alleviates the technical problem in the prior art that it is impossible to detect errors in assembly code in a timely manner during program development and that it is difficult to locate errors in assembly code.

[0005] In a first aspect, embodiments of this application provide a method for verifying assembly code, including:

[0006] Assembly code data is obtained based on a preset executable program, wherein the preset executable program is an executable program containing preset functions;

[0007] The assembly code data is decoded using preset communication rules to obtain assembly code and control instructions. The preset communication rules are used for data transmission between the decompilation software and the preset executable program.

[0008] The assembly code and control instructions are sent to the decompilation software so that the decompilation software can simulate the execution of the assembly code based on the control instructions, thereby obtaining the execution result of the assembly code.

[0009] Optionally, the above steps for obtaining assembly code data based on a preset executable program include:

[0010] The assembly code is imported into a pre-defined executable program using pre-defined communication rules to generate an initial executable program.

[0011] The above assembly code data is generated based on the initial executable program described above.

[0012] Optionally, the steps described above, which involve importing the assembly code into a preset executable program using preset communication rules to generate an initial executable program, include:

[0013] The assembly code is sent to the preset executable program using the aforementioned preset communication rules.

[0014] Replace the assembly code of the default function in the default executable program with the above assembly code;

[0015] Use the replaced executable program as the initial executable program.

[0016] Optionally, the step of replacing the assembly code of the preset function in the preset executable program with the above-mentioned assembly code includes:

[0017] Determine the code space of the assembly code for the above-mentioned preset functions;

[0018] The nop instruction is invoked to completely overwrite the above code space;

[0019] The assembly code described above is used to override the nop instruction, thereby replacing the assembly code of the above assembly code with the assembly code of the above preset function.

[0020] Optionally, before the step of generating the assembly code data based on the initial executable program, the method further includes:

[0021] Verify that the initial executable program described above is complete;

[0022] If the initial executable program is incomplete, an error message will be returned and the assembly code data will not be generated.

[0023] Optionally, before the step of sending the assembly code and control instructions to the decompilation software so that the decompilation software simulates the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code, the method further includes:

[0024] Set an access breakpoint for the above assembly code.

[0025] Optionally, the steps for setting access breakpoints for the above assembly code include:

[0026] The default instruction SetBreakpoint(address,type) is invoked to set an access breakpoint for the above assembly code. Here, SetBreakpoint is an extended instruction that indicates setting a breakpoint, address is the location of the access breakpoint, and type is the type of the access breakpoint.

[0027] Secondly, embodiments of this application provide an assembly code verification device, comprising:

[0028] The data acquisition module is used to acquire assembly code data based on a preset executable program, wherein the preset executable program is an executable program containing preset functions;

[0029] The decryption module is used to decode the assembly code data to obtain assembly code and control instructions through preset communication rules. The preset communication rules are used for data transmission between the decompilation software and the preset executable program.

[0030] The verification module is used to send the assembly code and control instructions to the decompilation software, so that the decompilation software can simulate the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code.

[0031] Thirdly, embodiments of this application provide an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the assembly code verification method described above.

[0032] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon: when the computer program is executed by a processor, it implements the steps of the verification method of the assembly code described above.

[0033] This application provides a method and related apparatus for verifying assembly code. The method involves obtaining assembly code data based on a preset executable program, wherein the preset executable program is an executable program containing preset functions; decoding the assembly code data using preset communication rules to obtain assembly code and control instructions, wherein the preset communication rules are used for data transmission between decompilation software and the preset executable program; and sending the assembly code and control instructions to the decompilation software, so that the decompilation software simulates the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code. The aforementioned preset communication rules are used for data transmission between the decompilation software and the preset executable program, enabling process control and manipulation of the decompilation software. This allows for the verification of assembly code by the decompilation software. By obtaining assembly code data based on the preset executable program, the completed partial assembly code can be converted into an executable program readable by the decompilation software, thereby enabling the verification of the completed partial assembly code. This effectively alleviates the lag in program analysis of already released programs, achieving on-the-fly verification and improving the efficiency of developers. At the same time, the process of verifying the completed partial assembly code solves the problem of difficulty in locating errors in the complete program's assembly code. Attached Figure Description

[0034] To more clearly illustrate the specific implementation methods of the embodiments of this application or the technical solutions in the prior art, the drawings used in the description of the specific implementation methods or the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0035] Figure 1 A flowchart of an assembly code verification method provided in this application embodiment;

[0036] Figure 2 A schematic diagram illustrating an embodiment of an assembly code verification device provided in this application;

[0037] Figure 3 A schematic diagram illustrating an embodiment of an electronic device provided in this application;

[0038] Figure 4 This is a schematic diagram illustrating an embodiment of a computer-readable storage medium provided in this application. Detailed Implementation

[0039] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the embodiments of this application.

[0040] The terms "comprising" and "having," and any variations thereof, used in the embodiments of this application, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0041] Please refer to Figure 1 This application provides a method for verifying assembly code, including:

[0042] S101. Obtain assembly code data based on a preset executable program, wherein the preset executable program is an executable program containing preset functions;

[0043] For example, the aforementioned preset function is a function that occupies a large amount of byte space, and the function of the aforementioned preset function is simple. It does not reference system functions, so as to avoid the aforementioned system functions interfering with the aforementioned assembly code. The aforementioned preset function is the function that occupies the largest amount of byte space in the aforementioned executable program, so that when the aforementioned assembly code is imported into the preset executable program later, the assembly code of the aforementioned preset function can be found based on the function length.

[0044] For example, the aforementioned preset functions are functions that occupy a large amount of byte space and can adapt to assembly code of different lengths. This ensures that the aforementioned executable program has enough space for the subsequent process of importing the aforementioned assembly code into the preset executable program through preset communication rules. Data transmission between the aforementioned preset executable programs realizes the use of processes to control and manipulate the decompilation software, enabling the decompilation software to verify the assembly code, and thus realizing the conversion of the written partial assembly code into an executable program readable by the decompilation software.

[0045] In one possible implementation, the above-described step of obtaining assembly code data based on a preset executable program includes:

[0046] The assembly code is imported into a pre-defined executable program using pre-defined communication rules to generate an initial executable program.

[0047] The above assembly code data is generated based on the initial executable program described above.

[0048] Based on the pre-defined executable program, the assembly code data is obtained and the edited assembly code to be tested is converted into assembly code readable by decompilation software, which solves the technical problem that the compilation software cannot help check for syntax errors and other errors in the assembly code.

[0049] For example, the development program imports the edited assembly code to be tested into a preset executable program through preset communication rules. At the same time, the development program creates a decompilation software process via command line to generate an initial executable program so that the decompilation software can parse the initial executable program.

[0050] For example, the decompiler's process is created by calling the system function CreateProcess, thereby starting the decompiler. Specifically:

[0051] CreateProcess("name of the executable program of the decompiler", "path to the program to be decompiled by the decompiler")

[0052] Among them, CreateProcess is a system function, "the name of the executable program of the decompilation software" is the initial executable program, and "the path of the program that the decompilation software needs to decompile" is the preset communication rule;

[0053] The above-mentioned decompilation software is used to analyze the assembly code to be tested, and the analysis results are obtained. The current analysis results can be viewed in real time through the graphical display function of the above-mentioned decompilation software.

[0054] In one possible implementation, the screening criteria for the aforementioned decompilation software are as follows:

[0055] First, decompilation software needs to have a graphical user interface:

[0056] Decompilation software must have a user interface (UI) display function. Decompilation software without a graphical display function cannot intuitively display the inspection results of the above-mentioned assembly code to be inspected. Decompilation software should be able to display all the assembly code of the above-mentioned executable program. Each assembly code is broken down into a complete function, and the above-mentioned executable program is composed of these functions.

[0057] Secondly, the decompilation software must have the ability to modify assembly code:

[0058] Choosing decompilation software that supports modifying partial function code allows for the fixing of minor issues by modifying the assembly code, thus avoiding software recompilation and enabling rapid verification of whether the problem has been fixed. The development focuses on enabling modification of partial function code, allowing modification of functions within the complete assembly code.

[0059] Secondly, the decompilation software must have dynamic debugging capabilities.

[0060] Decompilation software needs to have the ability to execute assembly code. With the ability to execute assembly code, it can set the aforementioned access breakpoints on the assembly code to be examined, so that when simulating the execution of a piece of assembly code to be examined, the execution result can be obtained through the set assembly breakpoints.

[0061] Secondly, the decompilation software must have the ability to display function lengths.

[0062] Decompilation software needs to display the number of assembly instructions contained in each function. The more assembly instructions, the larger the function and the more memory it occupies. This is used to pre-define a function that occupies a sufficiently large amount of memory.

[0063] Secondly, the decompilation software must support the ability to open the program via command line.

[0064] Decompilation software needs to support creating a decompilation software process from a single process.

[0065] For example, the step of importing the assembly code into a preset executable program through preset communication rules to generate an initial executable program includes:

[0066] The assembly code is sent to the preset executable program using the aforementioned preset communication rules.

[0067] Replace the assembly code of the default function in the default executable program with the above assembly code;

[0068] Use the replaced executable program as the initial executable program.

[0069] For example, the assembly code can be written as a complete, independent function, complete with function start and end markers:

[0070] Void Asm_Function(){

[0071] _asm_(“assembly instructions”);}asm

[0072] Wherein, Void Asm_Function(){ is an assembly code program; "assembly instructions" is the assembly code to be tested mentioned above.

[0073] In one possible implementation, the step of replacing the assembly code of the preset function in the preset executable program with the assembly code described above includes:

[0074] Determine the code space of the assembly code for the above-mentioned preset functions;

[0075] The nop instruction is invoked to completely overwrite the above code space;

[0076] The assembly code described above is used to override the nop instruction, thereby replacing the assembly code of the above assembly code with the assembly code of the above preset function.

[0077] For example, the nop instruction is a one-byte instruction, so it can completely cover the code space of the assembly code of the aforementioned preset function. Compared to other two-byte instructions, if the remaining space of the assembly code of the aforementioned preset function is only one byte, then the two-byte instructions cannot cover the remaining space. However, the nop instruction, being a one-byte instruction, can completely cover the code space of the assembly code of the aforementioned preset function. At the same time, the nop instruction is an empty instruction and does not perform any operations on memory data, registers, etc. Therefore, the nop instruction is an empty instruction that is equivalent to being executed or not executed.

[0078] For example, by setting the extended function instructions of the above decompilation software, that is, modifying the instructions, the above assembly code to be tested can be overwritten with the nop instruction, and the above preset function can be replaced with the above assembly code to be tested and the nop instruction;

[0079] For example, the extended function instructions of the above decompilation software have the following functions:

[0080] wirte(address, code, length)

[0081] The Wite command is a function command used to write data to existing decompilation software.

[0082] Address is the address where the assembly code to be tested is written, that is, the starting address of the aforementioned preset function.

[0083] The code is the assembly code to be tested that needs to be written, that is, the assembly code that the development program transmits to the preset executable program through the preset communication rules.

[0084] Length is the length of the assembly code to be tested mentioned above;

[0085] In one possible implementation, prior to the step of generating the assembly code data based on the initial executable program, the method further includes:

[0086] Verify that the initial executable program described above is complete;

[0087] If the initial executable program is incomplete, an error message will be returned and the assembly code data will not be generated.

[0088] For example, after the assembly code to be tested replaces a preset function, the extended instructions of the decompiler are used to analyze the assembly code to determine whether it is a complete function. If the assembly code is not a complete function, the analyzed function will not have a proper ending, and the decompiler will not recognize it as a function, nor will it name the corresponding function. Therefore, the decompiler assumes the assembly code is just a code segment, not a complete function. If the assembly instructions of the assembly code to be tested are discontinuous due to storage errors, the decompiler analyzes the assembly code as data, thus not considering it a piece of assembly code. This solves the technical problem that decompilers cannot help check for syntax errors and other errors in assembly code.

[0089] S102. The assembly code data is decoded using preset communication rules to obtain assembly code and control instructions. The preset communication rules are used for data transmission between the decompilation software and the preset executable program. The preset communication rules are used to transmit null instructions for modifying code, instructions for setting access breakpoints for assembly code, instructions for simulating execution of assembly code to be verified, instructions for obtaining execution results through the access breakpoints, and instructions for outputting the results to the log output window of the decompilation software.

[0090] For example, decompilation software lacks inter-process communication and control capabilities, making it impossible for another process to control and manipulate the decompilation software. Therefore, when developing decompilation software, it is necessary to ensure that the edited assembly code to be verified during program development can be transferred to the decompilation software and that the inter-process communication and control functions provided by the decompilation software can be executed automatically. Thus, it is essential to guarantee that the developed functionality enables bidirectional communication.

[0091] For example, the data description language protobuf is used as the encoding and decoding protocol for data communication to serialize the above assembly code data, resulting in a serialized data segment;

[0092] For example, based on the extended functions supported by the decompilation software, the above control instructions are developed, and function instructions based on function size sorting are written to obtain the address of the above preset function in the above preset executable program;

[0093] For example, since existing decompilation software can receive published program data, the aforementioned preset communication rules can be indirectly imported into the process of the aforementioned decompilation software through the aforementioned preset executable program. The aforementioned decompilation software then passively loads the aforementioned preset communication rules, and data is transmitted between the decompilation software and the aforementioned preset executable program based on the aforementioned preset communication rules.

[0094] For example, based on the extended functionality of decompilation, an access breakpoint is set at the end of the assembly code to be tested. This allows the execution result of the assembly code to be obtained during simulated execution. When the assembly code reaches the access breakpoint, execution stops, and the result is obtained. After the assembly code finishes execution, the EAX register is used to store the execution result. Setting an access breakpoint before the `retn` statement, or setting the corresponding access breakpoint after assigning a value to EAX at the end, will store the execution result of the assembly code being tested in the EAX register.

[0095] The default instruction SetBreakpoint(address,type) is invoked to set an access breakpoint for the above assembly code. Here, SetBreakpoint is an extended instruction that indicates setting a breakpoint, address is the location of the access breakpoint, and type is the type of the access breakpoint.

[0096] Based on the extended functionality of decompilation, the address at which the simulated execution of the assembly code to be tested is set is determined. This allows for viewing the execution results of the assembly code to be tested and verifying the correctness of the current execution results in real time. Specifically:

[0097] StartExecute(address);

[0098] StartExecute is the function command that starts the simulation execution.

[0099] `address` is the address at which the simulated execution of the assembly code to be tested begins.

[0100] S103. The assembly code and control instructions are sent to the decompilation software so that the decompilation software simulates the execution of the assembly code based on the control instructions, and obtains the execution result of the assembly code.

[0101] For example, based on the above assembly code and control instructions, the code analysis function of the decompilation software has the function of checking the code, and also has the function of analyzing various data of the code; the decompilation software will analyze the existing above assembly code to be tested, mark all cross-references of the above assembly code to be tested, including global variables referenced by the above assembly code to be tested, system functions called, and the addresses of other functions of the program called by the above assembly code to be tested.

[0102] Assembly code data is obtained based on a preset executable program, which is an executable program containing preset functions. The assembly code data is decoded using preset communication rules to obtain assembly code and control instructions. These preset communication rules are used for data transmission between the decompilation software and the preset executable program. The assembly code and control instructions are then sent to the decompilation software, which simulates the execution of the assembly code based on the control instructions, resulting in the execution result. By using the preset communication rules for data transmission between the decompilation software and the preset executable program, the decompilation software can be controlled and manipulated through processes. This enables the verification of assembly code using the decompilation software. By obtaining assembly code data based on the preset executable program, partially written assembly code can be converted into an executable program readable by the decompilation software, thus enabling the verification of partially written assembly code. This effectively alleviates the lag in program analysis of released programs, allowing for on-the-fly verification and improving developer efficiency. Furthermore, the process of verifying partially written assembly code solves the problem of locating errors in the complete program's assembly code.

[0103] In one possible implementation, assembly code is mixed in during program development. However, assembly code differs from other code. As it is machine code, it is difficult to read, decompilation software cannot help check for syntax errors, and it is inconvenient to print logs. This makes it difficult to check the assembly code, requiring developers to compare the code one by one, which wastes program development time. Consequently, the development of assembly code is inefficient, and debugging and error location are difficult when problems occur.

[0104] By converting the edited assembly code to be tested into assembly code readable by decompilation software, and developing the decompilation software, it is possible to use the decompilation software to check the written partial assembly code. This allows for simultaneous writing and checking, enabling timely identification of errors, and eliminating the need for manual checking of the written assembly code. This effectively alleviates the lag in program analysis of already released programs, improves the efficiency of developers, and solves the problem of difficulty in locating errors in the complete program's assembly code by checking the written partial assembly code.

[0105] Secondly, please refer to Figure 2 This application provides an assembly code verification device, comprising:

[0106] The data acquisition module 201 is used to acquire assembly code data based on a preset executable program, wherein the preset executable program is an executable program containing preset functions;

[0107] The decryption module 202 is used to decode the assembly code data through preset communication rules to obtain assembly code and control instructions, wherein the preset communication rules are used for data transmission between the decompilation software and the preset executable program;

[0108] The verification module 203 is used to send the assembly code and the control instructions to the decompilation software, so that the decompilation software can simulate the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code.

[0109] Thirdly, please refer to Figure 3 This application provides an electronic device, including a memory 310, a processor 320, and a computer program 311 stored in the memory 320 and executable on the processor 320. When the processor 320 executes the computer program 311, it performs the following steps: obtaining assembly code data based on a preset executable program, wherein the preset executable program is an executable program containing preset functions; decoding the assembly code data through preset communication rules to obtain assembly code and control instructions, wherein the preset communication rules are used for data transmission between decompilation software and the preset executable program; and sending the assembly code and the control instructions to the decompilation software, so that the decompilation software simulates the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code.

[0110] Fourthly, please refer to Figure 4This application provides a computer-readable storage medium 400 storing a computer program 411. When executed by a processor, the computer program 411 performs the following steps: obtaining assembly code data based on a preset executable program, wherein the preset executable program is an executable program containing preset functions; decoding the assembly code data through preset communication rules to obtain assembly code and control instructions, wherein the preset communication rules are used for data transmission between decompilation software and the preset executable program; and sending the assembly code and control instructions to the decompilation software, so that the decompilation software simulates the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code.

[0111] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functions, and operations of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0112] For example, the above division of units is merely a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual couplings, direct couplings, or communication connections may be indirect couplings or communication connections through some communication interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0113] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0114] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0115] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of this application, essentially, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0116] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0117] Finally, it should be noted that the above embodiments are merely specific implementations of the embodiments of this application, used to illustrate the technical solutions of the embodiments of this application, and not to limit them. The protection scope of the embodiments of this application is not limited thereto. Although the embodiments of this application have been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the embodiments of this application, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. A method for verifying assembly code, characterized in that, include: Assembly code data is obtained based on a preset executable program, wherein the preset executable program is an executable program containing preset functions; The assembly code data is decoded using preset communication rules to obtain assembly code and control instructions. The preset communication rules are used for data transmission between the decompilation software and the preset executable program. The assembly code and the control instructions are sent to the decompilation software, so that the decompilation software simulates the execution of the assembly code based on the control instructions, and obtains the execution result of the assembly code; The step of obtaining assembly code data based on a preset executable program includes: The assembly code is imported into a preset executable program using preset communication rules to generate an initial executable program; The assembly code data is generated based on the initial executable program; The step of importing the assembly code into a preset executable program through preset communication rules to generate an initial executable program includes: The assembly code is sent to the preset executable program using the preset communication rules; Replace the assembly code of the preset function in the preset executable program with the assembly code; The replaced executable program is used as the initial executable program.

2. The method for verifying assembly code according to claim 1, characterized in that, The step of replacing the assembly code of the preset function in the preset executable program with the assembly code includes: Determine the code space of the assembly code for the preset function; The nop instruction is invoked to completely overwrite the code space. The assembly code is used to override the nop instruction, thereby replacing the assembly code with the assembly code of the preset function.

3. The method for verifying assembly code according to claim 1, characterized in that, Prior to the step of generating the assembly code data based on the initial executable program, the method further includes: Verify that the initial executable program is complete; If the initial executable program is incomplete, an error message will be returned and the assembly code data will not be generated.

4. The method for verifying assembly code according to claim 1, characterized in that, Before the step of sending the assembly code and the control instructions to the decompilation software, so that the decompilation software simulates the execution of the assembly code based on the control instructions to obtain the execution result of the assembly code, the method further includes: Set an access breakpoint for the assembly code.

5. The method for verifying assembly code according to claim 4, characterized in that, The step of setting access breakpoints for the assembly code includes: The preset instruction SetBreakpoint(address, type) is invoked to set an access breakpoint for the assembly code, where SetBreakpoint is an extended instruction for setting a breakpoint, address is the location of the access breakpoint, and type is the type of the access breakpoint.

6. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program stored in the memory, implements the steps of the method for verifying assembly code as described in any one of claims 1-5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the verification method for assembly code as described in any one of claims 1-5.