Program processing method, computing device, storage medium and program product

By collecting and decompiling the static and dynamic code of the target program, more comprehensive code features are obtained, which solves the problem of inaccurate static code analysis and improves the accuracy of program verification and data collection efficiency.

CN120653262APending Publication Date: 2025-09-16HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410289667.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-13
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In the prior art, static code analysis cannot fully characterize the runtime characteristics of a program, resulting in inaccurate code features and affecting the accuracy of program verification.

Method used

The static and dynamic codes of the target program are collected during runtime, and decompiled through non-invasive injection to obtain the target source code for semantic analysis to obtain code features.

Benefits of technology

By collecting static and dynamic code at the same time, more comprehensive code features can be obtained, the accuracy of program verification can be improved, and the efficiency and quality of data collection can be improved without affecting the operation of the target program.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653262A_ABST
    Figure CN120653262A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a program processing method, computing equipment, a storage medium and a program product. The method comprises the following steps: acquiring static codes and dynamic codes when a target program runs by utilizing an acquisition program; decompiling the static code and the dynamic code to obtain a target source code; wherein the acquisition program is injected into the target program in a non-intrusive manner; the target source code is used for semantic analysis to obtain code features. According to the technical scheme provided by the embodiment of the invention, the accuracy of code features is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a program processing method, a computing device, a storage medium, and a program product. Background Art

[0002] To improve program security, stability, or compatibility, you can perform code analysis on the program to obtain code features, and use these features to verify the program. For example, in a microservice scenario, you can design and develop individual microservice applications based on a microservice framework, splitting the service program into multiple microservice applications, each of which corresponds to a function provided by the service program. The microservice framework can provide many APIs (Application Programming Interfaces) for developers to use. Therefore, understanding the APIs used by the service program can ensure the compatibility and stability of the service program when the microservice framework is upgraded.

[0003] Currently, white-box analysis is usually used to perform semantic analysis on the static code generated during the program compilation phase to obtain code features. However, static code cannot fully represent the runtime features of the program, resulting in inaccurate code features. Summary of the Invention

[0004] The embodiments of the present application provide a program processing method, a computing device, a storage medium, and a program product to solve the problem of low accuracy of code features in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a program processing method, comprising:

[0006] Using a collection program to collect static code and dynamic code of a target program when it is running; wherein the collection program is injected into the target program without intrusion;

[0007] Decompiling the static code and the dynamic code to obtain target source code;

[0008] The target source code is used for semantic analysis to obtain code features.

[0009] Optionally, the method further includes:

[0010] The target source code is sent to a control end, so that the control end performs semantic analysis on the target source code to obtain code features, and performs verification processing on the target program based on the code features.

[0011] Optionally, the method further includes:

[0012] Performing semantic analysis on the target source code to obtain code features;

[0013] The code features are sent to a control terminal, so that the control terminal can verify the target program based on the code features.

[0014] In a second aspect, an embodiment of the present application provides a program processing method, including:

[0015] Determining a target source code of a target program; decompiling the target source code to obtain static code and dynamic code collected when the target program is running; the static code and the dynamic code are collected by a collection program that is non-invasively injected into the target program;

[0016] Perform semantic analysis on the target source code to obtain code features.

[0017] Optionally, the method further includes:

[0018] Based on the code features, the target program is verified.

[0019] Optionally, performing semantic analysis on the target source code to obtain code features includes:

[0020] detecting target information meeting sensitive requirements in the target source code;

[0021] Deleting the target information or replacing the target information with preset information to update the target source code;

[0022] Perform semantic analysis on the updated target source code to obtain code features.

[0023] Optionally, the target program is a microservice application;

[0024] The verifying process on the target program based on the code features includes:

[0025] Determine the code features corresponding to the multiple microservice applications divided by the service program;

[0026] Archiving the code features corresponding to the multiple microservice applications to obtain the code features corresponding to the service program;

[0027] The service program is verified based on the code features corresponding to the service program.

[0028] Optionally, the code features include usage information of an application program interface provided by the microservice framework;

[0029] The verifying process on the service program based on the code feature corresponding to the service program includes:

[0030] Providing the usage information to a framework provider of the microservice framework, so that the framework provider verifies the usage information, receives a verification result provided by the framework provider, and sends a prompt message to the developer corresponding to the service program based on the verification result;

[0031] or,

[0032] Based on the usage information and upgrade requirements, build test cases for the microservice framework;

[0033] or,

[0034] If it is determined based on the usage information that there is a risk of misuse of the application program interface, a risk notification is sent to the developer corresponding to the service program.

[0035] In a third aspect, an embodiment of the present application provides a program processing method, including:

[0036] Obtain acquisition procedures;

[0037] injecting the acquisition program into the target program without intrusion;

[0038] The acquisition program is run to use the acquisition program to acquire static code and dynamic code of the target program during operation, and the static code and the dynamic code are decompiled to obtain target source code; wherein the target source code is used for semantic analysis to obtain code features.

[0039] Optionally, the non-invasively injecting the acquisition program into the target program includes:

[0040] Load the proxy tool;

[0041] The agent tool is used to inject the acquisition program into the target program without intrusion.

[0042] Optionally, the acquisition and collection procedure includes:

[0043] Obtaining a collection program issued by a dispatching terminal; the collection program is provided by a user to the dispatching terminal.

[0044] In a fourth aspect, an embodiment of the present application provides a program processing method, including:

[0045] In response to the collection instruction, determining a collection program provided by the user;

[0046] The acquisition program is sent to at least one server so that the server non-invasively injects the acquisition program into a target program to acquire static code and dynamic code of the target program, and decompiles the static code and the dynamic code to obtain a target source code; wherein the target source code is used for semantic analysis to obtain code features.

[0047] In a fifth aspect, an embodiment of the present application provides a computing device, including a processing component and a storage component;

[0048] The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the program processing method described in the first aspect above, or the program processing method described in the second aspect above, or the program processing method described in the third aspect above, or the program processing method described in the fourth aspect above.

[0049] In the sixth aspect, an embodiment of the present application provides a computer storage medium storing a computer program. When the computer program is executed by a computer, it implements the program processing method described in the first aspect above, or the program processing method described in the second aspect above, or the program processing method described in the third aspect above, or the program processing method described in the fourth aspect above.

[0050] In the seventh aspect, a computer program product is provided in an embodiment of the present application, including a computer program / instruction. When the computer program / instruction is executed by a computer, it implements the program processing method described in the first aspect above, or the program processing method described in the second aspect above, or the program processing method described in the third aspect above, or the program processing method described in the fourth aspect above.

[0051] The embodiment of the present application utilizes a collection program to collect static code and dynamic code when the target program is running, wherein the collection program is non-invasively injected into the target program, and then the static code and dynamic code are decompiled to obtain the target source code, wherein the target source code is used for semantic analysis to obtain code features. Since static code and dynamic code are collected at the same time, a more comprehensive code analysis can be performed, and more comprehensive and accurate code features can be obtained, thereby improving the accuracy of verifying the target program using code features. In addition, by collecting code using a non-invasive injection method, the required data can be fully and accurately collected without affecting the operation of the target program application, thereby improving the efficiency and quality of collection.

[0052] These and other aspects of the present application will become more readily apparent from the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0054] Figure 1 A flowchart of an embodiment of a program processing method provided by the present application is shown;

[0055] Figure 2 A flowchart of an embodiment of a program processing method provided by the present application is shown;

[0056] Figure 3 A flowchart of an embodiment of a program processing method provided by the present application is shown;

[0057] Figure 4 A flowchart of an embodiment of a program processing method provided by the present application is shown;

[0058] Figure 5 A schematic diagram of scene interaction in a practical application of an embodiment of the present application is shown;

[0059] Figure 6 A schematic structural diagram of an embodiment of a program processing device provided by the present application is shown;

[0060] Figure 7 A schematic structural diagram of an embodiment of a program processing device provided by the present application is shown;

[0061] Figure 8 A schematic structural diagram of an embodiment of a program processing device provided by the present application is shown;

[0062] Figure 9 A schematic structural diagram of an embodiment of a program processing device provided by the present application is shown;

[0063] Figure 10 A schematic structural diagram of an embodiment of a computing device provided by the present application is shown. DETAILED DESCRIPTION

[0064] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0065] In some of the processes described in the specification and claims of this application and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to being different types.

[0066] As described in the background technology, the traditional white-box analysis method is to perform semantic analysis on the static code generated during the program compilation phase to obtain code features, and then verify the program based on the code features. However, in the process of implementing this application, the inventors found that due to the large number of external dependencies involved in the program, especially in large-scale programs, these external dependencies are often in other source code libraries, and these dependencies cannot be obtained based on the code features of the static code. In addition, some programs may adopt a runtime dynamic loading mode, which adds some new functions to the program, and these functions cannot be reflected in the static code. Therefore, the white-box analysis method will lead to inaccurate verification methods.

[0067] In order to improve the accuracy of verification, the inventors have proposed the technical solution of the present application after a series of studies. In an embodiment of the present application, a collection program is used to collect static code and dynamic code when the target program is running, wherein the collection program is non-invasively injected into the target program, and then the static code and dynamic code are decompiled to obtain the target source code, wherein the target source code is used for semantic analysis to obtain code features. Since static code and dynamic code are collected at the same time, a more comprehensive code analysis can be performed, and more comprehensive and accurate code features can be obtained, thereby improving the accuracy of verifying the target program using code features. In addition, by collecting code in a non-invasive injection manner, the required data can be collected comprehensively and accurately without affecting the operation of the target program application, thereby improving the efficiency and quality of collection.

[0068] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.

[0069] It should be noted that the embodiments of the present application may involve the use of user data. In actual applications, user-specific personal data can be used in the scheme described herein within the scope permitted by applicable laws and regulations, subject to the requirements of applicable laws and regulations of the country where the user is located (for example, with the user's explicit consent, effective notification to the user, etc.).

[0070] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0071] It should be noted that the technical solution of the embodiment of the present application is applicable to a network virtual environment. The users, framework providers, developers, etc. described are generally referred to as "virtual users". Real users can register a user account on the server through registration to obtain a user identity in the network environment.

[0072] The implementation details of the technical solution of the embodiment of the present application are described in detail below.

[0073] Figure 1 This is a flowchart of an embodiment of a program processing method provided by this application. The technical solution of this embodiment can be executed by an acquisition program. The method may include the following steps:

[0074] 101: Use a collection program to collect static codes and dynamic codes when the target program is running.

[0075] The target program can refer to any program, including a backend service program, a frontend application, or a script. In one practical application of the present application, the target program can be a microservice application. A microservice application is a software architecture style that decomposes a large, monolithic program into a set of small, independent microservice applications, each of which runs in its own process. Developers can use a microservice framework to build and run microservice applications.

[0076] Static code is determined and solidified during the compilation phase, that is, it exists before the target program runs and will not change during runtime; dynamic code is code that is created, modified, or executed when the target program is running. It can include code generated in real time as needed during program runtime, and / or remote code pulled from external sources. In actual applications, such as in scripting languages ​​such as Python (a programming language) and JavaScript (a programming language), code can be constructed through strings at runtime and converted into executable objects or modules using built-in functions or API calls. Remote code can refer to code stored on an external source outside the local program and needs to be downloaded to the local computer via the network for execution. For example, a program with hot update capabilities can pull the latest code version from a remote code repository and replace part or all of the local logic; or in some open platform frameworks, the program can pull verified security scripts or plug-in code from a remote server to expand its functionality.

[0077] Among them, the acquisition program can be injected into the target program without intrusion when the target program is running, and the acquisition program can be injected into the runtime environment of the program.

[0078] Of course, the acquisition program can also be injected into the target program without intrusion before the target program runs.

[0079] The collection program can be a specific code snippet or function that can be dynamically added to the running process of the target program without modifying the source code of the target program. It can collect data without changing the logic of the target program and will not significantly affect the performance of the target program.

[0080] Among them, Agent technology, eBPF (Extended Berkeley Packet Filter) technology, etc. can be used to inject the collection program into the target program non-invasively when the target program is running. eBPF technology is a more low-level non-invasive injection technology that can dynamically insert and execute code in the kernel and user space applications. Agent tools, such as Java (a programming language) Agent, Python Agent, etc., are independently running programs that can inject the required functions into the target program by modifying the bytecode or adding new classes and methods at runtime without modifying the source code. For example, if the target program is a Java program, the Java Agent provided by the JVM (Java Virtual Machine) can insert the collection program into the program runtime environment by loading the specified Agent class when the target program is running.

[0081] The collection program can collect static code and dynamic code while the program is running. The collection program can collect static code and dynamic code through the API provided by the underlying system such as JVM.

[0082] The target program and the acquisition program may be run in a computing device. When the target program is a backend service program, the computing device may be a server, etc.

[0083] 102: Decompile the static code and the dynamic code to obtain the target source code.

[0084] Target source code is code written in a programming language that contains all the instructions and logic for the target program, directing a computer to perform specific tasks. Target source code needs to be converted into binary code, or bytecode, by a compiler or interpreter so that the computer can execute it.

[0085] The static code and the dynamic code may be binary code or bytecode converted by the target source code by a compiler. The static code and the dynamic code may be decompiled using a decompilation tool to obtain the target source code.

[0086] The target source code can be used for semantic analysis to obtain code features, which can be used to verify the target program.

[0087] The target source code can be converted into an AST (Abstract Syntax Tree). The AST represents the grammatical structure of the target source code in the form of a tree, with each node in the tree representing a structure in the target source code. Furthermore, a semantic analyzer can be used to perform in-depth analysis of the AST to obtain code features.

[0088] Code features can include, for example, code structure, syntax, semantics, control flow, data flow, types, and exception handling. Based on these features, the behavior, intent, and potential issues of the target source code can be identified, facilitating operations such as code optimization, refactoring, error detection, and quality improvement.

[0089] In this embodiment, a collection program is used to collect static code and dynamic code during the runtime of a target program. The collection program is non-invasively injected into the target program, and then the static code and dynamic code are decompiled to obtain the target source code. The target source code is used for semantic analysis to obtain code features. Since static and dynamic code are collected simultaneously, a more comprehensive code analysis can be performed, resulting in more comprehensive and accurate code features, thereby improving the accuracy of verifying the target program using code features. Furthermore, by collecting code using non-invasive injection, the required data can be comprehensively and accurately collected without affecting the operation of the target program application, thereby improving the efficiency and quality of collection.

[0090] As an optional method, the acquisition program can directly perform semantic analysis on the target source code to obtain code features. Therefore, the method can also include: performing semantic analysis on the target source code to obtain code features; sending the code features to the control end so that the control end can verify the target program based on the code features.

[0091] Since semantic analysis of the target source code typically requires significant resources, an alternative approach is to send the target source code to a control terminal through a mechanism such as event notification. The control terminal can then perform semantic analysis on the target source code to obtain code features, thereby avoiding consuming significant resources on the server running the target program. The control terminal can be a centralized server cluster, possessing more powerful computing capabilities than the server running the target program. Therefore, the method can further include: sending the target source code to the control terminal, for the control terminal to perform semantic analysis on the target source code to obtain code features, and verifying the target program based on the code features.

[0092] Figure 2 This is a flowchart of an embodiment of a program processing method provided by this application. The technical solution of this embodiment can be executed by an acquisition program or a control terminal. The method may include the following steps:

[0093] 201: Determine the target source code of the target program.

[0094] As an optional manner, the technical solution of this embodiment can be executed by the control end, and the target source code of the target program can be sent to the control end by the acquisition program.

[0095] The control end can be implemented as a distributed server cluster consisting of multiple servers or as a single server. The server can also be a server in a distributed system or a server integrated with blockchain. The server can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0096] The target source code is obtained by decompiling static code and dynamic code collected when the target program is running. The static code and dynamic code are collected by a collection program that is non-invasively injected into the target program.

[0097] 202: Perform semantic analysis on the target source code to obtain code features.

[0098] In this embodiment, the target source code of the target program is determined, and a semantic analysis is performed on the target source code to obtain code features. The target source code is obtained by decompiling the static code and dynamic code collected when the target program is running; the static code and dynamic code are collected by a collection program that is non-invasively injected into the target program. Since static code and dynamic code are collected at the same time, a more comprehensive code analysis can be performed, and more comprehensive and accurate code features can be obtained, thereby improving the accuracy of verifying the target program using code features. In addition, by collecting code using non-invasive injection, the required data can be collected comprehensively and accurately without affecting the operation of the target program application, thereby improving the efficiency and quality of collection.

[0099] In some embodiments, performing semantic analysis on the target source code to obtain code features may include: detecting target information in the target source code that meets sensitivity requirements; deleting the target information or replacing the target information with preset information to update the target source code; and performing semantic analysis on the updated target source code to obtain code features.

[0100] For example, target information can include private data such as usernames, passwords, and encryption keys. Deleting target information or replacing it with pre-set information can prevent sensitive information leakage and reduce security risks.

[0101] In some embodiments, the method may further include: performing verification processing on the target program based on code features.

[0102] In some embodiments, the target program may be a microservice application.

[0103] A microservice application is a software architecture style that decomposes a large, monolithic program into a set of small, independent microservice applications. Each microservice application runs in its own process. Developers can use a microservice framework to build and run microservice applications. For example, an e-commerce service might independently develop and design microservice applications for different functions, such as product management, order processing, user authentication, and payment processing. Each microservice application focuses on completing a specific function and can be independently deployed, scaled, and maintained. These microservice applications interact and integrate using lightweight protocols, working together to realize the functionality of the entire service.

[0104] Since a service program may involve multiple microservice applications, the above-mentioned verification processing of the target program based on code features may include: determining the code features corresponding to the multiple microservice applications divided by the service program; archiving the code features corresponding to the multiple microservice applications to obtain the code features corresponding to the service program; and verifying the service program based on the code features corresponding to the service program.

[0105] Archiving code features corresponding to multiple microservice applications can, for example, include merging code features that meet similar conditions and then archiving them to obtain code features corresponding to the service programs. For example, similar conditions can include variables and function names with identical semantics, similar control flows and logical structures, and code blocks and functions with identical functionality or behavior. This simplifies the code feature representation, reduces redundancy and noise, and helps users better understand the source code.

[0106] In actual applications, the microservice framework will provide a lot of flexible APIs for developers of service programs to use, and the codes of the programs developed by developers are also deeply integrated with the microservice framework. As a result, when the microservice framework needs to be upgraded, due to the large number of API usage methods, the framework provider has no way of knowing which API is used, and thus cannot specifically verify the upgrade compatibility of the microservice framework, which brings a greater stability risk. In addition, the framework provider will often set API usage rules to regulate the use methods of developers, etc. It is also important to promptly notify developers of the risk of misuse. Therefore, in some embodiments, the above-mentioned code features may include API usage information provided by the microservice framework.

[0107] The usage information may include, for example, the API name, the number of times the API is used, the way the API is used, such as in which functional modules it is used, etc. The archiving of the code features may include statistics on the number of times the API is used, etc.

[0108] As an optional implementation, based on the code features of the service program, verification of the service program can include: providing usage information to the microservice framework provider, for verification by the framework provider; receiving the verification results from the framework provider, and sending a prompt to the developer of the service program based on the verification results. Through this implementation, the framework provider can fully understand the usage of the application program interface and perform targeted verification of the compatibility and stability of the microservice framework.

[0109] As another optional implementation, based on the code features corresponding to the service program, verification processing of the service program may include: building test cases for the microservice framework based on usage information and upgrade requirements.

[0110] For example, when a microservice framework requires an upgrade, in order to ensure the compatibility and stability of the service program, test cases can be built based on the service program's API usage information and upgrade requirements, so that the test cases can ensure that the service program's API usage information remains unchanged. Therefore, once the test case is verified and used to upgrade the microservice framework, the upgraded microservice framework can still be compatible with the service program, ensuring the stability of the service program. Building test cases based on usage information can ensure that the functionality and performance of important APIs are not affected. In addition, microservice framework upgrades may add, modify, or deprecate certain APIs, and corresponding test cases can be planned to ensure that all uses of deprecated or modified APIs are handled correctly.

[0111] As another optional implementation, verification of the service program based on code features corresponding to the service program may include: based on usage information, if it is determined that there is a risk of misuse of the application program interface, sending a risk notification to the developer corresponding to the service program.

[0112] Optionally, you can determine whether the application has an interface misuse risk by judging whether the usage information meets the risk conditions.

[0113] For example, the risk condition could be an application program interface failure, a call error, incorrect input parameters, and / or an incorrect call sequence. An application program interface failure could mean, for example, that the application program has been deprecated or is not recommended for use. If a service program is determined to have a misuse risk, a corresponding risk notification is sent to the developer of the service program. Based on the risk notification, the developer can improve the use of the application program interface to reduce the risk of misuse.

[0114] Optionally, code collection for the target program can be performed multiple times, thereby combining the current and historical usage information of the service program to determine whether there is a risk of API misuse. A service program can be considered to be at risk of misuse if the usage information meets the risk criteria multiple times or a specified number of times.

[0115] Figure 3 This is a flowchart of an embodiment of a program processing method provided by the present application. The technical solution of this embodiment can be executed by a computing device. When the target program is a Java program, the technical solution of this embodiment can be specifically executed by a JVM running in the computing device. The method may include the following steps:

[0116] 301: Get the collection program.

[0117] 302: Inject the acquisition program into the target program without intrusion.

[0118] The acquisition program may be injected non-invasively while the target program is running. Of course, the acquisition program may also be injected non-invasively before the target program is running.

[0119] 303: Run a collection program to collect static code and dynamic code of the target program when it is running, and decompile the static code and dynamic code to obtain the target source code.

[0120] The target source code is used for semantic analysis to obtain code features; the code features can be used to verify the target program.

[0121] In this embodiment, a collection program is obtained, non-invasively injected into the target program, and then run to use the collection program to collect static code and dynamic code from the target program during runtime, and decompile the static code and dynamic code to obtain the target source code, wherein the target source code is used for semantic analysis to obtain code features. Since static code and dynamic code are collected simultaneously, a more comprehensive code analysis can be performed, and more comprehensive and accurate code features can be obtained, thereby improving the accuracy of verifying the target program using code features. In addition, by collecting code using non-invasive injection, the required data can be comprehensively and accurately collected without affecting the operation of the target program application, thereby improving the efficiency and quality of collection.

[0122] In some embodiments, obtaining the acquisition program may include obtaining the acquisition program issued by the dispatching end. The acquisition program may be provided to the dispatching end by a user. The user may be, for example, a framework provider, a specific operation and maintenance personnel, or a testing personnel.

[0123] In some embodiments, non-invasively injecting the acquisition program into the target program may include: loading an agent tool; and non-invasively injecting the acquisition program into the target program using the agent tool.

[0124] The agent tool may be an agent tool such as a Java Agent or a Python Agent. The agent tool can be used to insert a collection program into the program runtime environment by loading a specified Agent class when the target program is running.

[0125] Figure 4 This is a flowchart of an embodiment of a program processing method provided in this application. The technical solution of this embodiment can be executed by the scheduling end.

[0126] 401: In response to the collection instruction, determine the collection program provided by the user.

[0127] 402: Sending a collection program to at least one server so that the server non-invasively injects the collection program into the target program to collect static code and dynamic code of the target program, and decompiles the static code and dynamic code to obtain target source code.

[0128] The target source code is used for semantic analysis to obtain code features; and the code features are used to verify the target program.

[0129] In this embodiment, in response to a collection instruction, a collection program provided by the user is determined, and the collection program is sent to at least one server so that the server can non-invasively inject the collection program into the target program to collect the static code and dynamic code of the target program, and decompile the static code and dynamic code to obtain the target source code, wherein the target source code is used to perform semantic analysis to obtain code features. Since static code and dynamic code are collected at the same time, a more comprehensive code analysis can be performed, and more comprehensive and accurate code features can be obtained, thereby improving the accuracy of verifying the target program using code features. In addition, by collecting code using non-invasive injection, the required data can be fully and accurately collected without affecting the operation of the target program application, thereby improving the efficiency and quality of collection.

[0130] For ease of understanding, the following takes a microservice application as an example. The microservice application can be divided into service programs developed based on the microservice framework, combined with Figure 5The following diagram illustrates the interaction scenario of this application in a practical application. A user 501 can issue a collection instruction to multiple servers 503 via a dispatcher 502. Each server 503 can run a microservice application 504 corresponding to the service program. In response to the collection instruction, the server 503 can load an agent tool and use it to inject the collection program 505 in the collection instruction into the runtime environment of the microservice application 504.

[0131] Taking the microservice application 504 as a Java program as an example, the server running the microservice application 504 can execute the collection instruction, load the Java Agent provided by the JVM, and use the Java Agent to non-invasively inject the collection program 505 issued by the scheduling end into the microservice application 504 when the microservice application 504 is running.

[0132] When microservice application 504 is running, collection program 505 can collect the static code and dynamic code corresponding to microservice application 504 based on the API provided by the JVM. Collection program 505 can decompile the static code and dynamic code to obtain the target source code, and can provide the target source code to control terminal 506 through, for example, an event notification mechanism.

[0133] The control terminal 506 can obtain the target source code corresponding to the multiple microservice applications corresponding to the service program, perform semantic analysis on the multiple target source codes, detect target information in the target source code that meets the sensitivity requirements, delete the target information or replace the target information with preset information, and update the target source code corresponding to the multiple microservice applications to achieve desensitization. Afterwards, semantic analysis can be performed on the desensitized target source code to obtain the code features corresponding to the multiple microservice applications. The code features corresponding to the multiple microservice applications are archived, for example, by merging code features that meet similar conditions, to obtain the code features corresponding to the service program.

[0134] The code features may include usage information of the application program interface provided by the microservice framework. The control terminal 506 may provide the usage information to the framework provider 507 of the microservice framework, so that the framework provider 507 can verify the usage information. The framework provider 507 may be the same as the user 501. The control terminal 506 may also receive the verification result provided by the framework provider 507 and send a prompt message to the developer 508 corresponding to the service program based on the verification result.

[0135] Of course, the control terminal 506 can also build test cases for the microservice framework based on usage information and upgrade requirements. In addition, the control terminal 506 can also send risk notifications to the developer 508 of the service program if it determines that there is a risk of misuse of the application program interface based on usage information and risk conditions.

[0136] In this embodiment, the server running the microservice application can execute the collection instructions sent by the user through the scheduling end, and non-invasively inject the collection program issued by the scheduling end into the microservice application while the microservice application is running. Then, the collection program is run to use the collection program to collect the static code and dynamic code of the microservice application during its runtime, and the static code and dynamic code are decompiled to obtain the target source code. The control end performs semantic analysis on the target source code to obtain code features, and verifies the target program based on the code features. Since static code and dynamic code are collected at the same time, a more comprehensive code analysis can be performed, and more comprehensive and accurate code features can be obtained, thereby improving the accuracy of verifying the target program using code features. In addition, by collecting code using non-invasive injection, the required data can be collected comprehensively and accurately without affecting the operation of the microservice application, thereby improving the efficiency and quality of collection.

[0137] Furthermore, framework providers can comprehensively monitor API usage based on code characteristics, enabling targeted verification of the microservice framework's compatibility and stability. Service developers can also improve API usage based on risk notifications to reduce the risk of misuse. The control side can also build test cases to further ensure the compatibility and stability of the microservice framework.

[0138] Figure 6 This is a schematic diagram of a program processing device according to an embodiment of the present application. The method and device include:

[0139] The acquisition module 601 is used to acquire static code and dynamic code of the target program when it is running using an acquisition program;

[0140] The decompile module 602 is used to decompile the static code and the dynamic code to obtain the target source code.

[0141] The target source code can be used for semantic analysis to obtain code features, which can be used to verify the target program.

[0142] In some embodiments, as an optional method, the device can perform semantic analysis on the target source code to obtain code features; and send the code features to the control end so that the control end can verify the target program based on the code features.

[0143] Since semantic analysis of the target source code usually requires a lot of resources, as another optional method, the device can send the target source code to the control end, so that the control end can perform semantic analysis on the target source code to obtain code features, and verify the target program based on the code features.

[0144] Figure 6 The program processing device can execute Figure 1 The implementation principle and technical effects of the program processing method described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the program processing device in the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated here.

[0145] Figure 7 This is a schematic diagram of a program processing device according to an embodiment of the present application. The method and device include:

[0146] Determining module 701, used to determine the target source code of the target program;

[0147] The analysis module 702 is used to perform semantic analysis on the target source code to obtain code features.

[0148] In some embodiments, the apparatus may further include a verification processing module, which may be configured to perform verification processing on the target program based on code features.

[0149] In some embodiments, the analysis module performs semantic analysis on the target source code, and obtaining code features may include: detecting target information in the target source code that meets sensitivity requirements; deleting the target information or replacing the target information with preset information to update the target source code; and performing semantic analysis on the updated target source code to obtain code features.

[0150] In some embodiments, the target program may be a microservice application.

[0151] Since a service program may involve multiple microservice applications, the verification processing module verifies the target program based on code features, which may include: determining the code features corresponding to the multiple microservice applications divided by the service program; archiving the code features corresponding to the multiple microservice applications to obtain the code features corresponding to the service program; and verifying the service program based on the code features corresponding to the service program.

[0152] Archiving code features corresponding to multiple microservice applications can, for example, include merging code features that meet similar conditions and then archiving them to obtain code features corresponding to the service programs. For example, similar conditions can include variables and function names with identical semantics, similar control flows and logical structures, and code blocks and functions with identical functionality or behavior. This simplifies the code feature representation, reduces redundancy and noise, and helps users better understand the source code.

[0153] In actual applications, the microservice framework will provide a lot of flexible APIs for users to use, and the codes of the programs developed by users are also deeply integrated with the microservice framework. As a result, when the microservice framework needs to be upgraded, due to the large number of API usage methods, the framework provider has no way of knowing which API is used, and thus cannot specifically verify the upgrade compatibility of the microservice framework, which brings a greater stability risk. In addition, the framework provider will often set API usage rules to regulate user usage methods, etc. It is also important to promptly notify users of the risk of misuse. Therefore, in some embodiments, the above-mentioned code features may include API usage information provided by the microservice framework.

[0154] The usage information may include, for example, the API name, the number of times the API is used, the way the API is used, such as in which functional modules it is used, etc. The archiving of the code features may include statistics on the number of times the API is used, etc.

[0155] As an optional implementation, the verification module can verify the service program based on the corresponding code features. This can include: providing usage information to the microservice framework provider for verification; receiving the verification results from the framework provider, and sending a prompt message to the developer of the service program based on the verification results. Through this implementation, the framework provider can fully understand the usage of the application program interface and perform targeted verification of the compatibility and stability of the microservice framework.

[0156] As another optional implementation, the verification processing module verifies the service program based on the code features corresponding to the service program, which may include: building test cases for the microservice framework based on usage information and upgrade requirements.

[0157] As another optional implementation method, the verification processing module verifies the service program based on the code features corresponding to the service program, which may include: based on usage information, if it is determined that there is a risk of misuse of the application program interface, sending a risk notification to the developer corresponding to the service program.

[0158] Alternatively, whether the application has an interface misuse risk may be determined by judging whether the usage information satisfies a risk condition.

[0159] Optionally, the device can perform code acquisition on the target program multiple times, thereby combining the current usage information and historical usage information of the service program to determine whether there is a risk of API misuse. The service program may be considered to be at risk of misuse if the usage information meets the risk condition multiple times or a specified number of times.

[0160] Figure 7 The program processing device can execute Figure 2 The implementation principle and technical effects of the program processing method described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the program processing device in the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated here.

[0161] Figure 8 This is a schematic diagram of a program processing device according to an embodiment of the present application. The method and device include:

[0162] Acquisition module 801, used to acquire the acquisition program;

[0163] Injection module 802, used for injecting the acquisition program into the target program without intrusion;

[0164] The running module 803 is used to run the acquisition program to use the acquisition program to collect the static code and dynamic code of the target program during operation, and decompile the static code and dynamic code to obtain the target source code; wherein, the target source code is used for semantic analysis to obtain code features; the code features are used to verify the target program.

[0165] In some embodiments, the acquisition module acquiring the acquisition program may include: acquiring the acquisition program sent by the scheduling end, wherein the acquisition program is provided by the user to the scheduling end.

[0166] In some embodiments, the injection module non-invasively injecting the acquisition program into the target program may include: loading an agent tool; and non-invasively injecting the acquisition program into the target program using the agent tool.

[0167] Figure 8 The program processing device can execute Figure 3 The implementation principle and technical effects of the program processing method described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the program processing device in the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated here.

[0168] Figure 9 This is a schematic diagram of a program processing device according to an embodiment of the present application. The method and device include:

[0169] The response module 901 is configured to determine a user-provided collection program in response to a collection instruction.

[0170] The sending module 902 is used to send a collection program to at least one server so that the server can inject the collection program into the target program non-invasively to collect the static code and dynamic code of the target program, and decompile the static code and dynamic code to obtain the target source code; wherein, the target source code is used for semantic analysis to obtain code features; the code features are used to verify the target program.

[0171] Figure 9 The program processing device can execute Figure 4 The implementation principle and technical effects of the program processing method described in the illustrated embodiment will not be described in detail. The specific manner in which each module and unit performs operations in the program processing device in the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated here.

[0172] The present application also provides a computing device, such as Figure 10 As shown, the device may include a storage component 1001 and a processing component 1002;

[0173] The storage component 1001 stores one or more computer instructions, wherein the one or more computer instructions are called and executed by the processing component to implement the following Figure 1 or Figure 2 or Figure 3 or Figure 4 The program processing method described in the illustrated embodiment.

[0174] Of course, a computing device may also include other components, such as input / output interfaces, display components, communication components, etc.

[0175] The input / output interface provides an interface between the processing component and peripheral interface modules, which may be output devices, input devices, etc. The communication component is configured to facilitate wired or wireless communication between the computing device and other devices.

[0176] The processing component 1002 may include one or more processors to execute computer instructions to complete all or part of the steps in the above method. Of course, the processing component may also be implemented as one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above method.

[0177] The storage component 1001 is configured to store various types of data to support operations at the terminal. The storage component can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0178] The display component may be an electroluminescent (EL) element, a liquid crystal display or a micro display having a similar structure, or a direct retinal display or a similar laser scanning display.

[0179] It should be noted that the computing device can be a physical device or an elastic computing host provided by a cloud computing platform, etc. It can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.

[0180] It should be noted that the above computing device is implemented as follows Figure 1 or Figure 2 or Figure 3 or Figure 4 In the case of the program processing method described in the illustrated embodiment, it can be a physical device or an elastic computing host provided by a cloud computing platform, etc. It can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device.

[0181] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program can achieve the above-mentioned Figure 1 or Figure 2 or Figure 3 or Figure 4 The program processing method described in the illustrated embodiment. The computer-readable medium may be included in the electronic device described in the above embodiment, or may exist independently without being incorporated into the electronic device.

[0182] The present application also provides a computer program product, which includes a computer program carried on a computer-readable storage medium. When the computer program is executed by a computer, the computer program can achieve the above-mentioned Figure 1 or Figure 2 or Figure 3 or Figure 4 The program processing method described in the illustrated embodiment. In such an embodiment, the computer program can be downloaded and installed from a network and / or installed from a removable medium. When the computer program is executed by the processor, the various functions defined in the system of the present application are performed.

[0183] In the above corresponding embodiments, the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or device.

[0184] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0185] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0186] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A program processing method, characterized in that: include: Using a collection program to collect static code and dynamic code of a target program when it is running; wherein the collection program is injected into the target program without intrusion; Decompiling the static code and the dynamic code to obtain target source code; The target source code is used for semantic analysis to obtain code features.

2. The method according to claim 1, characterized in that Also includes: The target source code is sent to a control end, so that the control end performs semantic analysis on the target source code to obtain code features, and performs verification processing on the target program based on the code features.

3. The method according to claim 2, characterized in that Also includes: Performing semantic analysis on the target source code to obtain code features; The code features are sent to a control terminal, so that the control terminal can verify the target program based on the code features.

4. A program processing method, characterized in that: include: Determine the target source code of the target program; The target source code is obtained by decompiling static code and dynamic code collected when the target program is running; The static code and the dynamic code are acquired by a collection program that is non-invasively injected into the target program; Perform semantic analysis on the target source code to obtain code features.

5. The method according to claim 4, characterized in that Also includes: Based on the code features, the target program is verified.

6. The method according to claim 4, characterized in that The performing semantic analysis on the target source code to obtain code features includes: detecting target information meeting sensitive requirements in the target source code; Deleting the target information or replacing the target information with preset information to update the target source code; Perform semantic analysis on the updated target source code to obtain code features.

7. The method according to claim 5, characterized in that The target program is a microservice application; The verifying process on the target program based on the code features includes: Determine the code features corresponding to the multiple microservice applications divided by the service program; Archiving the code features corresponding to the multiple microservice applications to obtain the code features corresponding to the service program; The service program is verified based on the code features corresponding to the service program.

8. The method according to claim 7, characterized in that The code features include usage information of the application program interface provided by the microservice framework; The verifying process on the service program based on the code feature corresponding to the service program includes: Providing the usage information to a framework provider of the microservice framework, so that the framework provider verifies the usage information, receives a verification result provided by the framework provider, and sends a prompt message to the developer corresponding to the service program based on the verification result; or, Based on the usage information and upgrade requirements, build test cases for the microservice framework; or, If it is determined based on the usage information that there is a risk of misuse of the application program interface, a risk notification is sent to the developer corresponding to the service program.

9. A program processing method, characterized in that: include: Obtain acquisition procedures; Injecting the acquisition program into the target program without intrusion; The acquisition program is run to use the acquisition program to acquire static code and dynamic code of the target program during operation, and the static code and the dynamic code are decompiled to obtain target source code; wherein the target source code is used for semantic analysis to obtain code features.

10. The method according to claim 9, characterized in that The non-invasive injection of the acquisition program into the target program comprises: Load the proxy tool; The agent tool is used to inject the acquisition program into the target program without intrusion.

11. The method according to claim 9, characterized in that The acquisition and collection procedure includes: Obtaining a collection program issued by a dispatching terminal; the collection program is provided by a user to the dispatching terminal.

12. A program processing method, characterized in that: include: In response to the collection instruction, determining a collection program provided by the user; The acquisition program is sent to at least one server so that the server non-invasively injects the acquisition program into a target program to acquire static code and dynamic code of the target program, and decompiles the static code and the dynamic code to obtain a target source code; wherein the target source code is used for semantic analysis to obtain code features.

13. A computing device, characterized in that It includes a processing component and a storage component; the storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the program processing method according to any one of claims 1 to 3, the program processing method according to any one of claims 4 to 8, the program processing method according to any one of claims 9 to 11, or the program processing method according to claim 12.

14. A computer storage medium, characterized in that A computer program is stored, and when the computer program is executed by a computer, the program processing method according to any one of claims 1 to 3, the program processing method according to any one of claims 4 to 8, the program processing method according to any one of claims 9 to 11, or the program processing method according to claim 12 is implemented.

15. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a computer, implements the program processing method according to any one of claims 1 to 3, the program processing method according to any one of claims 4 to 8, the program processing method according to any one of claims 9 to 11, or the program processing method according to claim 12.