Software component analysis method, device and equipment and storage medium
By constructing abstract syntax tree AST and control flow graph CFG, the third-party components introduced and called in the software are analyzed, and the problem of high false positive rates in the existing technology is solved, and the accurate assessment of software security risks is achieved.
Patent Information
- Application Number
- CN202410965357.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-12
AI Technical Summary
Existing software component analysis methods determine the third-party components used in the software through the third-party components introduced in the construction file. It is easy to cause false alarms due to missing construction files or inaccurate information, and it is impossible to accurately determine whether the third-party components are actually called by the software.
By constructing an abstract syntax tree AST and control flow diagram CFG, we determine the third-party components introduced in the project and the third-party components directly called, and determine whether they are actually called by the software to reduce false positives.
It improves the accuracy of third-party component analysis, reduces the occurrence of false positives, and ensures an effective assessment of software security risks.
Smart Images

Figure CN118939311A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network technology and security, and in particular to a software component analysis method, device, equipment and storage medium. Background Art
[0002] The software composition analysis method (SCA) can discover third-party components used in the software. The above-mentioned third-party components refer to code libraries that are not developed by the core development team but created and released by other developers or organizations. They are usually used to provide various functions, including simple string processing, complex machine learning algorithms, and interaction with various hardware devices. The security risks of the software are judged by matching the third-party components used in the software with the vulnerability library. Therefore, the accuracy of SCA in discovering third-party components is the basis for its discovery of security risks.
[0003] Existing software component analysis methods mainly determine the third-party components used in the software through the third-party components introduced in the project's build file, but this method will bring the following problems: if the build file in the project is missing, the third-party components cannot be obtained; if the information of the third-party components contained in the build file is inaccurate, it will cause errors in the obtained third-party components. Even if the information of the third-party components contained in the build file is accurate, the third-party components may be introduced but not triggered or used in the actual process; therefore, the existing software component analysis (SCA) method will cause more false alarms. Summary of the invention
[0004] The present application provides a software component analysis method, apparatus, device and storage medium, which are used to determine the third-party components introduced into the project and the third-party components directly called through the abstract syntax tree AST and the control flow graph CFG, and finally determine whether the above-mentioned third-party components are actually called by the software, thereby reducing the occurrence of false alarms.
[0005] In a first aspect, the present application provides a software component analysis method, comprising:
[0006] Building an abstract syntax tree AST according to the project source code, and obtaining a first component according to the AST, wherein the first component includes a third-party component introduced into the project;
[0007] Build a control flow graph CFG according to the jump and call instructions and extract a function call stack, and obtain a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project;
[0008] If the first component and the second component are the same, determining the target component according to the first component or the second component;
[0009] In one or more possible embodiments, it further includes:
[0010] If the first component and the second component are not the same, determining at least one specific component included in the first component but not included in the second component;
[0011] When it is determined that the at least one specific component meets a preset condition, the at least one specific component is used as a component indirectly called during the execution of the project;
[0012] A target component is determined according to the second component and the indirectly called component.
[0013] In one or more possible embodiments, when determining that the at least one specific component meets a preset condition, using the at least one specific component as a component indirectly called during the project execution process includes:
[0014] Determining whether the at least one specific component includes an initialization file of executable code;
[0015] If so, the at least one specific component is used as a component indirectly called during the project execution process; otherwise, the at least one specific component is excluded.
[0016] In one or more possible embodiments, determining the target component according to the second component and the indirectly called component includes:
[0017] According to a preset system component list, excluding system components in the second component;
[0018] The second component excluding the system component and the indirectly called components are taken as target components.
[0019] In one or more possible embodiments, determining the target component according to the first component or the second component includes:
[0020] According to a preset system component list, excluding system components in the first component or the second component;
[0021] The first component or the second component excluding the system component is used as a target component.
[0022] In one or more possible embodiments, obtaining the first component according to the AST includes:
[0023] Get the called function in the AST;
[0024] The preset keyword is matched with the called function, and the first component is determined according to the called function that is successfully matched.
[0025] In a second aspect, the present application provides a software component analysis device, comprising:
[0026] A first component determination module is used to construct an abstract syntax tree AST according to the project source code, and obtain a first component according to the AST, wherein the first component includes a third-party component introduced into the project;
[0027] A second component determination module is used to construct a control flow graph CFG according to jump and call instructions and extract a function call stack, and obtain a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project;
[0028] a direct target component determination module, configured to determine a target component according to the first component or the second component if the first component and the second component are the same;
[0029] In one or more possible embodiments, it further includes:
[0030] an indirect target component determination module, configured to determine at least one specific component included in the first component but not included in the second component if the first component and the second component are not the same;
[0031] When it is determined that the at least one specific component meets a preset condition, the at least one specific component is used as a component indirectly called during the execution of the project;
[0032] A target component is determined according to the second component and the indirectly called component.
[0033] In one or more possible embodiments, the indirect target component determination module is specifically configured to:
[0034] Determining whether the at least one specific component includes an initialization file of executable code;
[0035] If so, the at least one specific component is used as a component indirectly called during the project execution process; otherwise, the at least one specific component is excluded.
[0036] In one or more possible embodiments, the indirect target component determination module is specifically configured to: exclude system components in the second component according to a preset system component list;
[0037] The second component excluding the system component and the indirectly called components are taken as target components.
[0038] In one or more possible embodiments, the direct target component determination module is specifically used to:
[0039] According to a preset system component list, excluding system components in the first component or the second component;
[0040] The first component or the second component excluding the system component is used as a target component.
[0041] In one or more possible embodiments, the first component determination module is specifically configured to:
[0042] Get the called function in the AST;
[0043] The preset keyword is matched with the called function, and the first component is determined according to the called function that is successfully matched.
[0044] In a third aspect, the present application provides a software component analysis device, the device comprising:
[0045] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method as described in any one of the first aspects.
[0046] In a fourth aspect, the present application further provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is used to enable a computer to execute any method as described in the first aspect.
[0047] According to a software component analysis method, device, equipment and storage medium provided in the present application, it is used to determine the third-party components introduced into the project and the third-party components directly called through the abstract syntax tree AST and the control flow graph CFG, and finally determine whether the above-mentioned third-party components are actually called by the software, thereby reducing the occurrence of false alarms. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application, and do not constitute an improper limitation on the present application.
[0049] Figure 1 A flowchart of a software component analysis method provided according to an embodiment;
[0050] Figure 2 A flowchart of a detailed software component analysis method provided according to an embodiment;
[0051] Figure 3 A module diagram of a software component analysis device provided according to an embodiment;
[0052] Figure 4 A module diagram of a software component analysis device provided according to an embodiment;
[0053] Figure 5 A module diagram of a storage medium provided according to an embodiment. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0056] Furthermore, in the description of the embodiments of the present application, unless otherwise specified, “ / ” means or. For example, A / B can mean A or B. The “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0057] The following is an introduction to the professional terms involved in this application:
[0058] SCA (Software Composition Analysis): Software composition analysis is a technology that identifies, analyzes, and tracks the components of binary software. It can discover third-party components used in the software, and then determine the security risks of the software by matching vulnerability libraries and other information.
[0059] AST (Abstract Syntax Tree) is a tree representation of the abstract syntax structure of a text (usually source code) written in a formal language. Each node in the tree represents a structure in the source code. This tree structure plays an important role in the source code analysis process of compilers and interpreters.
[0060] CFG (Control Flow Graph) is an abstract representation of a process or program. It is an abstract data structure used in the compiler and maintained internally by the compiler. It represents all the paths that will be traversed during the execution of a program. It represents the possible flow of execution of all basic blocks in a process in the form of a graph, and can also reflect the real-time execution process of a process.
[0061] The existing software component analysis method mainly determines the third-party components used in the software through the third-party components introduced in the project's build file, but this method will bring the following problems: if the build file in the project is missing, the third-party components cannot be obtained; if the information of the third-party components contained in the build file is inaccurate, it will cause errors in the obtained third-party components. Even if the information of the third-party components contained in the build file is accurate, the third-party components may be introduced but not triggered or used in the actual process; therefore, the existing software component analysis SCA method will cause more false alarms; based on the above problems, the present application provides a software component analysis method, apparatus, equipment and storage medium, which are used to form an abstract syntax tree AST through static code analysis, and then cover various package introduction methods of Python according to specific keywords to obtain the introduced third-party components, and finally determine whether the above-mentioned third-party components are actually called by the software, which can reduce the occurrence of false alarms.
[0062] Example 1
[0063] This application provides a software component analysis method, such as Figure 1 As shown, including:
[0064] Step 101, constructing an abstract syntax tree AST according to the project source code, and obtaining a first component according to the AST, wherein the first component includes a third-party component introduced into the project;
[0065] In one or more possible embodiments, the process of constructing an abstract syntax tree AST based on the project source code is as follows: first, obtain the project software package, decompress the project software package, obtain the project source code, and then perform static analysis on the project source code to construct the abstract syntax tree AST; and obtain the called function in the AST based on the AST, and determine the first component based on preset keywords and the called function; for example, use find_module, exec, execfile, import, from import, __import__, importlib, import_module and other functions as keywords, match the preset keywords with the called functions, and determine the first component based on the called functions that are successfully matched, the first component includes third-party components introduced in the project, and the introduced third-party components can be divided into three types, namely, third-party components that are introduced but not called, third-party components that are introduced and directly called, and components that are introduced and indirectly called.
[0066] In one or more possible embodiments, the present application takes Python as an example, for example, according to the above AST, the function called in the above AST is obtained, and according to the preset keywords and the called function, the first component is determined to be time, requests and matplotlib.
[0067] Step 102, constructing a control flow graph CFG according to the jump and call instructions and extracting a function call stack, and obtaining a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project;
[0068] In one or more possible embodiments, a control flow graph CFG is constructed according to jump and call instructions and a function call stack is extracted. For example, the function call stack is requests.get()->response.text->print()->time.sleep(), and the second component is determined to be time and requests.
[0069] Step 103, if the first component and the second component are the same, determining a target component according to the first component or the second component;
[0070] In one or more possible embodiments, if the first component is time, requests and matplotlib, and the second component is time and requests, it is determined that the first component and the second component are not the same; if the first component is time, requests and the second component is time and requests, it is determined that the first component and the second component are the same, and the target component can be determined according to the first component or the second component;
[0071] In one or more possible embodiments, the first component also includes a system component, and the second component also includes a system component; taking the first component as time and requests, and the second component as time and requests as an example, the time component is determined as the system component according to the preset system component list, and the first component excluding the system component or the second component excluding the system component is used as the target component, that is, the target component is requests.
[0072] In one or more possible embodiments, it also includes: if the first component and the second component are not the same, determining at least one specific component included in the first component but not included in the second component; when determining that the at least one specific component meets a preset condition, using the at least one specific component as a component indirectly called during project execution; determining a target component based on the second component and the indirectly called component.
[0073] In one or more possible embodiments, taking the above-mentioned first component as time, requests and matplotlib, and the second component as time and requests as an example, it is determined that the above-mentioned first component and the second component are not the same, and at least one specific component included in the above-mentioned first component but not included in the second component is determined, that is, matplotlib; the above-mentioned specific component that meets the preset conditions refers to the initialization file containing executable code in the above-mentioned specific component. If the specific component does not contain executable code, it is determined that the specific component does not meet the preset file; due to the characteristics of Python, component packages that are introduced but not directly used may also be at risk. If the __init__.py initialization file contained in the third-party component contains executable code lines of code, it will still be run by the project, and it does not necessarily need to be executed directly in the code. That is to say, if the __init__.py initialization file contained in the third-party component has executable code and is included in the specific component matplotlib, then it is equivalent to that this specific component matplotlib will be called indirectly. Therefore, by identifying specific files such as __init__.py in the package, after removing comments, blank lines and other contents, once there is executable code, the component matplotlib is also considered to be indirectly called by the project; in this example, the __init__.py initialization file of the matplotlib component has executable code, so it is determined that the matplotlib component is called indirectly.
[0074] In one or more possible embodiments, taking the example of the first component being time, requests and matplotlib and the second component being time and requests, at least one specific component matplotlib included in the first component but not included in the second component is determined, and it is determined that there is executable code in the __init__.py initialization file of the matplotlib component, and, according to the preset system component list, the system component time in the second component is excluded, and the second component excluding the system component and the indirectly called components are taken as target components, and the target components finally obtained are requests and matplotlib.
[0075] This application provides a software component analysis method, such as Figure 2 As shown, including:
[0076] Step 201, constructing an abstract syntax tree AST according to the project source code, and obtaining a first component according to the AST, wherein the first component includes third-party components and system components introduced into the project;
[0077] Step 202, constructing a control flow graph CFG according to the jump and call instructions and extracting a function call stack, and obtaining a second component according to the function call stack, wherein the second component includes a third-party component and a system component that are directly called during the execution of the project;
[0078] Step 203, determining whether the first component and the second component are the same, if yes, executing step 204, if no, executing step 205;
[0079] Step 204, according to the preset system component list, exclude the system components in the first component and the second component; and use the first component excluding the system component or the second component excluding the system component as the target component;
[0080] Step 205, determining at least one specific component included in the first component but not included in the second component, and determining whether any specific component contains an initialization file of executable code, if so, executing step 207, if not, executing step 206;
[0081] Step 206, exclude any of the above specific components, and execute step 208;
[0082] Step 207, determining that any of the above-mentioned specific components is a component indirectly called during the project execution process, and executing step 208;
[0083] Step 208: according to the preset system component list, exclude the system components in the second component; and use the second component excluding the system components and the indirectly called components as target components.
[0084] According to a software component analysis method provided by the present application, the third-party components introduced into the project and the third-party components directly called are determined through the abstract syntax tree AST and the control flow graph CFG, and finally it is determined whether the above-mentioned third-party components are actually called by the software, thereby reducing the occurrence of false alarms.
[0085] Example 2
[0086] The present application also provides a software analysis device, such as Figure 3 As shown, including:
[0087] A first component determination module 301 is used to construct an abstract syntax tree AST according to the project source code, and obtain a first component according to the AST, wherein the first component includes a third-party component introduced into the project;
[0088] A second component determination module 302 is used to construct a control flow graph CFG according to jump and call instructions and extract a function call stack, and obtain a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project;
[0089] A direct target component determination module 303 is used to determine a target component according to the first component or the second component if the first component and the second component are the same;
[0090] In one or more possible embodiments, the system further includes: an indirect target component determination module 304, which is used to:
[0091] If the first component and the second component are not the same, determining at least one specific component included in the first component but not included in the second component;
[0092] When it is determined that the at least one specific component meets the preset condition, the at least one specific component is used as a component indirectly called during the project execution process;
[0093] The target component is determined according to the second component and the indirectly called component.
[0094] In one or more possible embodiments, the indirect target component determination module 304 is specifically configured to:
[0095] Determining whether the at least one specific component contains an initialization file of executable code;
[0096] If so, the at least one specific component is used as a component indirectly called during the project execution process; otherwise, the at least one specific component is excluded.
[0097] In one or more possible embodiments, the indirect target component determination module 304 is specifically configured to: exclude the system components in the second component according to a preset system component list;
[0098] The second component excluding the above system components and the components that are indirectly called are taken as target components.
[0099] In one or more possible embodiments, the direct target component determination module 303 is specifically configured to:
[0100] According to a preset system component list, exclude system components in the first component or the second component;
[0101] The first component or the second component excluding the above-mentioned system components is used as a target component.
[0102] In one or more possible embodiments, the first component determination module 301 is specifically configured to:
[0103] Get the called function in the above AST;
[0104] The preset keyword is matched with the above-mentioned called function, and the first component is determined according to the called function that is successfully matched.
[0105] Example 3
[0106] The present application also provides a software analysis device, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above-mentioned method of software component analysis.
[0107] like Figure 4 As shown, the device includes a processor 401, a memory 402, a communication interface 403 and a bus 404. The processor 401, the memory 402 and the communication interface 403 are connected to each other via the bus 404.
[0108] The processor 401 is configured to read and execute instructions in the memory 402, so that at least one processor can perform any of the following software component analysis methods:
[0109] Building an abstract syntax tree AST according to the project source code, and obtaining a first component according to the AST, wherein the first component includes a third-party component introduced into the project;
[0110] Constructing a control flow graph CFG according to the jump and call instructions and extracting a function call stack, and obtaining a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project;
[0111] If the first component and the second component are the same, determining the target component according to the first component or the second component;
[0112] In one or more possible embodiments, it further includes:
[0113] If the first component and the second component are not the same, determining at least one specific component included in the first component but not included in the second component;
[0114] When it is determined that the at least one specific component meets the preset condition, the at least one specific component is used as a component indirectly called during the project execution process;
[0115] The target component is determined according to the second component and the indirectly called component.
[0116] In one or more possible embodiments, when it is determined that the at least one specific component meets a preset condition, the at least one specific component is used as a component indirectly called during the project execution process, including:
[0117] Determining whether the at least one specific component contains an initialization file of executable code;
[0118] If so, the at least one specific component is used as a component indirectly called during the project execution process; otherwise, the at least one specific component is excluded.
[0119] In one or more possible embodiments, the step of determining the target component according to the second component and the indirectly called component includes:
[0120] According to the preset system component list, exclude the system components in the second component;
[0121] The second component excluding the above system components and the components that are indirectly called are taken as target components.
[0122] In one or more possible embodiments, determining the target component according to the first component or the second component includes:
[0123] According to a preset system component list, exclude system components in the first component or the second component;
[0124] The first component or the second component excluding the above-mentioned system components is used as a target component.
[0125] In one or more possible embodiments, obtaining the first component according to the AST includes:
[0126] Get the called function in the above AST;
[0127] The preset keyword is matched with the above-mentioned called function, and the first component is determined according to the called function that is successfully matched.
[0128] The memory 402 is used to store various instructions and programs of the software component analysis method provided in the above embodiment.
[0129] The bus 404 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0130] The processor 401 may be a central processing unit (CPU), a network processor (NP), a graphic processing unit (GPU), or any combination of CPU, NP, and GPU. It may also be a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0131] Example 4
[0132] In addition, the present application also provides a computer-readable storage medium, such as Figure 5 As shown, the computer storage medium stores a computer program, and the computer program is used to enable a computer to execute any one of the methods in the above embodiments.
[0133] The memory may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 501 and / or a cache memory 502 , and may further include a read-only memory (ROM) 503 .
[0134] The memory may also include a program / utility 505 having a set (at least one) of program modules 504, such program modules 504 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0135] The present application provides a software component analysis method, apparatus, device and storage medium, which are used to determine the third-party components introduced into the project and the third-party components directly called through the abstract syntax tree AST and the control flow graph CFG, and finally determine whether the above-mentioned third-party components are actually called by the software, thereby reducing the occurrence of false alarms.
[0136] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0137] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0138] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0139] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0140] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A software component analysis method, characterized in that: include: Building an abstract syntax tree AST according to the project source code, and obtaining a first component according to the AST, wherein the first component includes a third-party component introduced into the project; Build a control flow graph CFG according to the jump and call instructions and extract a function call stack, and obtain a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project; If the first component and the second component are the same, a target component is determined according to the first component or the second component.
2. The method according to claim 1, characterized in that Also includes: If the first component and the second component are not the same, determining at least one specific component included in the first component but not included in the second component; When it is determined that the at least one specific component meets a preset condition, the at least one specific component is used as a component indirectly called during the execution of the project; A target component is determined according to the second component and the indirectly called component.
3. The method according to claim 2, characterized in that When determining that the at least one specific component meets a preset condition, using the at least one specific component as a component indirectly called during the project execution process includes: Determining whether the at least one specific component includes an initialization file of executable code; If so, the at least one specific component is used as a component indirectly called during the project execution process; otherwise, the at least one specific component is excluded.
4. The method according to claim 2, characterized in that: The step of determining the target component according to the second component and the indirectly called component includes: According to a preset system component list, excluding system components in the second component; The second component excluding the system component and the indirectly called components are taken as target components.
5. The method according to claim 1, characterized in that The determining the target component according to the first component or the second component includes: According to a preset system component list, excluding system components in the first component or the second component; The first component or the second component excluding the system component is used as a target component.
6. The method according to claim 1, characterized in that The obtaining the first component according to the AST includes: Get the called function in the AST; The preset keyword is matched with the called function, and the first component is determined according to the called function that is successfully matched.
7. A software analysis device, characterized in that: include: A first component determination module is used to construct an abstract syntax tree AST according to the project source code, and obtain a first component according to the AST, wherein the first component includes a third-party component introduced into the project; A second component determination module is used to construct a control flow graph CFG according to jump and call instructions and extract a function call stack, and obtain a second component according to the function call stack, wherein the second component includes a third-party component that is directly called during the execution of the project; A direct target component determination module is used to determine a target component based on the first component or the second component if the first component and the second component are the same.
8. The device according to claim 7, characterized in that Also includes: an indirect target component determination module, configured to determine at least one specific component included in the first component but not included in the second component if the first component and the second component are not the same; When it is determined that the at least one specific component meets a preset condition, the at least one specific component is used as a component indirectly called during the execution of the project; A target component is determined according to the second component and the indirectly called component.
9. A software analysis device, characterized in that: The device comprises: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute any one of the methods of claims 1-6.
10. A computer storage medium, characterized in that: The computer storage medium stores a computer program, and the computer program is used to make a computer execute any one of the methods according to claims 1-6.
