Message analysis method and device, equipment and medium
Through hardware identification and template matching technology, the message domain segment data is extracted and spliced, which solves the problems of high delay and poor scalability in the existing message protocol analysis methods, and realizes efficient and flexible message analysis.
Patent Information
- Application Number
- CN202411345382.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-25
AI Technical Summary
Among the existing message protocol analysis methods, soft resolution delay is high, hard resolution can be identified by limited number of message protocols, and weak scalability, making it difficult to meet the resolution requirements of new message formats.
By obtaining the hardware identification results of the message to be parsed, obtaining the matching template, extracting and splicing the target domain segment data, comparing the templates in the protocol template library, determining the message type, and building a protocol template library to support custom reports Extended parsing of text format.
It improves the identification capacity and flexibility of hard packet analysis, reduces delay, improves analysis efficiency and accuracy, and meets the resolution requirements of new packet formats.
Smart Images

Figure CN119211392A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of message parsing, and in particular to a message parsing method, device, equipment and medium. Background Art
[0002] Message protocol parsing is to identify and distinguish the various network protocols encapsulated in the message to ensure data transmission.
[0003] In the related art, there are two main methods for message protocol analysis: soft analysis and hard analysis. Among them, soft analysis has a high latency, hard analysis can only identify a limited number of message protocols, and has weak scalability.
[0004] In view of this, a highly scalable message parsing method is needed. Summary of the invention
[0005] In view of this, the present invention provides a message parsing method, which can improve the recognition capacity and flexibility of message hard parsing.
[0006] In a first aspect, the present invention provides a message parsing method, the method comprising: obtaining a hardware recognition result of a message to be parsed, wherein the hardware recognition result represents a basic type of the message to be parsed; based on the hardware recognition result, obtaining a first matching template that matches the message to be parsed; based on the first matching template, extracting and splicing target domain segment data of the message to be parsed; comparing the splicing result with a protocol template in a protocol template library, and determining the message type of the message to be parsed based on the comparison result.
[0007] In this embodiment, by obtaining a matching template that matches the message to be parsed and extracting the message domain, the target domain data in the message to be parsed can be quickly identified and extracted, thereby improving the efficiency of message parsing. By comparing the splicing result and the protocol template to determine the message type of the message to be parsed, the flexibility and scalability of the method can be improved.
[0008] In an optional implementation, obtaining the hardware recognition result of the message to be parsed includes: receiving the message to be parsed and obtaining the target field of the message to be parsed; and determining the basic type of the message to be parsed based on the target field.
[0009] In this implementation, by acquiring the target field of the message to be parsed to determine the basic type of the message to be parsed, the efficiency of message parsing can be improved.
[0010] In an optional embodiment, based on the hardware identification result, obtaining a first matching template that matches the message to be parsed includes: determining a first feature set of the message to be parsed based on the hardware identification result, wherein the first feature set includes message header information of the message to be parsed; comparing the first feature set with the matching templates in the matching template set, and determining the first matching template based on the comparison result.
[0011] In this embodiment, by obtaining the first feature set of the message to be parsed and obtaining the first matching template, the message to be parsed can be quickly processed and the message to be parsed can be standardized by comparing with the matching templates in the matching template set.
[0012] In an optional embodiment, the method also includes: obtaining a message type set of the message to be parsed, wherein the message type set includes at least one message type; based on the message type set, generating and configuring a matching template, wherein the matching template corresponds to at least one message type in the message type set; and constructing a matching template set containing the matching template.
[0013] In this embodiment, a matching template set is constructed according to a message type set of messages to be parsed, which can improve the efficiency of message parsing. Moreover, the matching template set can cover multiple message types, thereby improving the adaptability and flexibility of the method.
[0014] In an optional embodiment, based on the first matching template, extracting and splicing the target field segment data of the message to be parsed includes: determining the position and length of the target field segment based on the first matching template; and extracting and splicing the target field segment data in the message to be parsed according to the position and length of the target field segment.
[0015] In this embodiment, the position and length of the target domain segment are determined according to the first matching template to extract corresponding data, which can provide information for subsequent message parsing and improve the efficiency of the method.
[0016] In an optional implementation, when the splicing result fails to be compared with the protocol template in the protocol template library, the message type of the message to be parsed is the basic type of the message to be parsed.
[0017] In this implementation, if the comparison fails, the original message type is retained, which can prevent incorrect processing of the message and improve the stability of the method.
[0018] In an optional embodiment, the method also includes constructing a protocol template library: based on the application task of the message to be parsed, obtaining a message protocol type set, wherein the message protocol type set includes several message protocol types that support the application task; constructing a protocol template library corresponding to the message protocol type set, wherein the protocol templates contained in the protocol template library correspond to the message protocol types in the message protocol type set.
[0019] In this implementation, by constructing a protocol template library, the efficiency and accuracy of message parsing can be improved.
[0020] In a second aspect, the present invention provides a message parsing device, which includes: a hardware identification module, used to obtain a hardware identification result of a message to be parsed, wherein the hardware identification result represents a basic type of the message to be parsed; a matching module, used to obtain a first matching template that matches the message to be parsed based on the hardware identification result; a processing module, used to extract and splice target domain segment data of the message to be parsed based on the first matching template; a determination module, used to compare the splicing result with the protocol template in the protocol template library, and determine the message type of the message to be parsed based on the comparison result.
[0021] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the message parsing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0022] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the message parsing method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 is a flow chart of a message parsing method according to an embodiment of the present invention;
[0025] Figure 2 is a flow chart of another message parsing method according to an embodiment of the present invention;
[0026] Figure 3 is a flow chart of another message parsing method according to an embodiment of the present invention;
[0027] Figure 4 is a structural block diagram of a message parsing device according to an embodiment of the present invention;
[0028] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0030] The embodiment of the present invention provides a message parsing method, which can flexibly support the extended parsing of custom message formats by generating and configuring protocol templates, so as to improve the flexibility of hardware recognition and meet the parsing and unloading requirements of new message formats. By expanding the number of templates in the protocol template library, the recognition capacity can be expanded. Parsing messages through hardware can reduce delays compared with soft parsing using software instructions to improve the efficiency of message parsing.
[0031] According to an embodiment of the present invention, a message parsing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0032] In this embodiment, a message parsing method is provided. Figure 1 is a flow chart of a message parsing method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0033] Step S101, obtaining a hardware identification result of a message to be parsed, wherein the hardware identification result represents a basic type of the message to be parsed.
[0034] When a message is received, it is necessary to parse the message to obtain the data contained in the message. The hardware can parse the message while transmitting data to increase the speed of message parsing. The hardware identification device can be a network processor.
[0035] The message to be parsed can be captured by the network interface card, and then the captured message to be parsed is sent to the hardware recognition device for hardware recognition of the message. After the message to be parsed is successfully recognized by the hardware, the hardware recognition device can directly output the recognition result and complete the corresponding operation according to the data transmitted by the message to be parsed. If the message to be parsed is not recognized by the hardware, it proves that the hardware recognition device does not support the recognition of this message to be parsed. At this time, only the composition structure of the message to be parsed can be output.
[0036] In an actual application, the message protocol of the message to be parsed is the IP (Internet Protocol) protocol, and the hardware identification device cannot identify the protocol / next header (next message header) field in the IP protocol header. The hardware identification device only outputs the source address and destination address of the message to be parsed.
[0037] Step S102: based on the hardware recognition result, obtain a first matching template that matches the message to be parsed.
[0038] Before obtaining the first matching template, the type and structure of the message to be parsed can be determined according to the application task of the message parsing method. According to the message type and structure, the field that can uniquely identify the message type can be identified. According to the message structure, one or more matching templates are written, and each matching template can correspond to the message type.
[0039] The prepared matching templates can be integrated into a library to facilitate searching for the first matching template that matches the message to be parsed.
[0040] In some optional implementations, after the matching template is written, the matching template may be tested using sample message data, and the matching template may be adjusted according to the test result.
[0041] In the process of obtaining the first matching template, it is necessary to first analyze the hardware identification result, obtain the characteristic information of the hardware identification result, compare it with each matching template, and use the matching template that successfully matches as the first matching template. The characteristic information may include the port number, the specific value of the message protocol field, the message sequence number, etc.
[0042] Step S103: extracting and concatenating target domain segment data of the message to be parsed based on the first matching template.
[0043] Among them, the target domain segment data can be extracted at the corresponding position of the message header of the message to be parsed according to the first matching template, wherein the number of target domain segments is not limited. If the number of target domain segments is 1, the data of the target domain segments can be directly extracted. If the number of target domain segments is not 1, after determining the position of each target domain segment, the data of each target domain segment is extracted, and the extracted data of each target domain segment is spliced according to the extraction order.
[0044] Step S104, comparing the splicing result with the protocol template in the protocol template library, and determining the message type of the message to be parsed based on the comparison result.
[0045] Among them, the method of obtaining the protocol template library is not restricted. The protocol templates can be obtained from the relevant platform to build the protocol template library, or the protocol templates can be written and configured by the staff to obtain the protocol template library.
[0046] After the splicing result is successfully compared with any protocol template in the protocol template library, the message type of the message to be parsed can be updated according to the protocol template.
[0047] In some optional implementations, after determining the message type of the message to be parsed, the offset value of the message to be parsed can be obtained according to the protocol template corresponding to the message to be parsed. Wherein, in the case where the message to be parsed does not contain a variable length field, the offset value of the message to be parsed can be determined according to the length of the field in the message to be parsed. In an actual application, the IP header length of the message to be parsed is 20 bytes, then the offset value of the TCP (Transmission Control Protocol) load is the sum of the IP header length and the TCP header length.
[0048] If the splicing result and the protocol template in the protocol template library are not compared successfully, the message type of the message to be parsed is the same as the hardware identification result and does not need to be updated.
[0049] The message parsing method provided in this embodiment can quickly identify and extract the target domain data in the message to be parsed by obtaining a matching template that matches the message to be parsed and extracting the message domain segment, thereby improving the efficiency of message parsing. By comparing the splicing result and the protocol template to determine the message type of the message to be parsed, the flexibility and scalability of the method can be improved.
[0050] In this embodiment, a message parsing method is provided. Figure 2 is a flow chart of a message parsing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0051] Step S201, obtaining a hardware identification result of the message to be parsed, wherein the hardware identification result represents a basic type of the message to be parsed.
[0052] Specifically, the above step S201 includes:
[0053] Step S2011, receiving a message to be parsed, and obtaining a target field of the message to be parsed.
[0054] Among them, a screening rule can be set on the hardware identification device to obtain the target field of the message to be parsed. Among them, the target field is used to identify the type of the message to be parsed, which may include Ethernet type, IP protocol number, TCP / UDP (User Datagram Protocol) port number, etc.
[0055] Step S2012: Determine the basic type of the message to be parsed based on the target field.
[0056] The basic type of the message to be parsed can be determined by the content of the target field. In an actual application, the target field includes the protocol field of the message to be parsed. When the protocol field is 6, it indicates that the message to be parsed is TCP.
[0057] Step S202: based on the hardware recognition result, obtain a first matching template that matches the message to be parsed.
[0058] Specifically, the above step S202 includes:
[0059] Step S2021: determining a first feature set of the message to be parsed based on the hardware recognition result, wherein the first feature set includes message header information of the message to be parsed.
[0060] In addition to the message header information of the message to be parsed, the first feature set may also include the sequence number, tail information, etc. of the message to be parsed. The feature information such as the composition structure and sequence number of the message to be parsed may be obtained according to the hardware recognition result to construct the first feature set. The feature information may be directly extracted from the message to be parsed.
[0061] Step S2022: compare the first feature set with the matching templates in the matching template set, and determine a first matching template based on the comparison result.
[0062] The matching template defines the message features of different types of messages, and the first feature set of the message to be parsed is compared with the message features defined by different matching templates. If the first feature set is the same as the message features defined by the matching template, it indicates that the message to be parsed matches the matching template, and the matching template is used as the first matching template.
[0063] If the first feature set is not completely identical to the message features defined by the matching template, it indicates that the message to be parsed fails to match the matching template.
[0064] In some optional implementations, the above step S2022 includes:
[0065] Step a1, obtaining a message type set of the message to be parsed, wherein the message type set includes at least one message type.
[0066] Among them, the message types that need to be identified can be determined according to actual applications, and a message type set including all message types that need to be identified can be constructed.
[0067] Step a2: Generate and configure a matching template based on the message type set, wherein the matching template corresponds to at least one message type in the message type set.
[0068] Get the message structure of each message type in the message type set, and generate the corresponding message template according to the message structure. The message structure can be obtained from the manual of the message type. In an actual application, it is necessary to generate a TCP message template. The structure of the TCP message including the source port, destination port, etc. can be obtained from the TCP protocol manual. Then, the corresponding template is generated according to the TCP message structure. After the matching template is generated and configured, the matching template can be tested using a message sample.
[0069] Step a3: construct a matching template set including matching templates.
[0070] According to the message type set of the message to be parsed, a matching template set is constructed to improve the efficiency of message parsing. Moreover, the matching template set can cover multiple message types, thereby improving the adaptability and flexibility of the method.
[0071] Step S203: extracting and concatenating target domain segment data of the message to be parsed based on the first matching template.
[0072] For details, please see Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0073] Step S204, comparing the splicing result with the protocol template in the protocol template library, and determining the message type of the message to be parsed based on the comparison result.
[0074] For details, please see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0075] The message parsing method provided in this embodiment can improve the efficiency of message parsing by obtaining the target field of the message to be parsed to determine the basic type of the message to be parsed. By obtaining the first feature set of the message to be parsed, the first matching template is obtained. The message to be parsed can be processed quickly. By comparing with the matching template in the matching template set, the message to be parsed can be standardized.
[0076] In this embodiment, a message parsing method is provided. Figure 3 is a flow chart of a message parsing method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0077] Step S301, obtaining a hardware identification result of the message to be parsed, wherein the hardware identification result represents a basic type of the message to be parsed.
[0078] For details, please see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0079] Step S302: Based on the hardware recognition result, a first matching template matching the message to be parsed is obtained.
[0080] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0081] Step S303: extract and concatenate target domain segment data of the message to be parsed based on the first matching template.
[0082] Specifically, the above step S303 includes:
[0083] Step S3031, based on the first matching template, determine the position and length of the target domain segment.
[0084] The selection and number of target domain segments are not limited. According to actual conditions, domain segments containing information can be selected as target domain segments. According to the position and length of each target domain segment in the first matching template, the corresponding position and length in the message to be parsed are determined.
[0085] Step S3032: extract and concatenate the data of the target field segment in the message to be parsed according to the position and length of the target field segment.
[0086] Among them, when the number of target domain segments is 1, the data of the target domain segments can be directly extracted according to the position and length of the target domain segments in the message to be parsed. If the number of target domain segments is not 1, after determining the position of each target domain segment, the data of each target domain segment is extracted, and the extracted data of each target domain segment is spliced according to the extraction order.
[0087] Step S304, comparing the splicing result with the protocol template in the protocol template library, and determining the message type of the message to be parsed based on the comparison result.
[0088] For details, please see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0089] In some optional implementations, when the splicing result fails to be compared with the protocol template in the protocol template library, the message type of the message to be parsed is the basic type of the message to be parsed.
[0090] Keeping the original message type when the comparison fails can prevent incorrect processing of the message and improve the stability of the method.
[0091] In some optional implementations, before step S304, the following steps are further included:
[0092] Step b1, based on the application task of the message to be parsed, obtain a message protocol type set, wherein the message protocol type set includes several message protocol types that support the application task.
[0093] Among them, according to the application task of the message to be parsed, the message protocol type that needs to be identified is determined, and a message protocol type set containing the message protocol type is constructed.
[0094] In an actual application, if the application task of the message to be parsed is an online game, it is necessary to identify the UDP protocol, etc., and the message protocol type set needs to include the UDP protocol.
[0095] Step b2: construct a protocol template library corresponding to the message protocol type set, wherein the protocol templates contained in the protocol template library correspond to the message protocol types in the message protocol type set.
[0096] According to the protocol type in the message protocol type set, the message structure corresponding to each protocol type is obtained, and then the corresponding protocol template is created according to the message structure. The protocol template contains the necessary fields of the protocol type. A protocol template library containing each protocol template is constructed.
[0097] In some optional implementations, the message protocol type set includes a first custom message protocol. According to the structure of the first custom message protocol, a corresponding protocol template can be created. The protocol template library includes the protocol template of the first custom message protocol, and the message to be parsed of the first custom message protocol can be parsed, thereby expanding the capacity of identifying message types. The flexibility of the method is improved.
[0098] By building a protocol template library, the efficiency and accuracy of message parsing can be improved.
[0099] The message parsing method provided in this embodiment determines the position and length of the target domain segment according to the first matching template to extract corresponding data, which can provide information for subsequent message parsing and improve the efficiency of the method.
[0100] In this embodiment, a message parsing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0101] This embodiment provides a message parsing device, such as Figure 4 As shown, including:
[0102] The hardware identification module 401 is used to obtain the hardware identification result of the message to be parsed, wherein the hardware identification result represents the basic type of the message to be parsed;
[0103] A matching module 402, configured to obtain a first matching template that matches the message to be parsed based on the hardware recognition result;
[0104] The processing module 403 is used to extract and piece together the target domain segment data of the message to be parsed based on the first matching template;
[0105] The determination module 404 is used to compare the splicing result with the protocol template in the protocol template library, and determine the message type of the message to be parsed based on the comparison result.
[0106] In some optional implementations, the hardware identification module 401 includes:
[0107] The target field acquisition unit is used to receive the message to be parsed and acquire the target field of the message to be parsed.
[0108] The basic type determination unit is used to determine the basic type of the message to be parsed based on the target field.
[0109] In some optional implementations, the matching module 402 includes:
[0110] The feature determination unit is used to determine a first feature set of the message to be parsed based on the hardware recognition result, wherein the first feature set includes message header information of the message to be parsed.
[0111] The matching template determining unit is used to compare the first feature set with the matching templates in the matching template set, and determine the first matching template based on the comparison result.
[0112] In some optional implementations, the message parsing device further includes:
[0113] The matching template set building module 405 is used to build a matching template set.
[0114] The matching template set construction module 405 includes:
[0115] The message type set acquisition unit is used to acquire a message type set of the message to be parsed, wherein the message type set includes at least one message type.
[0116] The matching template acquisition unit is used to generate and configure a matching template based on a message type set, wherein the matching template corresponds to at least one message type in the message type set.
[0117] The template set building unit is used to build a matching template set containing matching templates.
[0118] In some optional implementations, the processing module 403 includes:
[0119] The target domain segment determination unit is used to determine the position and length of the target domain segment based on the first matching template.
[0120] The target field segment data acquisition unit is used to extract and piece together the data of the target field segment in the message to be parsed according to the position and length of the target field segment.
[0121] In some optional implementations, when the splicing result fails to be compared with the protocol template in the protocol template library, the message type of the message to be parsed is the basic type of the message to be parsed.
[0122] In some optional implementations, the message parsing device further includes:
[0123] The protocol template library building module 406 is used to build a protocol template library.
[0124] The protocol template library construction module 406 includes:
[0125] The message protocol type set acquisition unit is used to acquire a message protocol type set based on an application task of the message to be parsed, wherein the message protocol type set includes several message protocol types supporting the application task.
[0126] The protocol template library construction unit is used to construct a protocol template library corresponding to the message protocol type set, wherein the protocol templates contained in the protocol template library correspond to the message protocol types in the message protocol type set.
[0127] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0128] The message parsing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0129] The embodiment of the present invention also provides a computer device having the above Figure 4 The message parsing device shown.
[0130] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0131] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0132] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0133] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0134] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0135] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0136] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0137] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0138] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0139] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A message parsing method, characterized in that: The method comprises: Obtaining a hardware identification result of the message to be parsed, wherein the hardware identification result represents a basic type of the message to be parsed; Based on the hardware recognition result, obtaining a first matching template that matches the message to be parsed; Extracting and splicing target domain segment data of the message to be parsed based on the first matching template; The concatenation result is compared with the protocol template in the protocol template library, and based on the comparison result, the message type of the message to be parsed is determined.
2. The method according to claim 1, characterized in that The obtaining of the hardware identification result of the message to be parsed includes: Receive the message to be parsed and obtain the target field of the message to be parsed; Based on the target field, the basic type of the message to be parsed is determined.
3. The method according to claim 1, characterized in that The acquiring, based on the hardware recognition result, a first matching template matching the message to be parsed comprises: Determine a first feature set of the message to be parsed based on the hardware recognition result, wherein the first feature set includes message header information of the message to be parsed; The first feature set is compared with the matching templates in the matching template set, and a first matching template is determined based on the comparison result.
4. The method according to claim 3, characterized in that: The method further comprises: Obtaining a message type set of a message to be parsed, wherein the message type set includes at least one message type; Based on the message type set, generating and configuring a matching template, wherein the matching template corresponds to at least one message type in the message type set; Construct a matching template set including the matching template.
5. The method according to claim 1, characterized in that The extracting and splicing the target domain segment data of the message to be parsed based on the first matching template includes: Based on the first matching template, determine the position and length of the target domain segment; According to the position and length of the target field segment, the data of the target field segment in the message to be parsed is extracted and spliced.
6. The method according to claim 1, characterized in that In the case where the splicing result fails to be compared with the protocol template in the protocol template library, the message type of the message to be parsed is the basic type of the message to be parsed.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises constructing a protocol template library: Based on the application task of the message to be parsed, obtaining a message protocol type set, wherein the message protocol type set includes several message protocol types that support the application task; A protocol template library corresponding to the message protocol type set is constructed, wherein the protocol templates contained in the protocol template library correspond to the message protocol types in the message protocol type set.
8. A message parsing device, characterized in that: The device comprises: A hardware identification module, used to obtain a hardware identification result of the message to be parsed, wherein the hardware identification result represents a basic type of the message to be parsed; A matching module, used for acquiring a first matching template matching the message to be parsed based on the hardware recognition result; A processing module, used for extracting and splicing target domain segment data of the message to be parsed based on the first matching template; The determination module is used to compare the splicing result with the protocol template in the protocol template library, and determine the message type of the message to be parsed based on the comparison result.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the message parsing method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the message parsing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Message processing method and apparatus
CN105024985A
Message parser and design method thereof
CN111131159A
Industrial control protocol analysis method and device, electronic equipment and storage medium
CN112671726A
Method and system for realizing communication interconnection of various devices based on intelligent message template
CN114928648A
Method and device for analyzing log data of LCU system based on python and mysql
CN115658783A
Cited By
Device and method for generating network message
CN120111126A
Data analysis method, related device and electronic equipment
CN120785802A
Configurable message packet header generation method and device
CN121056528A