Network protocol analysis and processing method, device, program product, and equipment
Through the element set protocol parsing module and multi-threaded concurrent matching processing technology, the problem of poor flexibility in network protocol parsing in the existing technology is solved, flexible parsing of new protocols is achieved, development costs and learning difficulty are reduced, and network security is improved product competitiveness.
Patent Information
- Application Number
- CN202411025174.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-30
AI Technical Summary
Existing technologies have poor flexibility when dealing with emerging network protocols, which results in developers needing to understand various protocols, making learning difficult, resulting in long development cycles, low development efficiency, and high labor costs. Moreover, the existing methods are difficult to implement in terms of parsing technology. It is an exhaustive classification of existing protocols, a hard-coding method, and not flexible enough.
The element set protocol parsing module is used to process network messages that cannot be parsed by the hard-coded protocol parsing module through pre-configured element set rules, and multi-threaded concurrent matching processing is used to flexibly configure new element set rules to cope with new protocols, improving Parsing flexibility and efficiency.
It reduces development costs, improves the flexibility and efficiency of network protocol analysis, reduces learning difficulty and operating costs for R&D personnel, and enhances the competitiveness of network security products.
Smart Images

Figure CN118573754B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and specifically to a network protocol parsing and processing method, device, program product, and equipment. Background Art
[0002] A network protocol is a set of rules, standards or agreements established for data exchange in a computer network. It is a set of rules that must be followed when exchanging information between peer entities communicating with each other in a computer network. Network protocols usually include standard protocols defined by an organization or institution in the industry and application layer protocols developed by the communicating parties.
[0003] In actual scenarios, with the passage of time and technological development, there are more and more types of relevant application layer protocols; for example, in the fields of industrial control, Internet of Things, and mobile communications, there are more and more new application layer protocols, including many private protocols. In the implementation of relevant network security supervision, application layer protocol parsing and implementation development are required. For example, in the development process of traffic parsing engines, developers are usually required to learn relevant protocol specifications one by one, and then sort them out and develop them.
[0004] In the process of realizing the present invention, the inventors found that, facing the above-mentioned actual scenarios, this development method and technical implementation have at least the following problems: R&D personnel are required to understand various network protocols, which has a high learning difficulty, resulting in a long development cycle and low development efficiency; the labor cost is high. For example, there are very few R&D personnel who have a comprehensive understanding of all protocols, and the R&D personnel themselves have high salaries, which will lead to high operating costs for R&D companies related to this field; and from the perspective of technical implementation, the existing method, in terms of parsing technology implementation, is to perform exhaustive classification on the parsing of existing protocols, and then adopt a hard-coded method, which has poor flexibility when dealing with new protocols.
[0005] Therefore, faced with the continuous emergence of new protocols in practice, how to propose a flexible network protocol parsing and processing implementation solution has become a technical problem that needs to be solved urgently.
[0006] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0007] In order to overcome the problems existing in the related art to at least a certain extent, the embodiments of the present application provide a network protocol parsing and processing method, apparatus, program product, and equipment to help flexibly respond to the needs of actual scenarios.
[0008] First,
[0009] The present invention provides a method for analyzing a network protocol, which includes:
[0010] Obtain network packets that the hard-coded protocol parsing module fails to parse and identify;
[0011] Importing the network message into the element set protocol parsing module, so that the element set protocol parsing module performs protocol parsing processing according to the loaded element set rules, outputs the parsed message content or discards the network message that cannot be parsed;
[0012] Among them, the element set rules are pre-configured rules for network protocol parsing, and each of the element set rules is composed of multiple element groups. The element groups include a network element group composed of network elements acting on the network layer and the transport layer, and an information element group composed of information elements acting on the session layer, presentation layer and application layer.
[0013] In a possible implementation, each of the element set rules includes a network element group and a plurality of information element groups, and the process of performing protocol parsing includes:
[0014] For the imported network messages, the information represented by the network element group in the currently loaded element set rule is used to determine whether the rule matches or not.
[0015] In the case of rule matching, the rules represented by multiple information element groups in the currently loaded element set rules are matched cyclically until all information element groups are matched, and the message content after parsing and identification is obtained. In the process of information element group cyclic matching, if a match cannot be achieved, the network message is discarded;
[0016] If the rule match fails, the next element set rule is loaded for cyclic matching until all element set rules are matched. During this process, if the network element groups of all element set rules cannot be matched, the network message is discarded.
[0017] A possible implementation manner further includes storing and processing the discarded network messages that cannot be parsed, so as to perform manual analysis based on the messages to implement the writing and configuration of new element set rules.
[0018] In a possible implementation, the element set protocol parsing module performs concurrent matching processing based on a multi-threaded manner during the process of performing protocol parsing processing according to the loaded element set rules.
[0019] In a possible implementation, there are multiple network elements, including a transport layer protocol element for configuring transport layer protocol type information, and a port element for configuring port information.
[0020] In a possible implementation, the information elements include:
[0021] Content name element used to configure the actual name or meaning information of the content;
[0022] Content position element used to configure the absolute or relative position information of the content in the data packet;
[0023] Content length element used to configure fixed length information or information with a length calculated based on a certain content result;
[0024] The content type element is used to configure the data type information of the content, where the data types include bit, byte, double byte, unsigned integer, signed integer, floating point number, string, character block, and extracting partial bits across bytes.
[0025] In a possible implementation, the hard-coded protocol parsing module is implemented based on a parsing engine of a Suricata tool or a Snort tool.
[0026] Second,
[0027] The embodiment of the present application provides a network protocol parsing processing device, which includes a hard-coded protocol parsing module; and further includes:
[0028] An acquisition and import module, used for acquiring the network message that the hard-coded protocol parsing module fails to parse and identify, and importing the network message into the element set protocol parsing module;
[0029] The element set protocol parsing module is used to perform protocol parsing processing on the network message according to the loaded element set rules, output the parsed message content or discard the network message that cannot be parsed;
[0030] Among them, the element set rules are pre-configured rules for network protocol parsing, and each of the element set rules is composed of multiple element groups. The element groups include a network element group composed of network elements acting on the network layer and the transport layer, and an information element group composed of information elements acting on the session layer, presentation layer and application layer.
[0031] Thirdly,
[0032] An embodiment of the present application provides a computer program product, including a computer program code. When the computer program code is executed on a computer, the computer is enabled to execute the above-mentioned method.
[0033] Fourthly,
[0034] An embodiment of the present application provides an electronic device, including:
[0035] A memory having an executable program stored therein;
[0036] A processor is used to execute the executable program in the memory to implement the steps of the above method.
[0037] The network protocol parsing processing method provided in the embodiment of the present application includes obtaining a network message that a hard-coded protocol parsing module fails to parse and identify; importing the network message into an element set protocol parsing module, so that the element set protocol parsing module performs protocol parsing processing according to the loaded element set rules, outputs the parsed message content or discards the network message that fails to be parsed; wherein the element set rules are pre-configured rules for network protocol parsing, and each element set rule is composed of multiple element groups, and the element groups include a network element group composed of network elements acting on the network layer and the transport layer, and an information element group composed of information elements acting on the session layer, the presentation layer and the application layer. In the technical solution of the present application, in the implementation of network protocol parsing and processing, in addition to the existing hard-coded protocol parsing module, an element set protocol parsing module is set as a bypass. The element set protocol parsing module processes the network messages that the hard-coded protocol parsing module fails to parse based on the loaded element set rules. The element set rules here are pre-configurable. In this way, when new related application layer protocols appear in actual scenarios, they can be parsed by configuring new element set rules. This network protocol parsing and processing implementation method is highly flexible and conducive to reducing development costs.
[0038] Other advantages, objectives, and features of the present application will be described in part in the following description, and in part will be apparent to those skilled in the art based on the following examination and study, or may be taught from the practice of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings are used to provide a further understanding of the technical solution of the present application or the prior art, and constitute a part of the specification. Among them, the accompanying drawings expressing the embodiments of the present application are used together with the embodiments of the present application to explain the technical solution of the present application, but do not constitute a limitation on the technical solution of the present application.
[0040] Figure 1 A flowchart of a network protocol parsing method provided by an embodiment of the present application;
[0041] Figure 2 A schematic diagram illustrating the implementation logic of a network protocol parsing processing method in one embodiment of the present application;
[0042] Figure 3 A schematic diagram illustrating the implementation logic of parsing processing performed by an element set protocol parsing module in one embodiment of the present application;
[0043] Figure 4This is a schematic diagram for explaining the element set rules corresponding to the LLMNR protocol in one embodiment of the present application;
[0044] Figure 5 A schematic diagram of the structure of a network protocol parsing and processing device provided in one embodiment of the present application;
[0045] Figure 6 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other implementation methods obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0047] As described in the background technology, in actual scenarios, with the passage of time and technological development, the types of relevant application layer protocols are increasing; for example, in the fields of industrial control, Internet of Things, and mobile communications, there are more and more new application layer protocols, including many private protocols. In the implementation of relevant network security supervision, application layer protocol parsing and implementation development are required. For example, in the development process of traffic parsing engines, developers are usually required to learn relevant protocol specifications one by one, and then sort them out and develop them.
[0048] In the process of realizing the present invention, the inventors found that, facing the above-mentioned actual scenarios, this development method and technical implementation have at least the following problems: R&D personnel are required to understand various network protocols, which has a high learning difficulty, resulting in a long development cycle and low development efficiency; the labor cost is high. For example, there are very few R&D personnel who have a comprehensive understanding of all protocols, and the R&D personnel themselves have high salaries, which will lead to high operating costs for R&D companies related to this field; and from the perspective of technical implementation, the existing method, in terms of parsing technology implementation, is to perform exhaustive classification on the parsing of existing protocols, and then adopt a hard-coded method, which has poor flexibility when dealing with new protocols.
[0049] Based on this, the present application proposes a network protocol parsing and processing method to help flexibly respond to the needs of actual scenarios.
[0050] In one embodiment, if Figure 1 As shown, the network protocol parsing processing method proposed in this application includes:
[0051] Step S110, obtaining the network message that the hard-coded protocol parsing module fails to parse and identify.
[0052] It should be noted that the hard-coded protocol parsing module here is designed and developed according to the OSI / RM model, and its implementation method can be implemented by using existing related technologies. For example, the hard-coded protocol parsing module here is implemented based on the parsing engine of the Suricata tool or the Snort tool;
[0053] In actual implementation scenarios, such as Figure 2 As shown, the network message to be processed is first processed by a hard-coded protocol parsing module. When the network message is not supported by the hard-coded protocol parsing module (or the protocol of the message is not supported), the unsupported message will be thrown out by the hard-coded protocol parsing module (the same as the prior art). In this step, the network message that cannot be parsed and identified is obtained for subsequent processing.
[0054] Then, step S120 is performed to import the network message obtained in step S110 into the element set protocol parsing module, so that the element set protocol parsing module performs protocol parsing processing according to the loaded element set rules, outputs the parsed message content or discards the network message that cannot be parsed;
[0055] Among them, the element set rules are pre-configured rules for network protocol parsing. Each element set rule is composed of multiple element groups. The element groups include network element groups composed of network elements acting on the network layer and the transport layer, and information element groups composed of information elements acting on the session layer, presentation layer and application layer.
[0056] In other words, in this step, Figure 2 As shown, the obtained network message is imported into the element set protocol parsing module, and the element set protocol parsing module performs parsing processing according to the loaded element set rules to output the parsed message content or discard the network message that cannot be parsed. The element set rules are pre-configured rules for network protocol parsing, that is, when new related application layer protocols appear in actual scenarios, they can be parsed by configuring new element set rules. This network protocol parsing processing implementation method is highly flexible and conducive to reducing development costs.
[0057] Further, such as Figure 2 As shown, as a specific implementation method, the network protocol parsing processing method proposed in the present application also includes storing and processing the discarded network messages that cannot be parsed, so as to perform manual analysis based on them to realize the writing and configuration of new element set rules; in addition, it should be noted that, if Figure 2 As shown, in the actual implementation of the solution, the initial element set rules can be edited based on manual analysis of the network messages thrown out by the hard-coded protocol parsing module.
[0058] It should also be noted that in this application, unlike similar implementations in related technologies, the element set rules in this application adopt a targeted construction method. In terms of classification, each element set rule is composed of multiple element groups, including network element groups composed of network elements acting on the network layer and the transport layer, and information element groups composed of information elements acting on the session layer, presentation layer, and application layer. In the technical scenario of this application, this construction method is conducive to the writing and implementation of corresponding element set rules for newly emerging protocols, reduces the difficulty of implementing the solution, and is conducive to improving the market competitiveness of related network security products.
[0059] Specifically, in this embodiment, an element set rule corresponds to a certain protocol, and the element set rule is composed of multiple element groups, and the element group is formed by combining several elements, and the elements mainly include two categories: network elements and information elements; if each element set rule includes a network element group and multiple information element groups, then its composition form is,
[0060] Element set rule format = protocol identifier + network element group + information element group 1 + information element group 2 + information element group 3 + ... + information element group n.
[0061] Based on the above embodiments, in some embodiments, each element set rule includes a network element group and multiple information element groups, such as Figure 3 As shown, in this embodiment, the process of performing protocol parsing includes:
[0062] For the imported network messages, the information represented by the network element group in the currently loaded element set rule is used to determine whether the rule matches or not.
[0063] In the case of a rule match hit (corresponding to Figure 3 The first judgment link in the process is branching), cyclically matching the rules represented by multiple information element groups in the currently loaded element set rules until all information element groups are matched, and the message content after parsing and identification is obtained (that is, when the corresponding information elements are matched, the parsing is performed and the corresponding content is obtained). During the cyclic matching process of the information element groups, if the match cannot be achieved, the network message is discarded;
[0064] In the case of a rule mismatch (corresponding to Figure 3 The first judgment link in the negative branch), continue to load the next element set rule for loop matching processing until all element set rules are matched once. In this process, if all network element groups of element set rules cannot be matched (corresponding to Figure 3 The right side of the judgment link is a branch), then the network message is discarded.
[0065] Furthermore, in some embodiments, during the process of performing protocol parsing processing according to the loaded element set rules, the element set protocol parsing module performs concurrent matching processing based on a multi-threaded manner to fully utilize relevant computing resources and improve processing efficiency.
[0066] To facilitate understanding of the technical solution of the present application, the composition of the element set rules in the technical solution of the present application is further introduced below.
[0067] As mentioned above, the element set rule composition in this application can be expressed in the following form:
[0068] Element set rule format = protocol identifier + network element group + information element group 1 + information element group 2 + information element group 3 + ... + information element group n.
[0069] In the application scenario of this application, there are many network elements in practice, such as:
[0070] The transport layer protocol element is used to configure the transport layer protocol type information, and the port element is used to configure the port information.
[0071] There are many types of information elements, including:
[0072] Content name element used to configure the actual name or meaning information of the content;
[0073] Content position element used to configure the absolute or relative position information of the content in the data packet;
[0074] Content length element used to configure fixed length information or information with a length calculated based on a certain content result;
[0075] A content type element for configuring data type information of the content, wherein the types of data types include bit, byte, double byte, unsigned integer, signed integer, floating point number, string, character block, and partial bit extraction between bytes;
[0076] In practice, the corresponding relationship shown in Table 1 below can be used to express the content type:
[0077] Table 1 - Content type reference table
[0078]
[0079] In combination with the above, in one implementation scenario, a network element group = transport layer protocol element + port element, an information element group = content name element + content location element + content length element + content type element + other element 1 + other element 2 + other element 3 +...
[0080] Here, we take LLMNR protocol parsing as an example to further explain the element set rules in this implementation scenario.
[0081] LLMNR (Link-Local Multicast Name Resolution) is a protocol for resolving local host names to IP addresses. It allows name resolution without a local DNS server. However, the LLMNR protocol has security risks. Attackers can send false LLMNR responses to induce the host to send data to a host controlled by the attacker, in order to steal key user data. This poses a high security risk. Therefore, efficiently identifying the LLMNR protocol will be crucial to network security.
[0082] In the existing related technologies, the conventional implementation scheme requires technicians to first learn the LLMNR protocol, then understand the meaning of each field in the protocol, and then use the development language to perform coding analysis and debugging. This will result in a long development cycle and low efficiency.
[0083] For example, Figure 4 As shown, when processing the Flags structure in the LLMNR protocol, it uses 1 byte (8 bits) to represent the five attributes of Response (1 bit), Opcode (4 bits), Conflict (1 bit), Truncated (1 bit), and Tentative (1 bit);
[0084] By adopting the technical solution of this application, the following element set rule sample can be written:
[0085] LLMNR,udp,80,{'response',44,0,0,1,0,None},{'opcode',44,1,0,4,1,None},{'conflict ',44,5,0,1,0,None},{'truncated',44,6,0,1,0,None},{'tentative',44,7,0,1,0,None}……
[0086] The corresponding element set rule composition example proposed above is:
[0087] Protocol identifier, transport layer protocol, port, {content name, content position byte, content position bit, content length byte, content length bit, content type, other elements}, {content name, content position byte, content position bit, content length byte, content length bit, content type, other elements}...
[0088] Furthermore, corresponding to the first information element group, {'response', 44, 0, 0, 1, 0, None}, the specific meaning of each element is:
[0089] response is the content name;
[0090] 44 content position bytes;
[0091] 0 content bit is set;
[0092] 0 content length bytes;
[0093] 1 content length bit;
[0094] 0Content-Type;
[0095] None other elements, indicating empty, no other elements.
[0096] From a technical point of view, the rule information represented by this information element group is that there is an attribute named response, which is offset 44 bytes from the beginning of the data packet, has a content length of 1 bit, and the content type is bit.
[0097] In this way, by writing element set rules and using the element set protocol parsing module to load the rules, the five attributes of Response, Opcode, Conflict, Truncated, and Tentative in the LLMNR protocol can be parsed very quickly. For other protocols, this method can also be used to efficiently implement network protocol parsing.
[0098] In the above implementation process, the technical solution of the present application can realize the bit-by-bit parsing of the network protocol based on the setting and construction of specific information elements, which is not achievable by the existing related technologies in the field;
[0099] For example, existing technologies such as Suricata and Snort rely on the support of the software's own parsing engine, and only implement bit parsing for the fixed attributes of the network layer of the protocol stack, and still remain at the level of byte parsing for the contents above the transport layer;
[0100] For example, in Snort rules, only the flags in the network layer can be matched, and matching above the transport layer is not supported ( http: / / manual-snort-org.s3-website-us-east-1.amazonaws.com / node33.html# SECTION00466000000000000000 ); Other data can only be parsed using bytes, such as the syntax of content matching in Suricata rules, which uses byte matching ( https: / / docs.suricata.io / en / latest / rules / payload-keywords.html#content ), such as the syntax of content matching in Suricata rules, which uses byte matching ( https: / / docs.suricata.io / en / latest / rules / payload-keywords.html# within), For example, the syntax of byte matching in Suricata rules does not support bit matching ( https: / / docs.suricata.io / en / latest / rules / payload-keywords.html#rawbytes );
[0101] Although some tools support Lua scripts, they also only support text parsing. For example, the Lua script syntax attached to Suricata rules uses byte matching and does not support bit matching ( https: / / docs.suricata.io / en / latest / rules / lua-detection.html#match-function );
[0102] Some tools use PCRE (Perl Compatible Regular Expressions) syntax, which is more flexible, but in principle it is still based on byte parsing and matching, and cannot implement bit-based parsing methods. For example, in Snort rules, PCRE (regular expression) syntax can match bytes, but cannot match content bits. http: / / manual-snort-org.s3-website-us-east-1.amazonaws.com / node32.html# SECTION004526000000000000000 ).
[0103] In summary, compared with the prior art, the technical solution of this application has the following advantages:
[0104] The technical solution of the present application effectively solves the defect that the technology in the past can only parse network messages by bytes but not by bits, and improves the industry level in the field of network analysis.
[0105] The technical solution of this application can be used as a separate module to flexibly expand protocol parsing modules such as Suricata and Snort, thereby improving the versatility of the application;
[0106] In actual applications, the technical solution of the present application only requires professionals who understand network protocols and learn specific protocols in a targeted manner to write element set rules according to the above-mentioned specifications, thereby shortening the product development cycle, improving production efficiency, and reducing the difficulty for enterprises to develop network protocols. At the same time, there is no need for R&D personnel to learn network protocols and conduct customized development, and there is no need to set up R&D positions within the team, thereby reducing the operating costs of the enterprise.
[0107] In addition, based on specific scenario requirements, the information elements acting on the session layer, presentation layer, and application layer of the network message can also be set and constructed based on the following aspects: such as fixed content, variable content, content supplement, content transformation, content comparison, line break separator, bit shift, symmetric or asymmetric ciphertext, conversion between bases, encoding conversion, date and time processing, data structure, mapping structure, etc. Specifically,
[0108] Fixed content refers to bytes or bits that are agreed to remain unchanged;
[0109] Variable content refers to bytes or bits with unspecified length;
[0110] Content supplementation refers to adding some information before or after the content to form new information elements;
[0111] Content transformation refers to the change of content after it is processed by a certain mathematical algorithm, such as a combination of addition, subtraction, multiplication, division, or, and other mathematical algorithms;
[0112] Content comparison refers to comparing and judging the content value, and using the judgment result as the basis for subsequent element processing;
[0113] The line break character is a byte or bit used to separate information elements;
[0114] Bit offset refers to the result of bit offset calculation of the content;
[0115] Symmetric or asymmetric ciphertext refers to the plaintext calculated using a decryption algorithm and a key;
[0116] Inter-base conversion refers to the conversion of content based on binary, decimal, octal, and hexadecimal.
[0117] Encoding conversion refers to the conversion operation between all character encoding sets;
[0118] Date and time processing refers to the calculation of changes based on a specific time;
[0119] Data structures refer to arrays, stacks, queues, linked lists, trees, graphs, heaps, hash tables, etc.;
[0120] A mapping structure refers to a method of mapping content to other content, such as using a dictionary table for mapping.
[0121] Figure 3 A schematic diagram of the structure of a network protocol parsing and processing device provided in one embodiment of the present application is shown in FIG. Figure 3 As shown, the domain name network protocol analysis processing device 300 includes a hard-coded protocol analysis module 301, and also includes:
[0122] The acquisition and import module 302 is used to acquire the network message that the hard-coded protocol parsing module fails to parse and identify, and import the network message into the element set protocol parsing module;
[0123] The element set protocol parsing module 303 is used to perform protocol parsing processing on the network message according to the loaded element set rules, output the parsed message content or discard the network message that cannot be parsed;
[0124] Among them, the element set rules are pre-configured rules for network protocol parsing, and each of the element set rules is composed of multiple element groups. The element groups include a network element group composed of network elements acting on the network layer and the transport layer, and an information element group composed of information elements acting on the session layer, presentation layer and application layer.
[0125] Regarding the network protocol analysis processing device 300 in the above-mentioned related embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0126] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown as follows: Figure 4 As shown, the electronic device 400 includes:
[0127] Memory 401, on which executable programs are stored;
[0128] The processor 402 is used to execute the executable program in the memory 401 to implement the steps of the above method.
[0129] Regarding the electronic device 400 in the above embodiment, the specific manner in which its processor 402 executes the program in the memory 401 has been described in detail in the embodiment of the method, and will not be elaborated here.
[0130] According to the method provided in an embodiment of the present application, a computer program product is also provided in one embodiment of the present application. The computer program product includes: a computer program code. When the computer program code runs on a computer, the computer executes the method in the above embodiment.
[0131] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0132] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0133] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0134] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by any person familiar with the technology within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A network protocol analysis and processing method, characterized in that: include: Obtain network packets that the hard-coded protocol parsing module fails to parse and identify; Importing the network message into the element set protocol parsing module, so that the element set protocol parsing module performs protocol parsing processing according to the loaded element set rules, outputs the parsed message content or discards the network message that cannot be parsed; The element set rule is a pre-configured rule for network protocol parsing, and each of the element set rules is composed of multiple element groups, including a network element group composed of network elements acting on the network layer and the transport layer, and an information element group composed of information elements acting on the session layer, the presentation layer and the application layer; Each of the element set rules includes a network element group and a plurality of information element groups. The process of performing protocol parsing includes: For the imported network messages, the information represented by the network element group in the currently loaded element set rule is used to determine whether the rule matches or not. In the case of rule matching, the rules represented by multiple information element groups in the currently loaded element set rules are matched cyclically until all information element groups are matched, and the message content after parsing and identification is obtained. In the process of information element group cyclic matching, if a match cannot be achieved, the network message is discarded; If the rule match fails, the next element set rule will be loaded for cyclic matching until all element set rules are matched. In this process, if the network element groups of all element set rules cannot be matched, the network message will be discarded. There are multiple network elements, including transport layer protocol elements for configuring transport layer protocol type information, and port elements for configuring port information; There are various information elements, including: Content name element used to configure the actual name or meaning information of the content; Content position element used to configure the absolute or relative position information of the content in the data packet; Content length element used to configure fixed length information or information with a length calculated based on a certain content result; The content type element is used to configure the data type information of the content, where the data types include bit, byte, double byte, unsigned integer, signed integer, floating point number, string, character block, and extracting partial bits across bytes.
2. The network protocol analysis processing method according to claim 1, characterized in that: The method also includes storing and processing the discarded network messages that cannot be parsed, so as to perform manual analysis based on the messages to implement the writing and configuration of new element set rules.
3. The method according to claim 1, characterized in that The element set protocol parsing module performs concurrent matching processing based on a multi-threaded manner during the process of performing protocol parsing processing according to the loaded element set rules.
4. The network protocol analysis processing method according to any one of claims 1 to 3, characterized in that: The hard-coded protocol parsing module is implemented based on the parsing engine of the Suricata tool or the Snort tool.
5. A network protocol analysis and processing device, characterized in that: Used to implement the network protocol analysis and processing method according to any one of claims 1 to 4, the network protocol analysis and processing device includes a hard-coded protocol analysis module, and also includes: An acquisition and import module, used for acquiring the network message that the hard-coded protocol parsing module fails to parse and identify, and importing the network message into the element set protocol parsing module; The element set protocol parsing module is used to perform protocol parsing processing on the network message according to the loaded element set rules, output the parsed message content or discard the network message that cannot be parsed; Among them, the element set rules are pre-configured rules for network protocol parsing, and each of the element set rules is composed of multiple element groups. The element groups include a network element group composed of network elements acting on the network layer and the transport layer, and an information element group composed of information elements acting on the session layer, presentation layer and application layer.
6. A computer program product, comprising computer program code, characterized in that When the computer program code is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 4.
7. An electronic device, characterized in that: include: a memory having an executable program stored therein; A processor, configured to execute the executable program in the memory to implement the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method and device for identifying an encrypted data stream
CN109802924A
Communication application layer protocol analysis method and system for various types of data streams
CN112511551A
Network protocol analysis method, system and device
CN112751845A
Message analysis method and device, electronic equipment and storage medium
CN115883681A
Network data packet analysis method and device and electronic equipment
CN117914974A
