Application API classification method, device, equipment and storage medium

By extracting and grading data tables, fields and operation information in SQL statements, combining the call chain analysis of the hierarchical tags of the associated application, and calculating the hierarchical tags of the target application API, the problem of low grading efficiency of existing APIs is solved and a more efficient and accurate grading process is achieved.

CN119739732APending Publication Date: 2025-04-01WEIKUN (SHANGHAI) TECH SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411838391.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

Currently, the grading efficiency of applied APIs is low, and existing methods such as log analysis and traffic analysis are time-consuming and costly.

Method used

By obtaining the SQL statements for the target application to access the preset database, extracting data table information, field information and operation information, and grading these information, combining the call chain information to analyze the hierarchical tags of the associated application, and finally calculating the hierarchical tags of each API of the target application.

Benefits of technology

Eliminate existing code or use additional traffic to uninstall devices, simplifying the development process and improving the efficiency and accuracy of API grading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739732A_ABST
    Figure CN119739732A_ABST
Patent Text Reader

Abstract

The present invention relates to data security technology, and discloses a method for grading an application API, including: obtaining an SQL statement for a target application to access a database; extracting data table information, field information, and operation information in the SQL statement; grading the data tables and fields corresponding to the operation information, data table information, and field information in the database, respectively, to obtain operation information grading labels, data table grading labels, and field grading labels; obtaining call chain information of the target application, and analyzing the grading labels of associated applications based on the call chain information; and calculating the grading labels of each API of the target application based on the operation information grading label, data table grading label, field grading label, and grading label of associated applications. In addition, the present invention also relates to blockchain technology, and the data table can be stored in a node of the blockchain. The present invention also proposes an application API grading device, an electronic device, and a storage medium. The present invention can improve the grading efficiency of application APIs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data security technology, and in particular to a classification method, device, electronic device and computer-readable storage medium for application APIs. Background Art

[0002] With the development of mobile Internet and Internet of Things, application development is deeply dependent on the mutual calls between application programming interfaces (APIs). With the widespread application of APIs, the amount of transmitted data continues to grow, and the sensitivity of transmitted data varies. Strengthening API security has become a key task for enterprise data security. However, to establish an API security management system, it is first necessary to identify important and critical APIs by grading application APIs.

[0003] There are two main ways to classify application APIs at present: 1. Log analysis: uniformly transform the code into a point-of-interest, record the logs in a unified log format, and analyze the log records to obtain the hierarchical and graded labels of the application APIs. This process takes a long time to promote and is difficult. 2. Traffic analysis: SSL decryption of traffic is performed through traffic offloading devices, and the traffic packets of the application APIs are aggregated and collected on the collection server. The traffic packets are analyzed to obtain the hierarchical and graded labels of the application APIs. The entire process is time-consuming and costly.

[0004] In summary, the current grading efficiency of application APIs needs to be improved urgently. Summary of the invention

[0005] The present invention provides a method, device and computer-readable storage medium for grading application APIs, the main purpose of which is to solve the problem of low efficiency in grading application APIs.

[0006] To achieve the above object, the present invention provides a method for grading application APIs, comprising:

[0007] Obtain the SQL statement used by the target application to access the preset database;

[0008] Extracting data table information, field information and operation information in the SQL statement;

[0009] Respectively classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information classification labels, data table classification labels and field classification labels;

[0010] Acquire call chain information of the target application, and analyze the hierarchical labels of associated applications corresponding to the target application according to the call chain information;

[0011] The classification labels of each API of the target application are calculated according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

[0012] Optionally, extracting data table information, field information, and operation information in the SQL statement includes:

[0013] Convert the string information of the SQL statement into a symbol stream through a pre-built lexical analyzer;

[0014] Generate a syntax tree based on the symbol stream using a pre-built syntax analyzer;

[0015] Using a compiler to parse the syntax tree to obtain an abstract syntax tree;

[0016] Extracting metadata information from the abstract syntax tree;

[0017] Data table information, field information and operation information are extracted from the metadata information.

[0018] Optionally, the step of respectively grading the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information grading labels, data table grading labels and field grading labels includes:

[0019] According to the data table information and the field information, mapping the corresponding data table and field in the preset database;

[0020] Quantizing the operation information, the data table and the field to obtain an operation information text vector, a data table text vector and a field text vector;

[0021] The operation information text vector, the data table text vector and the field text vector are respectively classified using a pre-built random forest classification model to obtain operation information classification labels, data table classification labels and field classification labels.

[0022] Optionally, the using a pre-built random forest classification model to classify the operation information text vector to obtain the operation information classification label includes:

[0023] Splitting the operation information text vector into a field-level operation function text vector and an action function text vector;

[0024] According to a preset rule, different weight parameters are assigned to the field-level operation function text vector and the action function text vector;

[0025] Based on the field-level operation function text vector and the action function text vector with weight parameters, the operation information is classified using a pre-built random forest classification model to obtain an operation information classification label.

[0026] Optionally, analyzing, according to the call chain information, a hierarchical label of an associated application corresponding to the target application includes:

[0027] Parsing the call information to obtain the call path of the target application, the call frequency of the associated application API, the call return information and the call operation function;

[0028] Acquire, according to the calling path of the target application, associated applications and preset classification labels of APIs of the associated applications;

[0029] Counting the call frequency of the associated application API that is successful in the call return information to obtain the successful call frequency, and filtering the call operation function whose call return information is successful from the call operation function to obtain the successful operation function;

[0030] The successful call frequency is used as the weight of the successful operation function corresponding to the associated application API, and the pre-built random forest classification model is used to classify the weighted successful operation functions to obtain an operation function classification label;

[0031] The operation function classification label and the API preset classification label are combined to obtain the classification label of the associated application.

[0032] Optionally, the calculating the classification label of each API of the target application according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application includes:

[0033] Setting target weight parameters of the operation information classification label, the data table classification label, the field classification label, and the classification label of the associated application according to a preset weight model;

[0034] According to the target weight parameter, the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application are weighted to obtain the classification label of the target application API.

[0035] Optionally, the acquiring the call chain information of the target application includes:

[0036] Using a preset system to periodically obtain a call chain corresponding to the target application;

[0037] According to the TraceID in the call chain, the call chain information of each call request is extracted.

[0038] In order to solve the above problems, the present invention further provides an application API grading device, the device comprising:

[0039] An SQL statement acquisition module is used to acquire the SQL statement used by the target application to access the preset database;

[0040] SQL statement parsing module, used to extract data table information, field information and operation information in the SQL statement;

[0041] A target application classification module, used to classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database, respectively, to obtain operation information classification labels, data table classification labels and field classification labels;

[0042] An associated application grading module, used to obtain call chain information of the target application, and analyze the grading labels of associated applications corresponding to the target application according to the call chain information;

[0043] The comprehensive module is used to calculate the classification labels of each API of the target application according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

[0044] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0045] at least one processor; and,

[0046] a memory communicatively connected to the at least one processor; wherein,

[0047] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the above-mentioned application API classification method.

[0048] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned application API grading method.

[0049] The embodiment of the present invention obtains the SQL statement for the target application to access the preset database; extracts the data table information, field information and operation information in the SQL statement; respectively classifies the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information classification labels, data table classification labels and field classification labels, and classifies the data tables and fields corresponding to the operation information, data table information and field information parsed from the SQL statement in the preset database to obtain operation information classification labels, data table classification labels and field classification labels, without the need to embed points in the existing code or additional traffic unloading equipment, and the operation information classification labels can be obtained quickly and conveniently. , data table classification labels and field classification labels, thereby improving the classification efficiency of the application API; obtaining the call chain information of the target application, and analyzing the classification labels of the associated applications corresponding to the target application according to the call chain information; calculating the classification labels of each API of the target application according to the operation information classification labels, the data table classification labels, the field classification labels and the classification labels of the associated applications, fully considering the call relationship of the associated applications, the impact of the security level of the operation information on the security classification of the application API, improving the accuracy of the application API classification method, and no need to embed points in the existing code, and no need for additional traffic unloading equipment, reducing the development workload, and improving the classification efficiency of the application API. Therefore, the application API classification method, device, electronic device and computer-readable storage medium proposed in the present invention can solve the problem of low classification efficiency of the application API. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A schematic diagram of a flow chart of a method for grading application APIs provided in one embodiment of the present invention;

[0051] Figure 2 for Figure 1 A schematic diagram of a detailed implementation flow of one of the steps in the grading method of the application API shown;

[0052] Figure 3 for Figure 1 A schematic diagram of a detailed implementation flow of another step in the grading method of the application API shown;

[0053] Figure 4 A functional module diagram of an application API grading device provided by an embodiment of the present invention;

[0054] Figure 5 A schematic diagram of the structure of an electronic device for implementing the application API grading method provided by an embodiment of the present invention.

[0055] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0056] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0057] The embodiment of the present application provides a grading method for an application API. The execution subject of the grading method of the application API includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the grading method of the application API can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can 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 (Content Delivery Network, CDN), and big data and artificial intelligence platforms.

[0058] Reference Figure 1 FIG. 1 is a flow chart of a method for grading application APIs provided in an embodiment of the present invention. In this embodiment, the method for grading application APIs includes:

[0059] S1. Obtain the SQL statement for the target application to access the preset database.

[0060] In the embodiment of the present invention, a preset application performance monitoring system (APM for short) may be used to obtain SQL statements for accessing a preset database.

[0061] In an embodiment of the present invention, the SQL statement is a database query and programming language used to access data and query, update and manage the database.

[0062] S2. Extracting data table information, field information and operation information in the SQL statement.

[0063] In detail, the S2 includes:

[0064] Convert the string information of the SQL statement into a symbol stream through a pre-built lexical analyzer;

[0065] Generate a syntax tree based on the symbol stream using a pre-built syntax analyzer;

[0066] Using a compiler to parse the syntax tree to obtain an abstract syntax tree;

[0067] Extracting metadata information from the abstract syntax tree;

[0068] Data table information, field information and operation information are extracted from the metadata information.

[0069] In the embodiment of the present invention, the lexical analyzer is a program in computer science that converts a character sequence into a word (Token) sequence, analyzes and quantifies meaningless character streams, and translates them into discrete word sequences, including keywords, identifiers, etc.

[0070] Further, in the embodiment of the present invention, the grammatical analyzer (Syntactic analysis, also called Parsing) is a program that analyzes an input text consisting of a word sequence and determines its grammatical structure according to a given formal grammar. Its function is to perform grammar checking on the word sequence and construct a grammar tree consisting of the input word sequence.

[0071] Furthermore, in an embodiment of the present invention, the syntax analyzer performs syntax construction on the word sequences such as keywords and identifiers generated by the lexical analyzer and converts them into a syntax tree. The syntax construction refers to organizing and constructing the word sequences such as keywords and identifiers according to the grammatical meaning of the sequence itself and the relationship between the contexts by the syntax analyzer, and finally generating a syntax tree.

[0072] In the embodiment of the present invention, the metadata is also called intermediary data or relay data, which is data about data. Metadata is potential information, a higher level abstraction about data, and a description of data, including header information, field information, annotation information, operation information, file information, table context information, etc. The header information refers to the first cell information in the data table, and the corresponding data table can be obtained through the header information; the file information refers to the corresponding field information of some files to be scanned. The file information points to an external storage data table that has an association relationship with the data table corresponding to the query range.

[0073] In the embodiment of the present invention, the operation information includes: DML actions and field-level operation functions, wherein the DML actions are, for example, read (SELECT) and change (INSERT / UPDATE / DELETE); the field-level operation functions are, for example, count() functions.

[0074] The embodiment of the present invention parses the SQL query statement to obtain metadata information corresponding to the SQL query statement, wherein the metadata information includes data table information, field information, filter condition information, screening condition information, query condition information, operation information, etc., and extracts the metadata information to obtain data table information, field information and operation information.

[0075] S3. Classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database respectively to obtain operation information classification labels, data table classification labels and field classification labels.

[0076] For details, see Figure 2 As shown, the S3 includes:

[0077] S31, mapping the corresponding data table and field in the preset database according to the data table information and the field information;

[0078] S32, performing quantization processing on the operation information, the data table and the field to obtain an operation information text vector, a data table text vector and a field text vector;

[0079] S33. Use a pre-built random forest classification model to classify the operation information text vector, the data table text vector and the field text vector respectively to obtain an operation information classification label, a data table classification label and a field classification label.

[0080] In the embodiment of the present invention, the random forest classification model (RF) is an algorithm that integrates multiple trees through the idea of ​​ensemble learning, and its basic unit is a decision tree. Taking the classification problem as an example, each decision tree is a classifier. For an input sample, N trees will have N classification results, and the random forest integrates all classification voting results, and designates the category with the most votes as the final output, thereby obtaining the optimal category.

[0081] Furthermore, the use of a pre-built random forest classification model to classify the operation information text vector to obtain an operation information classification label includes:

[0082] Splitting the operation information text vector into a field-level operation function text vector and an action function text vector;

[0083] According to a preset rule, different weight parameters are assigned to the field-level operation function text vector and the action function text vector;

[0084] Based on the field-level operation function text vector and the action function text vector with weight parameters, the operation information is classified using a pre-built random forest classification model to obtain an operation information classification label.

[0085] In the embodiment of the present invention, the preset rules can be set according to industry management requirements or historical experience.

[0086] Furthermore, the pre-built random forest classification model is used to classify the data table text vectors respectively to obtain data table classification labels, including:

[0087] Obtaining multiple decision trees in a preset first random forest classification model and decision dimension indexes and decision conditions of at least one layer of nodes in each decision tree;

[0088] According to the decision dimension index of the first node in the first random forest classification model, feature extraction is performed on the data table text vector to obtain a feature value of the data table text vector on the splitting dimension of the first node;

[0089] Judging the characteristic value according to the decision condition of the first node, and determining the second node to be traversed from the branch nodes of the first node according to the judging result;

[0090] According to the current decision dimension index and decision condition, continue to extract the feature value of the data table text vector at the second node and determine the next node to be traversed until the decision tree traversal is completed to obtain the data table classification label.

[0091] In the embodiment of the present invention, the method for grading the field text vectors is the same as the method for grading the data table text vectors, which will not be described in detail here.

[0092] In the embodiment of the present invention, different action functions and different field-level operation functions have different sensitivities, and the sensitivities after combination are also different. For example: SQL statement: SELECT a FROM TA, where a is a personal sensitive field (for example, insurance policy number), and TA is a data table. This operation has no effect on the sensitivity of the field information; SQL statement: SELECT count(a) FROM TA, where count() is a field-level operation function, which only counts the number of personal sensitive fields a (for example, insurance policy number) in the TA data table. This operation affects the sensitivity of the field information and reduces the sensitivity of the field information.

[0093] In the embodiment of the present invention, the operation information is classified by fully combining the action function and different field-level operation functions, and the obtained classification labels are more accurate.

[0094] In an embodiment of the present invention, by grading the data tables and fields corresponding to the operation information, data table information and field information parsed from the SQL statement in the preset database, operation information grading labels, data table grading labels and field grading labels are obtained. There is no need to embed points in the existing code and no need for additional traffic unloading equipment. The operation information grading labels, data table grading labels and field grading labels are obtained conveniently and quickly, thereby improving the efficiency of the grading method of the application API.

[0095] S4. Acquire call chain information of the target application, and analyze the hierarchical labels of associated applications corresponding to the target application according to the call chain information.

[0096] In the embodiment of the present invention, the call chain information may be obtained by using an APM system (eg, Apache Skywalking, CAT, Zipkin).

[0097] In the embodiment of the present invention, when the system completes a business, the call chain marks the call information (time, interface, level, result, etc.) between each application into the log, and then connects all the marked data into a tree chain. By analyzing the call chain, the call relationship between applications can be obtained, and the complete call process of the end-to-end execution of the business can be restored.

[0098] In detail, obtaining the call chain information of the target application in S4 includes:

[0099] Using a preset system to periodically obtain a call chain corresponding to the target application;

[0100] According to the TraceID in the call chain, the call chain information of each call request is extracted.

[0101] In an embodiment of the present invention, the call chain information includes all log information on the call chain. In the call chain, each call request corresponds to a unique TraceID, and the log of the corresponding call request can be obtained through the TraceID.

[0102] For details, see Figure 3 As shown, the step S4 of analyzing the hierarchical labels of the associated applications corresponding to the target application according to the call chain information includes:

[0103] S41, parsing the call information to obtain the call path of the target application, the call frequency of the associated application API, the call return information and the call operation function;

[0104] S42, acquiring associated applications and preset API classification labels of the associated applications according to the calling path of the target application;

[0105] S43, counting the call frequency of the associated application API that is successful in the call return information to obtain the successful call frequency, and filtering the call operation function whose call return information is successful from the call operation function to obtain the successful operation function;

[0106] S44, using the successful call frequency as the weight of the successful operation function corresponding to the associated application API, and using the pre-built random forest classification model to classify the weighted successful operation functions to obtain an operation function classification label;

[0107] S45. The operation function classification label and the API preset classification label are combined to obtain the classification label of the associated application.

[0108] In the embodiment of the present invention, CNN (Convolutional Neural Networks) can also be used to classify weighted successful operation functions.

[0109] In the embodiment of the present invention, the call return information includes: call success and call failure.

[0110] In an embodiment of the present invention, the call chain of the target application is utilized to analyze the grading tags of the associated applications corresponding to the target application. The grading tags of the associated applications are analyzed directly based on the historical call records. The call relationship and data request relationship between the applications in the call chain are utilized to improve the accuracy of the grading method of the application API. There is no need to embed points in the existing code and no need for additional traffic offloading equipment, thereby improving the efficiency of the grading method of the application API.

[0111] S5. Calculate the classification labels of each API of the target application according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

[0112] In detail, the S5 includes:

[0113] Setting target weight parameters of the operation information classification label, the data table classification label, the field classification label, and the classification label of the associated application according to a preset weight model;

[0114] According to the target weight parameter, the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application are weighted to obtain the classification label of the target application API.

[0115] In an embodiment of the present invention, evaluation factors such as whether encryption algorithms are added to data tables in the preset database, encryption strength levels, etc. are added to the preset weight model. For example, the weight ratio of the data table grading label corresponding to the data table that has added an encryption algorithm is high, and the weight ratio of the data table grading label corresponding to the data table that has not added an encryption algorithm is low.

[0116] In an embodiment of the present invention, the grading labels of each API of the target application are calculated based on the operation information grading label, the data table grading label, the field grading label and the grading label of the associated application, which fully considers the calling relationship of the associated applications and the security level of the operation information, thereby improving the accuracy of the grading method of the application API.

[0117] The embodiment of the present invention obtains the SQL statement for the target application to access the preset database; extracts the data table information, field information and operation information in the SQL statement; respectively classifies the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information classification labels, data table classification labels and field classification labels, and classifies the data tables and fields corresponding to the operation information, data table information and field information parsed from the SQL statement in the preset database to obtain operation information classification labels, data table classification labels and field classification labels, without the need to embed points in the existing code or additional traffic unloading equipment, and the operation information classification labels can be obtained quickly and conveniently. , data table classification labels and field classification labels, thereby improving the classification efficiency of the application API; obtaining the call chain information of the target application, and analyzing the classification labels of the associated applications corresponding to the target application according to the call chain information; calculating the classification labels of each API of the target application according to the operation information classification labels, the data table classification labels, the field classification labels and the classification labels of the associated applications, fully considering the call relationship of the associated applications, the impact of the security level of the operation information on the security classification of the application API, improving the accuracy of the application API classification method, and no need to embed points in the existing code, and no need for additional traffic unloading equipment, reducing the development workload, and improving the classification efficiency of the application API. Therefore, the application API classification method proposed in the present invention can solve the problem of low classification efficiency of the application API.

[0118] like Figure 4 , which is a functional module diagram of an application API grading device provided by an embodiment of the present invention.

[0119] The application API grading device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the application API grading device 100 can include an SQL statement acquisition module 101, an SQL statement parsing module 102, a target application grading module 103, an associated application grading module 104 and an integrated module 105. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.

[0120] In this embodiment, the functions of each module / unit are as follows:

[0121] The SQL statement acquisition module 101 is used to acquire the SQL statement for the target application to access the preset database;

[0122] The SQL statement parsing module 102 is used to extract data table information, field information and operation information in the SQL statement;

[0123] The target application classification module 103 is used to classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database, respectively, to obtain operation information classification labels, data table classification labels and field classification labels;

[0124] The associated application classification module 104 is used to obtain the call chain information of the target application, and analyze the classification labels of the associated applications corresponding to the target application according to the call chain information;

[0125] The integration module 105 is used to calculate the classification labels of each API of the target application according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

[0126] In detail, each module described in the grading device 100 for applying the API in the embodiment of the present invention is used in the same manner as described above. Figures 1 to 3 The same technical means as the classification method of application API described in , and can produce the same technical effects, will not be repeated here.

[0127] like Figure 5 , which is a schematic diagram of the structure of an electronic device for implementing a classification method for application APIs provided by an embodiment of the present invention.

[0128] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a hierarchical program of an application API.

[0129] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, hierarchical programs that execute application APIs, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0130] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of the hierarchical program of the application API, but also be used to temporarily store data that has been output or is to be output.

[0131] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0132] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0133] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0134] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0135] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0136] The application API classification program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0137] Obtain the SQL statement used by the target application to access the preset database;

[0138] Extracting data table information, field information and operation information in the SQL statement;

[0139] Respectively classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information classification labels, data table classification labels and field classification labels;

[0140] Acquire call chain information of the target application, and analyze the hierarchical labels of associated applications corresponding to the target application according to the call chain information;

[0141] The classification labels of each API of the target application are calculated according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

[0142] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.

[0143] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0144] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0145] Obtain the SQL statement used by the target application to access the preset database;

[0146] Extracting data table information, field information and operation information in the SQL statement;

[0147] Respectively classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information classification labels, data table classification labels and field classification labels;

[0148] Acquire call chain information of the target application, and analyze the hierarchical labels of associated applications corresponding to the target application according to the call chain information;

[0149] The classification labels of each API of the target application are calculated according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

[0150] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0151] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0152] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0153] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0154] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0155] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0156] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0157] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for grading application APIs, characterized in that: The method comprises: Obtain the SQL statement used by the target application to access the preset database; Extracting data table information, field information and operation information in the SQL statement; Respectively classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information classification labels, data table classification labels and field classification labels; Acquire call chain information of the target application, and analyze the hierarchical labels of associated applications corresponding to the target application according to the call chain information; The classification labels of each API of the target application are calculated according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

2. The method for grading application APIs according to claim 1, characterized in that: The extracting of data table information, field information and operation information in the SQL statement includes: Convert the string information of the SQL statement into a symbol stream through a pre-built lexical analyzer; Generate a syntax tree based on the symbol stream using a pre-built syntax analyzer; Using a compiler to parse the syntax tree to obtain an abstract syntax tree; Extracting metadata information from the abstract syntax tree; Data table information, field information and operation information are extracted from the metadata information.

3. The method for grading application APIs according to claim 1, wherein: The step of respectively grading the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database to obtain operation information grading labels, data table grading labels and field grading labels includes: According to the data table information and the field information, mapping the corresponding data table and field in the preset database; Quantizing the operation information, the data table and the field to obtain an operation information text vector, a data table text vector and a field text vector; The operation information text vector, the data table text vector and the field text vector are respectively classified using a pre-built random forest classification model to obtain operation information classification labels, data table classification labels and field classification labels.

4. The method for grading application APIs according to claim 3, characterized in that: The use of the pre-built random forest classification model to classify the operation information text vector to obtain the operation information classification label includes: Splitting the operation information text vector into a field-level operation function text vector and an action function text vector; According to a preset rule, different weight parameters are assigned to the field-level operation function text vector and the action function text vector; Based on the field-level operation function text vector and the action function text vector with weight parameters, the operation information is classified using a pre-built random forest classification model to obtain an operation information classification label.

5. The method for grading application APIs according to claim 1, characterized in that: The step of analyzing the classification labels of the associated applications corresponding to the target application according to the call chain information includes: Parsing the call information to obtain the call path of the target application, the call frequency of the associated application API, the call return information and the call operation function; Acquire, according to the calling path of the target application, associated applications and preset classification labels of APIs of the associated applications; Counting the call frequency of the associated application API that is successful in the call return information to obtain the successful call frequency, and filtering the call operation function whose call return information is successful from the call operation function to obtain the successful operation function; The successful call frequency is used as the weight of the successful operation function corresponding to the associated application API, and the pre-built random forest classification model is used to classify the weighted successful operation functions to obtain an operation function classification label; The operation function classification label and the API preset classification label are combined to obtain the classification label of the associated application.

6. The method for grading application APIs according to claim 1, characterized in that: The calculating the classification labels of each API of the target application according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application includes: Setting target weight parameters of the operation information classification label, the data table classification label, the field classification label, and the classification label of the associated application according to a preset weight model; According to the target weight parameter, the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application are weighted to obtain the classification label of the target application API.

7. The method for grading application APIs according to claim 1, characterized in that: The obtaining the call chain information of the target application includes: Using a preset system to periodically obtain a call chain corresponding to the target application; According to the TraceID in the call chain, the call chain information of each call request is extracted.

8. A device for grading an application API, characterized in that: The device comprises: SQL statement acquisition module, used to acquire SQL statements used by the target application to access the preset database; SQL statement parsing module, used to extract data table information, field information and operation information in the SQL statement; A target application classification module, used to classify the data tables and fields corresponding to the operation information, the data table information and the field information in the preset database, respectively, to obtain operation information classification labels, data table classification labels and field classification labels; An associated application grading module, used to obtain call chain information of the target application, and analyze the grading labels of associated applications corresponding to the target application according to the call chain information; The comprehensive module is used to calculate the classification labels of each API of the target application according to the operation information classification label, the data table classification label, the field classification label and the classification label of the associated application.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the application API grading method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for grading application APIs according to any one of claims 1 to 7 is implemented.