Method and system for optimizing virus detection efficiency and resource consumption
By splitting the virus signature database and managing concurrency, the problem of excessive memory usage and efficiency improvement of the virus detection engine is solved, and efficient virus detection and resource management are achieved.
Patent Information
- Application Number
- CN202410857419.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-06
AI Technical Summary
Existing virus detection engines occupy too much memory during matching and analysis, and the overall loaded virus signature database cannot be parallelized to improve detection and killing efficiency.
By splitting the virus signature database, multiple virus split databases are created, and top-level control components are used for concurrency management. Virus detection components are created through multi-threading. The message broadcast mechanism is used to broadcast detection results to avoid repeated detection. Only Load the necessary virus split library for comparison.
It reduces the memory usage of the virus scanning and killing engine, enables parallel execution of multiple detection tasks, improves scanning efficiency and avoids useless consumption of resources.
Smart Images

Figure CN118606945A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of virus detection, and in particular, relates to a method and system for optimizing virus detection efficiency and resource consumption. Background Art
[0002] Computer viruses and malware are one of the major threats in the field of cloud security. Once a computer is infected with a virus, it may lead to a series of problems such as data loss, system crash, privacy leakage and financial loss. And as vulnerabilities in operating systems or applications are exposed, computer viruses and malware will continue to evolve and mutate using new technologies, becoming more difficult to remove.
[0003] Protecting computers and servers from virus infection is one of the key tasks of cloud security. The current mainstream anti-virus technology mainly uses a dedicated virus detection engine to detect files in the system file system, executable programs, and data transmitted in the network to determine whether they are viruses or malware.
[0004] During the virus detection process, a large and constantly updated virus signature database is usually used. The virus signatures recorded in the database are compared one-to-one with the detected file. If they match the virus signatures, the detected file is determined to be a virus file, and measures can be taken to isolate or remove the virus file to prevent further spread. Administrators can also customize some policies to control the behavior of virus scanning, such as automatically and regularly scanning vulnerable areas.
[0005] The use of such a large virus signature library is to cope with the constantly updated variants of computer viruses and malware. Usually the virus detection engine will load the entire virus signature library and the target file into memory, and then match and analyze it in memory. This is to increase the scanning speed and reduce disk I / O, because reading data from memory is much faster than reading data from disk.
[0006] However, this method of loading the virus signature library once and then matching it has defects:
[0007] 1. The virus engine occupies too much memory when matching and analyzing.
[0008] 2. Because the virus signature library is loaded as a whole, there is no way to use parallel processing to improve the efficiency of detection. Summary of the invention
[0009] In view of the above shortcomings of the prior art, the purpose of the invention is to provide a method for optimizing virus detection efficiency and resource consumption, thereby improving virus detection efficiency. The method splits the virus library in the early stage and partially schedules it into memory for comparison during virus detection, thereby solving the problem of excessive memory usage of the virus detection engine.
[0010] Virus detection is an important concept in the security field, which refers to the scanning and analysis of computer systems, files, data, network traffic, etc. to detect and identify potential computer viruses, malware, malicious codes and threats. This process is designed to protect computer systems and data from infection and harm caused by malware.
[0011] In a first aspect of the present invention, a method for optimizing virus detection efficiency and resource consumption is proposed, comprising:
[0012] S1, split the virus feature library to obtain multiple virus split libraries;
[0013] S2, build the top-level control component and send virus detection instructions and concurrency to the top-level control component;
[0014] S3, creating a virus detection component through the top-level control component, and assigning a virus splitting library to the virus detection component;
[0015] S4, document risk detection is performed through various virus detection components, and the detection results are broadcast between virus monitoring components. The same file is only detected once.
[0016] Furthermore, in S1, the virus feature library is signed by a private key. When it is split into multiple virus split libraries, the virus feature library is firstly signed and verified by a public key. After the verification is correct, the virus feature library is split into multiple virus split libraries.
[0017] Furthermore, in S1, when the virus feature library is split, the basis for the split classification is the specific characteristics of the virus, and the specific characteristics of the virus include at least the key code signature of the virus program, the metadata signature based on PE file information, the certificate signature based on trust and revocation, the signature based on container metadata, the signature based on ZIP / RAR metadata, and the signature based on phishing URL / HOST.
[0018] Furthermore, after the virus splitting library is split, the virus splitting library is signed, and the information of the producer is added to each virus splitting library.
[0019] Furthermore, in S3, when issuing a virus detection command, the top-level control component creates a virus detection component in a multi-threaded manner, obtains a file handle of a file to be detected, and sends the file handle to each virus detection component.
[0020] Furthermore, in S3, when sending the file handle, a broadcast message mechanism is used for sending, and the virus splitting library allocated to each virus detection component is determined according to the number of virus detection components and the number of virus splitting libraries.
[0021] Furthermore, in S4, document risk detection is performed through various virus detection components, and in the step of broadcasting the detection results between virus monitoring components, the virus detection component compares the file to be detected with the virus splitting library assigned to the virus detection component. If the file to be detected matches any virus feature in the virus splitting library, the file is determined to be a risky file.
[0022] Furthermore, in S4, when it is determined that the file to be detected is a risky file, a notification is sent to all other virus detection components to inform them that the file to be detected is a risky file, and other virus detection components no longer load the virus splitting library to detect the file to be detected.
[0023] Furthermore, in S4, the virus detection component compares the file to be detected with the virus splitting library assigned to the virus detection component. If the file to be detected does not match any virus feature in the virus splitting library, other virus splitting libraries will continue to be retrieved for file comparison. If all virus splitting libraries have been retrieved and compared, the file to be detected does not match any virus feature in the virus splitting library, then the file to be detected is determined to be risk-free and a detection result is generated.
[0024] According to a second aspect of the present invention, a system for optimizing virus detection efficiency and resource consumption is proposed. The system includes a virus feature library, a top-level control component, a message notification component, and a virus detection component. The top-level control component is used to create the virus detection component and send virus detection commands, concurrency, and a virus splitting library to the virus detection component. The virus feature library is used to store the characteristics of various viruses.
[0025] The beneficial effects of the present invention are as follows:
[0026] The method and system described in the present invention solve the problem of excessive memory usage of the virus detection engine by splitting the virus library in the early stage and scheduling part of it into the memory for comparison during the detection. Through configuration and message broadcasting, multiple virus detection tasks are controlled to be executed in parallel, and a quick response is given after the results are obtained to avoid useless consumption of resources, thereby improving scanning efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0028] Figure 1 The present invention provides a flowchart of a method for optimizing virus detection efficiency and resource consumption according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.
[0030] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.
[0031] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.
[0033] The present invention proposes a method and system for optimizing virus detection efficiency and resource consumption. The method splits the virus library in the early stage and partially schedules it into memory for comparison during virus detection, thereby reducing the problem of excessive memory usage of the virus detection engine. Through configuration and message broadcasting, multiple virus detection tasks are controlled to be executed in parallel, and a quick response is given after the results are obtained to avoid useless resource consumption, thereby improving scanning efficiency.
[0034] Method Embodiment
[0035] The present invention provides a method for optimizing virus detection efficiency and resource consumption, characterized by comprising:
[0036] S1, split the virus feature library to obtain multiple virus split libraries.
[0037] In this step, if Figure 1 As shown, the virus signature library used by the virus detection component is split. In order to indicate that the virus signature library is provided by an official organization, the virus signature library is generally signed with the official organization's private key. Before splitting, the signature is verified with the public key issued together with the virus signature library. After the verification is correct, the specific feature information of the virus signature library is split. Common virus features include the following categories: key code signatures based on virus programs, metadata signatures based on PE file information, certificate signatures based on trust and revocation, signatures based on container metadata, signatures based on ZIP / RAR metadata, and signatures based on phishing URLs / HOSTs. The virus features contained in the virus signature library can be divided according to custom rules. After the division, it is also necessary to use the official organization's signing tool to sign each split library with the producer's information to indicate that the split virus split library is made by ourselves.
[0038] S2, build the top-level control component and send virus detection instructions and concurrency to the top-level control component.
[0039] In this step, a top-level control component is constructed to determine the concurrency that can be used for virus detection based on the actual configuration of the machine that needs to perform virus detection. After the concurrency is determined, it is sent to the virus detection component together with the detection command when the virus detection is actually performed.
[0040] S3, creating a virus detection component through the top-level control component, and assigning a virus splitting library to the virus detection component.
[0041] In this step, the virus detection command is sent according to the manual trigger or custom strategy timed scanning, and the concurrency of the virus detection is sent at the same time. The concurrency is the number of virus detection components that perform detection work at the same time. The top-level control component first creates multiple corresponding virus detection components based on the concurrency using multi-threading technology, and then cyclically obtains the file handle of the file to be detected and distributes it to multiple virus detection components through the broadcast message mechanism. According to the number of split virus libraries and the number of virus detection components, the virus split library is allocated to the corresponding virus detection component.
[0042] S4, document risk detection is performed through various virus detection components, and the detection results are broadcast between virus monitoring components. The same file is only detected once.
[0043] In this step, when the virus detection component is working, feature comparison is performed in sequence according to the assigned virus splitting library. After the file to be detected is compared with a small-scale virus splitting library, if it matches any virus feature in it, the file can be determined to be a risky file. After being determined to be a risky file, the file information is immediately sorted and the detection result is returned. At the same time, the message notification component is used to notify other virus detection components to prevent other detection components from continuing to load the virus feature library for detection. If the current file does not match any virus feature, the current virus feature library can be called out from the memory, and then the next virus feature library is called in for comparison. If no other virus feature library can be called in, then this virus detection component can determine that the current file is risk-free and sort out and return the detection result. Of particular concern is that before the next virus feature library is called in, it can be detected whether there is a broadcast message to prevent continued detection, such as other virus detection components have already determined it as a threat file. If a message is received to prevent continued detection, then there is no need to call in the next virus feature library, and the result is returned directly. This can avoid unnecessary consumption of resources; when all virus detection components return the detection results, the detection results of the file to be detected are sorted out.
[0044] System Example
[0045] Another specific embodiment of the present invention is a system for optimizing virus detection efficiency and resource consumption, the system comprising a virus feature library, a top-level control component, a message notification component and a virus detection component, the top-level control component is used to create the virus detection component and send virus detection commands, concurrency and virus splitting library to the virus detection component, and the virus feature library is used to store the characteristics of various viruses.
[0046] In this embodiment, the present invention includes one or more virus detection components, a virus feature library obtained by collecting, collating and analyzing, a top-level control component, and a message notification component. After receiving a virus detection command, the virus detection component loads the virus feature library for detection, and after the detection is completed, it notifies the service management station through the message notification component.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for optimizing virus detection efficiency and resource consumption, It is characterized in that include: S1, split the virus feature library to obtain multiple virus split libraries; S2, build the top-level control component and send virus detection instructions and concurrency to the top-level control component; S3, creating a virus detection component through the top-level control component, and assigning a virus splitting library to the virus detection component; S4, document risk detection is performed through various virus detection components, and the detection results are broadcast between virus monitoring components. The same file is only detected once.
2. A method for optimizing virus detection efficiency and resource consumption according to claim 1, It is characterized in that In S1, the virus feature library is signed by a private key. When it is split into multiple virus split libraries, the virus feature library is firstly signed and verified by a public key. After the verification is correct, the virus feature library is split into multiple virus split libraries.
3. A method for optimizing virus detection efficiency and resource consumption according to claim 1, It is characterized in that In S1, when the virus feature library is split, the basis for the split classification is the specific features of the virus. The specific features of the virus include at least the key code signature of the virus program, the metadata signature based on PE file information, the certificate signature based on trust and revocation, the signature based on container metadata, the signature based on ZIP / RAR metadata, and the signature based on phishing URL / HOST.
4. A method for optimizing virus detection efficiency and resource consumption according to claim 1, It is characterized in that After the virus splitting library is split, the virus splitting library is signed and the information of the producer is added to each virus splitting library.
5. A method for optimizing virus detection efficiency and resource consumption according to claim 1, It is characterized in that In S3, when issuing a virus detection command, the top-level control component creates a virus detection component in a multi-threaded manner, obtains the file handle of the file to be detected, and sends the file handle to each virus detection component.
6. A method for optimizing virus detection efficiency and resource consumption according to claim 5, It is characterized in that In S3, when sending the file handle, a broadcast message mechanism is used for sending, and the virus splitting library allocated to each virus detection component is determined according to the number of virus detection components and the number of virus splitting libraries.
7. A method for optimizing virus detection efficiency and resource consumption according to claim 1, It is characterized in that In S4, document risk detection is performed through various virus detection components. In the step of broadcasting the detection results between virus monitoring components, the virus detection component compares the file to be detected with the virus splitting library assigned to the virus detection component. If the file to be detected matches any virus feature in the virus splitting library, the file is determined to be a risky file.
8. A method for optimizing virus detection efficiency and resource consumption according to claim 7, It is characterized in that In S4, when the file to be detected is determined to be a risky file, a notification is sent to all other virus detection components to inform them that the file to be detected is a risky file, and other virus detection components no longer load the virus splitting library to detect the file to be detected.
9. A method for optimizing virus detection efficiency and resource consumption according to claim 7, It is characterized in that In S4, the virus detection component compares the file to be detected with the virus splitting library assigned to the virus detection component. If the file to be detected does not match any virus feature in the virus splitting library, other virus splitting libraries will continue to be retrieved for file comparison. If all virus splitting libraries are retrieved and compared, and the file to be detected does not match any virus feature in the virus splitting library, the file to be detected is determined to be risk-free and a detection result is generated.
10. A system for optimizing virus detection efficiency and resource consumption, It is characterized in that The system includes a virus feature library, a top-level control component, a message notification component and a virus detection component. The top-level control component is used to create the virus detection component and send virus detection commands, concurrency and virus splitting library to the virus detection component. The virus feature library is used to store the features of various viruses.
