Class risk detection method and device, equipment and storage medium
By using the matching mechanism between the risk class detection table and the project class table during the dynamic class loading process, risky classes are identified and warned, data leakage problems caused by dynamic class loading are solved, and the security and accuracy of the project are improved.
Patent Information
- Application Number
- CN202410927024.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-01
AI Technical Summary
During the dynamic loading and running of classes, unfamiliar classes may obtain non-public confidential data in the development project, leading to data leakage and affecting the privacy and security of the project.
By obtaining the dynamically loaded class during the execution of the source file, and matching it with the pre-built risk class detection table and project class table, the risk of the class is judged. If it is not in the project class table, the risk will be treated as a class to be confirmed. Early warning, set up two rounds of confirmation to ensure accuracy.
Effectively identify and warn dynamically loaded risky classes to prevent data leakage, ensure the confidentiality and security of the project, avoid misjudgment, and ensure the normal loading process of classes.
Smart Images

Figure CN118734291A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of class risk detection, and in particular to a class risk detection method, device, equipment and storage medium. Background Art
[0002] In computer programming, especially in object-oriented programming (OOP), class is a very important concept. It can be regarded as a template or blueprint, which defines the properties and methods (or member functions) of an object. These properties and methods describe the state and behavior of the object. The concept of class is used in Java, C++, C#, Python, etc., and can be loaded and run dynamically.
[0003] However, during the dynamic class loading process, if some third-party libraries are used in the code, the third-party libraries will dynamically load some unfamiliar classes, such as classes that are not related to the project or are unsafe, etc. These classes are likely to obtain some non-public confidential data in the current development project, causing data leakage and seriously affecting the privacy and security of the current development project. Summary of the invention
[0004] In view of this, the present application provides a class risk detection method, device, equipment and storage medium, which are used to solve the problem that unfamiliar classes may obtain some non-public and confidential data in the current development project during the loading and running process, causing data leakage and seriously affecting the privacy and security of the current development project.
[0005] To achieve the above objectives, the proposed solution is as follows:
[0006] In a first aspect, a class risk detection method includes:
[0007] In the process of executing the source file, obtaining each class dynamically loaded by the source file;
[0008] Matching each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed;
[0009] Determine whether each of the to-be-confirmed classes is included in a pre-established project class table, and use each of the to-be-confirmed classes not included in the project class table as each second class; the project class table is a collection of classes defined by the development project corresponding to the source file;
[0010] A risk warning is issued for each of the risk categories and each of the second categories.
[0011] Preferably, the step of matching each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed comprises:
[0012] determining a class name for each of said classes;
[0013] Matching each of the classes with the risk class detection table according to the class name;
[0014] For each of the classes, if the class name of the class is the same as the class name of the class marked as blacklisted in the risk class detection table, the class is determined as a risk class;
[0015] If the class name of the class is different from the class name of the class in the risk class detection table, the class is regarded as a class to be confirmed.
[0016] Preferably, the process of constructing the risk class detection table includes:
[0017] Get the class name of each class marked as whitelist and the class name of each class marked as blacklist from the database;
[0018] The class names of each class marked as a whitelist and the class names of each class marked as a blacklist are summarized into a risk class detection table.
[0019] Preferably, the process of establishing the project category table includes:
[0020] Obtaining each project class of the development project corresponding to the source file;
[0021] Determine the package name of each of the project classes;
[0022] The project class table is composed of the package names of the various project classes.
[0023] Preferably, the step of providing risk warning for each of the risk classes and each of the second classes includes:
[0024] Determining the total number of all the risk classes and second classes as a first total number;
[0025] Determine the total number of each of the classes as the second total number;
[0026] Calculating a ratio of the first total number to the second total number;
[0027] If the ratio is greater than a first preset threshold, an alarm is issued.
[0028] Preferably, the step of providing risk warning for each of the risk classes and each of the second classes includes:
[0029] Obtaining each class file of the second class;
[0030] For each of the second categories, extract the file content of the class file of the second category, the network interface corresponding to the class file, and the software version number corresponding to the source file;
[0031] Calculate a feature code corresponding to the second category based on the file content, the network interface, and the software version number;
[0032] Using the feature code to perform risk detection on each of the second categories to obtain a detection result;
[0033] If the test result is that each of the second categories is risk-free, a risk warning is issued for each of the risk categories;
[0034] If the detection result is that each second category contains at least one second category with risk, a risk warning is issued for each risk category and each second category with risk.
[0035] Preferably, the using the feature code to perform risk detection on each of the second categories to obtain a detection result includes:
[0036] Comparing each of the second-category feature codes with a pre-established feature code detection table;
[0037] Determining whether each of the second-category feature codes is successfully compared with the feature code detection table;
[0038] If so, the test results are determined to be risk-free for each second category;
[0039] If not, it is determined that the detection result is that each second category contains at least one second category with risk.
[0040] In a second aspect, a class risk detection device includes:
[0041] A class acquisition module, used to acquire each class dynamically loaded by the source file during the execution of the source file;
[0042] A matching module, for matching each of the classes with a pre-built risk class detection table to determine each risk class and each class to be confirmed;
[0043] A judgment module, used to judge whether each of the to-be-confirmed classes is included in a pre-established project class table, and to treat each of the to-be-confirmed classes not included in the project class table as each second class; the project class table is a collection of classes defined by the source file corresponding to the development project;
[0044] The risk warning module is used to issue a risk warning for each of the risk categories and each of the second categories.
[0045] In the third aspect, the risk detection device of the type includes a memory and a processor;
[0046] The memory is used to store programs;
[0047] The processor is used to execute the program to implement each step of the class risk detection method as described in any one of the first aspects.
[0048] In a fourth aspect, a storage medium stores a computer program thereon, and when the computer program is executed by a processor, the steps of the class risk detection method as described in any one of the first aspects are implemented.
[0049] It can be seen from the above technical solution that in the process of executing the source file, the present application obtains each class dynamically loaded by the source file; matches each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed; establishes a project class table for the development project corresponding to the source file; determines whether each of the classes to be confirmed is included in the project class table, and treats each class to be confirmed that is not included in the project class table as a second class; and issues risk warnings for each of the risk classes and each of the second classes. This solution sets up two detection tables, namely the risk class detection table and the project class table. First, each dynamically loaded class is matched with the risk class detection table to determine whether each class is a risk class pre-defined in the risk class detection table. If some classes are not recorded in the risk class detection table, it is necessary to use the project class table to further detect these classes, that is, to determine whether these unconfirmed classes exist in the project class table. If so, it means that the unconfirmed classes are trusted by the project and are risk-free. If some of the unconfirmed classes still do not exist in the project class table, they can be considered risky. Therefore, after two rounds of confirmation, it is accurately determined which of all dynamically loaded classes are risky and which are risk-free, and at the same time, no misjudgment will be caused, such as misjudging risk-free classes as risky classes, delaying the normal loading process of the class. Risk warnings can also be issued for these risky classes to protect the non-public confidential data of the development project, prevent cheating by other users, and ensure the normal development of the project. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0051] Figure 1An optional flow chart of a class of risk detection methods provided in an embodiment of the present application;
[0052] Figure 2 A delegation flow chart between class loaders provided in an embodiment of the present application;
[0053] Figure 3 Another delegation flow chart between class loaders provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of the structure of a type of risk detection device provided in an embodiment of the present application;
[0055] Figure 5 A schematic diagram of the structure of a type of risk detection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] The embodiment of the present invention provides a class of risk detection methods, which can be applied to various computer terminals or smart terminals, and the execution subject can be a processor or server of the computer terminal or smart terminal. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:
[0058] S1: During the execution of a source file, each class dynamically loaded by the source file is obtained.
[0059] Dynamic loading of classes is an important feature in programming languages such as Java, C++, C#, and Python. It allows the program to load the corresponding class as needed at runtime, specifically loading the class definition and instantiating the class or calling its method.
[0060] In Java, this is usually achieved through the Class.forName() method or the class loader (ClassLoader).
[0061] Then, in the process of executing the source file, each class dynamically loaded by the source file is obtained. It can be understood that obtaining each class specifically means obtaining relevant information of each class, such as the class name, package name, full name, class file, class path, etc.
[0062] In Java, it can be obtained through the parent delegation mechanism. The parent delegation mechanism is a working mode of the Java class loader. When a Java class needs to be loaded dynamically, the Java virtual machine will first pass the loading request to its parent class loader. If the parent class loader cannot find the class, it will pass the loading request to the child class loader. This process is a process of searching the hierarchical structure upwards until it is found or a ClassNotFoundException is thrown.
[0063] There are several main class loaders:
[0064] 1) Bootstrap Class Loader: This is the class loader built into the Java virtual machine, responsible for loading the Java core class library, such as the classes in the java.lang package.
[0065] 2) Extension Class Loader: Some extension class loaders are responsible for loading Java extension classes, such as classes in the Java extension API (application programming interface); some extension class loaders are used as platform class loaders (Platform Class Loader).
[0066] 3) Custom ClassLoader: It allows developers to customize the class loading behavior according to their own needs.
[0067] 4) Application Class Loader: Also known as the system class loader, it is responsible for loading application classes and user-defined classes.
[0068] The process of dynamically loading classes using the above four class loaders in this application can be as follows: Figure 2 As shown, in Figure 2 In the example, when the startup class loader receives a loading request for the class, it will first delegate it to its parent loader for loading. Since the startup class loader has no corresponding parent loader, it will load it by itself. If it cannot load the class, it will enter the extension class loader for loading. Similarly, the extension class loader will first delegate to its parent loader (the startup class loader). Since it is known that the startup class loader cannot load, the class will then enter the custom class loader for loading, and so on, until all class loaders are traversed.
[0069] S2: Match each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed.
[0070] Each class is matched with the pre-built risk class detection table. It can be considered that each class is used as a benchmark to traverse each class defined or recorded in the risk class detection table to see if it can be matched successfully. Optionally, multiple risk classes are defined in the risk class detection table. These risk classes are all based on risky classes determined in the historical development process, or unsafe classes; at the same time, multiple absolutely safe classes can also be defined in the risk class detection table. If some of the classes dynamically loaded in this application belong to such absolutely safe classes, then it can be determined that they are risk-free.
[0071] If some of the dynamically loaded classes do not belong to the risk class detection table, it means that these classes have not been defined with risk or no-risk labels. In order to ensure safety, further confirmation and detection are required, so the classes not included in the risk class detection table are treated as classes to be confirmed.
[0072] S3: Determine whether each of the to-be-confirmed classes is included in a pre-established project class table, and treat each to-be-confirmed class not included in the project class table as a second class; the project class table is a collection of classes defined by the source file corresponding to the development project.
[0073] It is understandable that the development project will predefine some classes that must be applied to establish or execute the necessary content of the project, so these classes can be considered to be trusted by the project, safe, and risk-free. The risk class detection table only contains multiple risky classes and / or risk-free classes. Therefore, in order to make the detection results more comprehensive and accurate, it is necessary to further detect each unconfirmed class, that is, to compare each unconfirmed class with the project class table to determine whether each unconfirmed class is included in the project class table. If so, these unconfirmed classes are safe and risk-free. If some unconfirmed classes are not included in the project class table, they are defined as the second category.
[0074] S4: Issue risk warning for each of the risk categories and each of the second categories.
[0075] In order to protect data assets to the greatest extent and prevent data leakage, risk warnings are issued for the risk category and the second category that does not belong to the risk category detection table or the project category table.
[0076] Risk warnings can be issued in the form of warnings, or by marking these categories to remind staff to handle them, etc.
[0077] It can be seen from the above technical solution that in the process of executing the source file, the present application obtains each class dynamically loaded by the source file; matches each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed; establishes a project class table for the development project corresponding to the source file; determines whether each of the classes to be confirmed is included in the project class table, and treats each class to be confirmed that is not included in the project class table as a second class; and issues risk warnings for each of the risk classes and each of the second classes. This solution sets up two detection tables, namely the risk class detection table and the project class table. First, each dynamically loaded class is matched with the risk class detection table to determine whether each class is a risk class pre-defined in the risk class detection table. If some classes are not recorded in the risk class detection table, it is necessary to use the project class table to further detect these classes, that is, to determine whether these unconfirmed classes exist in the project class table. If so, it means that the unconfirmed classes are trusted by the project and are risk-free. If some of the unconfirmed classes still do not exist in the project class table, they can be considered risky. Therefore, after two rounds of confirmation, it is accurately determined which of all dynamically loaded classes are risky and which are risk-free, and at the same time, no misjudgment will be caused, such as misjudging risk-free classes as risky classes, delaying the normal loading process of the class. Risk warnings can also be issued for these risky classes to protect the non-public confidential data of the development project, prevent cheating by other users, and ensure the normal development of the project.
[0078] For example, some existing solutions for class risk detection are to analyze user behavior, determine whether the user's account information is normal, determine the user's risk level; determine whether the call interface is abnormal, etc., but these methods cannot monitor and eliminate risks from the source, and also require the analysis of a large amount of data, which is relatively inefficient and has low detection accuracy. The present application starts from the class itself to detect their riskiness, which has high detection efficiency and accuracy compared to existing solutions.
[0079] In the method provided in the embodiment of the present invention, each of the classes is matched with a pre-constructed risk class detection table to determine the process of each risk class and each class to be confirmed, as described in detail as follows:
[0080] determining a class name for each of said classes;
[0081] Matching each of the classes with the risk class detection table according to the class name;
[0082] For each of the classes, if the class name of the class is the same as the class name of the class marked as blacklisted in the risk class detection table, the class is determined as a risk class;
[0083] If the class name of the class is different from the class name of the class in the risk class detection table, the class is regarded as a class to be confirmed.
[0084] Specifically, in the process of matching each class with the risk class detection table, the class name is used for matching. Each class has an associated class name, which is a unique identifier used to identify and reference the class. It is usually used to reference and create instances of the class in the code. Class names generally start with uppercase letters, such as: MyExampleClass.
[0085] Match each class name with the risk class detection table respectively. If a class name is the same as the class name of the risk class in the risk class detection table, it is determined to be a risk class; if the class name is the same as the class name of the risk-free class in the risk class detection table, it is determined to be a risk-free class; if the class name is different from the class name of each class in the risk class detection table, then it is considered that the class does not belong to the currently confirmed risk / risk-free class, but is a class that needs to be further determined, and is named as the class to be confirmed.
[0086] The application of this risk class detection table can clearly determine the affiliation of each class, making it easier to load later.
[0087] Optional, the process of building a risk detection table includes:
[0088] Get the class name of each class marked as whitelist and the class name of each class marked as blacklist from the database;
[0089] The class names of each class marked as a whitelist and the class names of each class marked as a blacklist are summarized into a risk class detection table.
[0090] Specifically, the risk detection table can be composed of the class names that have been determined as risk classes and the class names that have been determined as non-risk classes, as shown in the following Table 1:
[0091] Table 1
[0092]
[0093] The database is an existing, open source database that stores all current classes and defines the characteristics or properties of the class, such as the type, name, security, and risk.
[0094] The following is an explanation of the process of establishing a project class table of a development project corresponding to the source file in the present application.
[0095] Obtaining each project class of the development project corresponding to the source file;
[0096] Determine the package name of each of the project classes;
[0097] The project class table is composed of the package names of the various project classes.
[0098] Specifically, the package name of a class is a mechanism for organizing the namespace of a class. Setting a package name helps to better manage and maintain the code and avoid conflicts with the class name. It follows specific naming rules and provides access control functions. When writing Java code, the reasonable use of package names can make the code structure clearer and easier to maintain and manage. Therefore, in this step, using the package name to establish the project class table can more accurately and quickly complete the detection and confirmation of the class to be confirmed.
[0099] Furthermore, it can be considered that each of the second categories is not a class necessary for project development, but is safe or irrelevant to the project; it can also be considered that these classes are risky, such as classes of "hacker" nature, so this application provides the following two methods for risk warning for each of the risk classes and each of the second categories according to different situations:
[0100] (i) The second category is considered to be as unsafe as the risk category, and warnings are issued for both categories at the same time.
[0101] Determining the total number of all the risk classes and second classes as a first total number;
[0102] Determine the total number of each of the classes as the second total number;
[0103] Calculating a ratio of the first total number to the second total number;
[0104] If the ratio is greater than a first preset threshold, an alarm is issued.
[0105] Specifically, the first preset threshold can be set to any value between 5% and 10%. When the value obtained by dividing the first total number by the second total number is greater than the first preset threshold, it means that there is a certain proportion of risky classes among all loaded classes, and an alarm is required.
[0106] (ii) Since the class name or package name of a class may change, but the file content of the class file corresponding to the class will not change, if the second class does not belong to the risk class detection table or the project class table, the second class can be further detected to reduce misjudgment and improve detection accuracy. Batch detection can be performed to save traffic and avoid excessive energy consumption.
[0107] Obtaining each class file of the second class;
[0108] For each of the second categories, extract the file content of the class file of the second category, the network interface corresponding to the class file, and the software version number corresponding to the source file;
[0109] Calculate a feature code corresponding to the second category based on the file content, the network interface, and the software version number;
[0110] Using the feature code to perform risk detection on each of the second categories to obtain a detection result;
[0111] If the test result is that each of the second categories is risk-free, a risk warning is issued for each of the risk categories;
[0112] If the detection result is that each second category contains at least one second category with risk, a risk warning is issued for each risk category and each second category with risk.
[0113] Specifically, a class file is a bytecode file generated after compiling the source code. Each class belongs to a package. A package can contain multiple class files. These class files are stored in a directory corresponding to the package name, and the class files store file content. Extract the file content of the second class file, the network interface corresponding to the class file, and the software version number corresponding to the source file, and calculate the feature code from this information. The MD5 algorithm can be used for calculation. It is a cryptographic hash function. Using the MD5 algorithm to calculate the feature code of the second class can ensure the integrity and consistency of the file content of the class file, the network interface corresponding to the class file, and the software version number corresponding to the source file. The feature code is also an identification code that uniquely corresponds to the second class; binary information codes can also be calculated from this information.
[0114] The detailed steps of using the feature code to perform risk detection on each of the second categories to obtain the detection result include:
[0115] Comparing each of the second-category feature codes with a pre-established feature code detection table;
[0116] Determining whether each of the second-category feature codes is successfully compared with the feature code detection table;
[0117] If so, the test results are determined to be risk-free for each second category;
[0118] If not, it is determined that the detection result is that each second category contains at least one second category with risk.
[0119] The signature code detection table contains signature codes of all whitelist classes / confirmed risk-free classes, classes in the project class table, and classes in the programming software corresponding to the development project.
[0120] The complete process above can be Figure 3 shown.
[0121] and Figure 1Corresponding to the method described above, the embodiment of the present invention also provides a risk detection device for class Figure 1 In the specific implementation of the method, the class risk detection device provided by the embodiment of the present invention can be in a computer terminal or various mobile devices, combined with Figure 4 , introduce the risk detection device of the class, such as Figure 4 As shown, the device may include:
[0122] The class acquisition module 10 is used to acquire each class dynamically loaded by the source file during the execution of the source file;
[0123] A matching module 20, for matching each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed;
[0124] The judging module 30 is used to judge whether each of the to-be-confirmed classes is included in a pre-established project class table, and to treat each to-be-confirmed class not included in the project class table as each second class; the project class table is a collection of classes defined by the source file corresponding to the development project;
[0125] The risk warning module 40 is used to issue a risk warning for each of the risk categories and each of the second categories.
[0126] It can be seen from the above technical solution that in the process of executing the source file, the present application obtains each class dynamically loaded by the source file; matches each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed; establishes a project class table for the development project corresponding to the source file; determines whether each of the classes to be confirmed is included in the project class table, and treats each class to be confirmed that is not included in the project class table as a second class; and issues risk warnings for each of the risk classes and each of the second classes. This solution sets up two detection tables, namely the risk class detection table and the project class table. First, each dynamically loaded class is matched with the risk class detection table to determine whether each class is a risk class pre-defined in the risk class detection table. If some classes are not recorded in the risk class detection table, it is necessary to use the project class table to further detect these classes, that is, to determine whether these unconfirmed classes exist in the project class table. If so, it means that the unconfirmed classes are trusted by the project and are risk-free. If some of the unconfirmed classes still do not exist in the project class table, they can be considered risky. Therefore, after two rounds of confirmation, it is accurately determined which of all dynamically loaded classes are risky and which are risk-free, and at the same time, no misjudgment will be caused, such as misjudging risk-free classes as risky classes, delaying the normal loading process of the class. Risk warnings can also be issued for these risky classes to protect the non-public confidential data of the development project, prevent cheating by other users, and ensure the normal development of the project.
[0127] Furthermore, the embodiment of the present application provides a risk detection device of a class. Optionally, Figure 5 The hardware structure diagram of the risk detection device of the class is shown, referring to Figure 5 The hardware structure of the risk detection device of this type may include: at least one processor 01, at least one communication interface 02, at least one memory 03 and at least one communication bus 04.
[0128] In the embodiment of the present application, the number of the processor 01 , the communication interface 02 , the memory 03 , and the communication bus 04 is at least one, and the processor 01 , the communication interface 02 , and the memory 03 communicate with each other through the communication bus 04 .
[0129] The processor 01 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.
[0130] The memory 03 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory.
[0131] The memory stores a program, and the processor can call the program stored in the memory, and the program is used to execute the following risk detection methods, including:
[0132] In the process of executing the source file, obtaining each class dynamically loaded by the source file;
[0133] Matching each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed;
[0134] Determine whether each of the to-be-confirmed classes is included in a pre-established project class table, and use each of the to-be-confirmed classes not included in the project class table as each second class; the project class table is a collection of classes defined by the development project corresponding to the source file;
[0135] A risk warning is issued for each of the risk categories and each of the second categories.
[0136] Optionally, the detailed functions and extended functions of the program may refer to the description of the class risk detection method in the method embodiment.
[0137] The embodiment of the present application further provides a storage medium, which may store a program suitable for execution by a processor, and when the program is executed, controls the device where the storage medium is located to execute the following risk detection method, including:
[0138] In the process of executing the source file, obtaining each class dynamically loaded by the source file;
[0139] Matching each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed;
[0140] Determine whether each of the to-be-confirmed classes is included in a pre-established project class table, and use each of the to-be-confirmed classes not included in the project class table as each second class; the project class table is a collection of classes defined by the development project corresponding to the source file;
[0141] A risk warning is issued for each of the risk categories and each of the second categories.
[0142] Specifically, the storage medium may be a computer-readable storage medium, and the computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk or a ROM.
[0143] Optionally, the detailed functions and extended functions of the program may refer to the description of the class risk detection method in the method embodiment.
[0144] In addition, the functional modules in the various embodiments of the present disclosure can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a live broadcast device, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present disclosure.
[0145] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0146] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0147] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A class risk detection method, characterized in that: include: In the process of executing the source file, obtaining each class dynamically loaded by the source file; Matching each of the classes with a pre-constructed risk class detection table to determine each risk class and each class to be confirmed; Determine whether each of the to-be-confirmed classes is included in a pre-established project class table, and use each of the to-be-confirmed classes not included in the project class table as each second class; the project class table is a collection of classes defined by the development project corresponding to the source file; A risk warning is issued for each of the risk categories and each of the second categories.
2. The method according to claim 1, characterized in that The step of matching each of the classes with a pre-built risk class detection table to determine each risk class and each class to be confirmed includes: determining a class name for each of said classes; Matching each of the classes with the risk class detection table according to the class name; For each of the classes, if the class name of the class is the same as the class name of the class marked as blacklisted in the risk class detection table, the class is determined as a risk class; If the class name of the class is different from the class name of the class in the risk class detection table, the class is regarded as a class to be confirmed.
3. The method according to claim 1, characterized in that The process of constructing the risk detection table includes: Get the class name of each class marked as whitelist and the class name of each class marked as blacklist from the database; The class names of each class marked as a whitelist and the class names of each class marked as a blacklist are summarized into a risk class detection table.
4. The method according to claim 1, characterized in that: The process of establishing the project category table includes: Obtaining each project class of the development project corresponding to the source file; Determine the package name of each of the project classes; The project class table is composed of the package names of the various project classes.
5. The method according to claim 1, characterized in that: The performing risk warning for each of the risk classes and each of the second classes includes: Determining the total number of all the risk classes and second classes as a first total number; Determine the total number of each of the classes as the second total number; Calculating a ratio of the first total number to the second total number; If the ratio is greater than a first preset threshold, an alarm is issued.
6. The method according to claim 1, characterized in that The performing risk warning for each of the risk classes and each of the second classes includes: Obtaining each class file of the second class; For each of the second categories, extract the file content of the class file of the second category, the network interface corresponding to the class file, and the software version number corresponding to the source file; Calculate a feature code corresponding to the second category based on the file content, the network interface, and the software version number; Using the feature code to perform risk detection on each of the second categories to obtain a detection result; If the test result is that each of the second categories is risk-free, a risk warning is issued for each of the risk categories; If the detection result is that each second category contains at least one second category with risk, a risk warning is issued for each risk category and each second category with risk.
7. The method according to claim 6, characterized in that The using the feature code to perform risk detection on each of the second categories to obtain a detection result includes: Comparing each of the second-category feature codes with a pre-established feature code detection table; Determining whether each of the second-category feature codes is successfully compared with the feature code detection table; If so, the test results are determined to be risk-free for each second category; If not, it is determined that the detection result is that each second category contains at least one second category with risk.
8. A risk detection device, characterized in that: include: A class acquisition module, used to acquire each class dynamically loaded by the source file during the execution of the source file; A matching module, for matching each of the classes with a pre-built risk class detection table to determine each risk class and each class to be confirmed; A judgment module, used to judge whether each of the to-be-confirmed classes is included in a pre-established project class table, and to treat each of the to-be-confirmed classes not included in the project class table as each second class; the project class table is a collection of classes defined by the source file corresponding to the development project; The risk warning module is used to issue a risk warning for each of the risk categories and each of the second categories.
9. A risk detection device, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the class risk detection method as described in any one of claims 1-7.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the class risk detection method according to any one of claims 1 to 7 is implemented.
