Multi-protocol intelligent identification terminal direct connection communication method and system
By grouping and matching the test protocol frames of terminal devices and verification protocol frames of main control systems, the problems of low protocol matching efficiency and poor accuracy in the Internet of Things are solved, and efficient multi-protocol communication between terminal devices and main control systems are achieved.
Patent Information
- Application Number
- CN202411473508.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In the prior art, the fixed nature of communication protocols between the terminal device and the network leads to low protocol matching efficiency and poor accuracy in the Internet of Things scenario, and the inability to effectively handle the heterogeneity of multiple communication protocols.
By obtaining the reliability type of the test protocol frame of the terminal device, grouping it and matching it with the verification protocol frame of the same reliability type in the protocol library of the main control system, the structural similarity is calculated to determine the matching protocol frame, thereby realizing the terminal device. Multi-protocol communication with the master control system.
Improve the efficiency and accuracy of protocol matching, reduce unnecessary matching attempts, and improve the performance of the communication system.
Smart Images

Figure CN118984341A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a multi-protocol intelligent identification terminal direct connection communication method and system. Background Art
[0002] In traditional communication systems, the communication protocol between terminal devices and networks is often fixed. However, in the IoT scenario, there are many types of terminal devices connected to the network, and the communication protocols are different, which increases the complexity and cost of the communication system. Therefore, multi-protocol intelligent identification terminal direct communication technology came into being. It can automatically identify and adapt to different communication protocols to achieve interconnection between heterogeneous networks.
[0003] In the existing method, the protocol to be identified is usually matched with each protocol pre-stored in the protocol library of the main control system, so as to determine the protocol type of the protocol to be identified.
[0004] However, this method requires that each protocol pre-stored in the protocol library be matched separately, resulting in low matching efficiency and poor matching accuracy. Summary of the invention
[0005] The embodiment of the present invention provides a multi-protocol intelligent identification terminal direct communication method and system, which can improve the efficiency and accuracy of protocol matching.
[0006] According to one aspect of an embodiment of the present invention, a multi-protocol intelligent identification terminal direct communication method is provided, comprising: Obtaining the reliability type of each first test protocol frame of the terminal device, where the first test protocol frame is a test frame corresponding to each communication protocol in the terminal device; Grouping the first test protocol frames according to corresponding reliability types to obtain at least one protocol frame set; For each first test protocol frame in the protocol frame set, respectively calculate the structural similarity between the first test protocol frame and each corresponding verification protocol frame in the protocol library of the main control system, and verify that the reliability type of the protocol frame matches the reliability type of the protocol frame set; Sort the verification protocol frames corresponding to the first test protocol frame in order of structural similarity, and determine the verification protocol frame with the greatest structural similarity as the matching protocol frame corresponding to the first test protocol frame; Each first test protocol frame is connected and debugged according to the corresponding protocol frame sending end and the corresponding matching protocol frame to realize multi-protocol communication between the terminal device and the main control system.
[0007] In one aspect of an embodiment of the present invention, a multi-protocol intelligent identification terminal direct communication system is provided, including a terminal device, a main control system and a controller; Terminal equipment, used to communicate with the main control system; A main control system, used to communicate with terminal devices; The controller is connected to the terminal device and the main control system, and is used to execute the multi-protocol intelligent identification terminal direct communication method provided in any one of the above aspects.
[0008] In the multi-protocol intelligent identification terminal direct communication method provided by the embodiment of the present invention, each first test protocol frame is grouped according to the corresponding reliability type, and then for each first test protocol frame, it is only necessary to match each verification protocol frame of the same reliability type in the protocol library of the main control system. There is no need to match each verification protocol frame in the protocol library of the main control system, thereby improving the efficiency of protocol matching. Then, the first test protocol frame and each verification protocol frame of the same reliability type in the protocol library of the main control system are calculated for structural similarity, and the verification protocol frame with the greatest structural similarity is determined as the matching protocol frame corresponding to the first test protocol frame, thereby improving the accuracy of protocol matching. In this way, the embodiment of the present invention can improve the efficiency of protocol matching and the accuracy of protocol matching by grouping each first test protocol frame according to the corresponding reliability type, and then calculating the structural similarity of the first test protocol frame and each verification protocol frame of the same reliability type in the protocol library of the main control system, and selecting the matching protocol frame corresponding to the first test protocol frame with the greatest structural similarity. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0010] Figure 1 A schematic flow chart of a first multi-protocol intelligent identification terminal direct communication method provided by an embodiment of the present invention; Figure 2 A schematic flow chart of a second multi-protocol intelligent identification terminal direct communication method provided by an embodiment of the present invention; Figure 3 A schematic diagram of the protocol structure of a transmission control protocol provided by an embodiment of the present invention; Figure 4 A schematic flow chart of a third multi-protocol intelligent identification terminal direct communication method provided by an embodiment of the present invention; Figure 5 The present invention is a flowchart of a fourth multi-protocol intelligent identification terminal direct communication method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0011] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a multi-protocol intelligent identification terminal direct communication method proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0012] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0013] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of laws and regulations.
[0014] It should be noted that in the embodiments of the present invention, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present invention, but it does not mean that the applicant has or will necessarily use the solution.
[0015] In the existing method, the protocol to be identified is usually matched with each protocol pre-stored in the protocol library of the main control system, so as to determine the protocol type of the protocol to be identified. However, this method requires each protocol pre-stored in the protocol library to be matched separately, resulting in low matching efficiency and poor matching accuracy.
[0016] The object of the present invention is to provide a multi-protocol intelligent identification terminal direct communication method and system. In the multi-protocol intelligent identification terminal direct communication method provided by the embodiment of the present invention, each first test protocol frame is grouped according to the corresponding reliability type, and then for each first test protocol frame, it is only necessary to match each verification protocol frame of the same reliability type in the protocol library of the main control system. There is no need to match each verification protocol frame in the protocol library of the main control system, so as to improve the efficiency of protocol matching. Then, the first test protocol frame and each verification protocol frame of the same reliability type in the protocol library of the main control system are calculated for structural similarity, and the verification protocol frame with the greatest structural similarity is determined as the matching protocol frame corresponding to the first test protocol frame, so as to improve the accuracy of protocol matching. In this way, the embodiment of the present invention can improve the efficiency of protocol matching and the accuracy of protocol matching by grouping each first test protocol frame according to the corresponding reliability type, and then calculating the structural similarity of the first test protocol frame and each verification protocol frame of the same reliability type in the protocol library of the main control system, and selecting the matching protocol frame corresponding to the first test protocol frame with the greatest structural similarity.
[0017] Figure 1 A flow chart of a multi-protocol intelligent identification terminal direct communication method is provided. The multi-protocol intelligent identification terminal direct communication method can be applied to a server. The multi-protocol intelligent identification terminal direct communication method can include the following S101 to S105.
[0018] S101, obtaining the reliability type of each first test protocol frame of the terminal device, where the first test protocol frame is a test frame corresponding to each communication protocol in the terminal device.
[0019] In this embodiment, the terminal device supports multiple communication protocols, and for each communication protocol, a corresponding first test protocol frame is created respectively.
[0020] The reliability type is used to characterize whether the first test protocol frame is reliable. For example, the reliability type includes a reliable protocol and an unreliable protocol. Specifically, a reliable protocol can ensure the accuracy and integrity of data transmission, and an unreliable protocol does not guarantee the accuracy or integrity of data transmission.
[0021] As an example, the server obtains first test protocol frames corresponding to various communication protocols in the terminal device, and obtains the reliability type corresponding to the first test protocol frame.
[0022] S102: Group the first test protocol frames according to corresponding reliability types to obtain at least one protocol frame set.
[0023] In this embodiment, the protocol frame set includes at least one first test protocol frame, and the reliability types of the first test protocol frames in the protocol frame set are the same.
[0024] As an example, the server stores the reliable protocol into the first protocol frame set and stores the unreliable protocol into the second protocol frame set according to the reliability type corresponding to each first test protocol frame.
[0025] S103, for each first test protocol frame in the protocol frame set, respectively calculate the structural similarity between the first test protocol frame and the corresponding verification protocol frames in the protocol library of the main control system, and verify that the reliability type of the protocol frame matches the reliability type of the protocol frame set.
[0026] In this embodiment, a plurality of communication protocol templates are pre-stored in the protocol library of the main control system, and each communication protocol template corresponds to a verification protocol frame.
[0027] Structural similarity is used to characterize the similarity between the structures of two protocol frames. For example, the structure of a protocol frame may include the byte length of each part in the protocol and the header length of the protocol frame.
[0028] As an example, the server obtains the frame structure of each first test protocol frame in the first protocol frame set, and then obtains each verification protocol frame whose reliability type is a reliable protocol in the protocol library of the main control system, and obtains the frame structure of each verification protocol frame.
[0029] Then, the frame structure of each first test protocol frame is compared with the frame structure of each verification protocol frame to obtain the structural similarity between each first test protocol frame and each verification protocol frame.
[0030] Specifically, a protocol frame includes multiple protocol areas. Each protocol area of the first test protocol frame is compared with the corresponding protocol area of the verification protocol frame. Then, the number of protocol areas with the same structure as the verification protocol frame is counted. The number is divided by the total number of protocol areas of the first test protocol frame to obtain the structural similarity between the first test protocol frame and the verification protocol frame.
[0031] Then, for each first test protocol frame in the second protocol frame set, the server obtains the structural similarity between the corresponding first test protocol frame and the verification protocol frame according to the above method.
[0032] S104, sorting the verification protocol frames corresponding to the first test protocol frame in order of structural similarity, and determining the verification protocol frame with the greatest structural similarity as the matching protocol frame corresponding to the first test protocol frame.
[0033] In this embodiment, as an example, for each verification protocol frame corresponding to the first test protocol frame, the server sorts them in descending order according to the corresponding structural similarity, thereby selecting the corresponding verification protocol frame with the greatest structural similarity as the matching protocol frame corresponding to the first test protocol frame.
[0034] S105, connecting and debugging each first test protocol frame according to the corresponding protocol frame sending end and the corresponding matching protocol frame to realize multi-protocol communication between the terminal device and the main control system.
[0035] In this embodiment, as an example, the server obtains the protocol frame sender and the corresponding matching protocol frame corresponding to each first test protocol frame, and performs connection debugging according to the relationship between the protocol frame sender and the matching protocol frame, so that the terminal device and the main control system can communicate through multiple protocols.
[0036] Through this embodiment, each first test protocol frame is grouped according to the corresponding reliability type, and then for each first test protocol frame, it is only necessary to match each verification protocol frame of the same reliability type in the protocol library of the main control system. There is no need to match each verification protocol frame in the protocol library of the main control system, thereby improving the efficiency of protocol matching. Then, the first test protocol frame and each verification protocol frame of the same reliability type in the protocol library of the main control system are calculated for structural similarity, and the verification protocol frame with the greatest structural similarity is determined as the matching protocol frame corresponding to the first test protocol frame, thereby improving the accuracy of protocol matching. In this way, the embodiment of the present invention can improve the efficiency of protocol matching and the accuracy of protocol matching by grouping each first test protocol frame according to the corresponding reliability type, and then calculating the structural similarity between the first test protocol frame and each verification protocol frame of the same reliability type in the protocol library of the main control system, and selecting the matching protocol frame corresponding to the first test protocol frame with the greatest structural similarity.
[0037] As an optional embodiment, S101 may specifically include: Sending a type identification signal to the terminal device so that the terminal device sends each first test protocol frame to the main control system; In response to the terminal device receiving the confirmation frame fed back by the main control system, determining the reliability type of each first test protocol frame corresponding to the confirmation frame as a reliable protocol; The reliability type of each first test protocol frame other than the reliable protocol is determined as an unreliable protocol.
[0038] In this embodiment, the type identification signal is used to instruct the terminal device to send a first test protocol frame to the main control system to identify the reliability type of the first test protocol frame.
[0039] As an example, the server sends a type identification signal to the terminal device, and the terminal device receives the type identification signal sent by the server. Then, the terminal device responds to the type identification signal and sends a corresponding first test protocol frame to the main control system for each communication protocol supported by the terminal device.
[0040] After receiving the first test protocol frame sent by the terminal device, if the first test protocol frame is a reliable protocol, the main control system will return a confirmation frame to indicate that the communication is normal; if the first test protocol frame is an unreliable protocol, no confirmation frame will be returned to indicate that the communication is normal.
[0041] Therefore, the reliable type of the first test protocol frame that needs to return the confirmation frame is marked as a reliable protocol, and the reliable type of the first test protocol frame that does not need to return the confirmation frame is marked as an unreliable protocol frame. According to each confirmation frame fed back by the main control system received by the terminal device, the reliable type of each first test protocol frame can be obtained.
[0042] Through this embodiment, the terminal device sends each first test protocol frame to the main control system, and according to whether the main control system feeds back a confirmation frame, the reliability type of each first test protocol frame can be accurately determined. This helps to accurately group the first test protocol frames according to their reliability types, so that the first test protocol frames in the same protocol frame set only need to be matched with the same batch of verification protocol frames, which can improve the efficiency of protocol matching.
[0043] As an optional embodiment, Figure 2 As shown, S103 may specifically include the following S201-S204: S201, dividing the verification protocol frame into regions according to the corresponding protocol structure to obtain N verification regions corresponding to the verification protocol frame, where N is a positive integer; S202, dividing the first test protocol frame into regions according to the same protocol division method as the verification protocol frame, to obtain N test regions corresponding to the first test protocol frame; S203, matching each test area with the corresponding verification area to obtain a successfully matched matching area in each test area; S204: Determine structural similarity between the first test protocol frame and the verification protocol frame by using each matching area.
[0044] In this embodiment, the server first divides the verification protocol frame into regions according to the corresponding protocol structure to obtain N verification regions corresponding to the verification protocol frame. Figure 3As shown in the figure, a schematic diagram of the protocol structure of the Transmission Control Protocol (TCP) is provided. The TCP protocol includes header bytes and data bytes. The data bytes have no valid features for analysis, so it is only necessary to divide the header bytes into regions according to the corresponding protocol structure. The characteristic bytes of the TCP header are 20 bytes, and 1 byte is 16 bits.
[0045] Assuming that the verification protocol frame divides H bytes into N verification areas, the first test protocol frame also extracts the first N bytes and divides them into N test areas in the same way as the verification protocol frame.
[0046] After the areas are divided, each test area in the first test protocol frame is extracted and analyzed. For example, assuming that the first verification area of the verification protocol frame represents the source port information, the network analysis tool Wireshark is used to extract the binary data of the verification area and convert it into the corresponding port number, assuming that the valid range of the corresponding port number is 0 to 65535. Then extract the binary data of the first test area in the first test protocol frame and convert it into the corresponding port number to see if it is within the range of 0 to 65535. If it is within the range of 0 to 65535, it means that the match is successful.
[0047] Finally, the number of successfully matched matching areas in each test area is counted, and the number of matching areas is divided by the total number of test areas to obtain the structural similarity between the first test protocol frame and the verification protocol frame.
[0048] Through this embodiment, the verification protocol frame and the first test protocol frame are divided into regions according to the same division method, and then the divided verification regions are matched with the corresponding test regions. According to the number of successfully matched matching regions, the structural similarity between the first test protocol frame and the verification protocol frame can be determined. In this way, the present invention can accurately analyze whether the first test protocol frame and the verification protocol frame are similar by dividing the protocol frame into multiple regions and comparing each region one by one, thereby improving the accuracy of judging the structural similarity.
[0049] As an optional embodiment, before S202, the multi-protocol intelligent identification terminal direct communication method may further include: Obtaining the number of protocol frame bytes of the first test protocol frame; Compare the number of protocol frame bytes of the first test protocol frame with the number of header bytes of the verification protocol frame to obtain a byte comparison result; When the byte comparison result indicates that the number of bytes in the protocol frame is less than the number of bytes in the header, it is determined that the structural similarity between the first test protocol frame and the verification protocol frame is a preset similarity threshold.
[0050] In this embodiment, the number of protocol frame bytes is the total number of bytes in the protocol frame, that is, the number of header bytes plus the number of data bytes. The number of header bytes only refers to the number of header bytes in the protocol frame, which does not include the number of data bytes.
[0051] As an example, assuming that the number of header bytes of the verification protocol frame is H bytes, the number of protocol frame bytes of the first test protocol frame is compared with H. When the number of protocol frame bytes of the first test protocol frame is less than H, it indicates that the first test protocol frame does not match the verification protocol frame, that is, the structural similarity between the first test protocol frame and the verification protocol frame must be very low, and it is impossible to match successfully. At this time, the structural similarity between the first test protocol frame and the verification protocol frame can be directly set to the preset similarity threshold, and there is no need to calculate the structural similarity.
[0052] When the number of protocol frame bytes of the first test protocol frame is greater than or equal to H, it indicates that the first test protocol frame and the verification protocol frame may match, and the calculation of the structural similarity is continued at this time.
[0053] Through this embodiment, by comparing the number of protocol frame bytes of the first test protocol frame with the number of header bytes of the verification protocol frame, the first test protocol frame and the verification protocol frame that are obviously not matched can be determined. For the first test protocol frame and the verification protocol frame that are obviously not matched, there is no need to continue calculating the structural similarity. Thus, the amount of calculation of structural similarity can be reduced and the calculation efficiency can be improved.
[0054] As an optional embodiment, S204 may specifically include: Sort the matching regions in order of their corresponding region numbers to obtain a matching region sequence; Accumulate the number differences between two adjacent matching regions in the matching region sequence to obtain a number difference accumulation value; Divide the number of matching regions by N to get the ratio of the number of regions; According to the accumulated value of the number differences and the ratio of the number of regions, the structural similarity between the first test protocol frame and the verification protocol frame is obtained.
[0055] In this embodiment, the structural similarity between the first test protocol frame and the verification protocol frame can be determined by the following formula 1: Formula 1 in, Indicates the structural similarity between the pth first test protocol frame and the qth verification protocol frame, represents the number of matching regions between the pth first test protocol frame and the qth verification protocol frame, Indicates the number of test areas and verification areas, Indicates the accumulated value of the difference between the numbers of the pth first test protocol frame and the qth verification protocol frame.
[0056] Specifically, the matching regions are sorted in order of the size of the corresponding region numbers to obtain a matching region sequence. Assuming that the obtained matching region sequence is {1, 4, 6, 9}, the cumulative value of the number difference is the cumulative value of the difference between 4 and 1, the difference between 6 and 4, and the difference between 9 and 6, that is, 3+2+3=8.
[0057] The larger the value of The smaller the value of is, the closer the structure similarity between the pth first test protocol frame and the qth verification protocol frame is. The larger the value, the larger the value. The larger the value of , the greater the number of matching areas between the p-th first test protocol frame and the q-th verification protocol frame. The smaller the value, the higher the continuity between the matching areas.
[0058] The structural similarity between the pth first test protocol frame and the qth verification protocol frame The larger the value is, the more likely the qth verification protocol frame is to be the matching protocol frame of the pth first test protocol frame.
[0059] Through this embodiment, the structural similarity between the first test protocol frame and the verification protocol frame is calculated from two aspects: the number of matching areas and the continuity between matching areas. In this way, by comprehensively calculating from two dimensions, the number of matching areas and the continuity between matching areas, it is possible to accurately analyze whether the first test protocol frame and the verification protocol frame are similar, thereby improving the accuracy of judging the structural similarity.
[0060] As an optional embodiment, Figure 4 As shown, after S104, the multi-protocol intelligent identification terminal direct communication method may further include S401-S404: S401, obtaining port area information in each second test protocol frame corresponding to the matching protocol frame; S402, obtaining the port type of each corresponding second test protocol frame according to each port area information; S403, using the first frame number of the first test protocol frame, the second frame number of the second test protocol frame, the port type of each second test protocol frame, and the frequency of occurrence of the port number of each second test protocol frame, respectively determine the malicious possibility of each second test protocol frame; S404, determining the second test protocol frame whose malicious possibility is greater than the malicious threshold as a malicious information frame; S105 may specifically include: Each first test protocol frame except the malicious information frame is connected and debugged according to the corresponding protocol frame sending end and the corresponding matching protocol frame to realize multi-protocol communication between the terminal device and the main control system.
[0061] In this embodiment, one matching protocol frame may correspond to multiple second test protocol frames.
[0062] The first frame quantity is the total quantity of first test protocol frames, and the second frame quantity is the total quantity of second test protocol frames corresponding to the matching protocol frames.
[0063] The port type includes two types: normal port and abnormal port. If the port number is within the preset port range, the corresponding port is a normal port; if the port number is not within the preset port range, the corresponding port is an abnormal port.
[0064] As an example, the server first obtains the port area information corresponding to the second test protocol frame corresponding to the matching protocol frame, and then determines the port number of the second test protocol frame according to the port area information. When the port number is within the range of 0 to 1023, the port type of the second test protocol frame is determined to be a normal port; when the port number is not within the range of 0 to 1023, the port type of the second test protocol frame is determined to be an abnormal port.
[0065] Then, the frequency of occurrence of the port number of the second test protocol frame is counted, and the frequency of occurrence is divided by the number of first test protocol frames corresponding to the port type belonging to the port number to obtain the frequency ratio. Then, the number of second frames corresponding to the second test protocol frame is divided by the number of first frames corresponding to the first test protocol frame to obtain the frame number ratio. Finally, the frequency ratio is multiplied by the frame number ratio, and then multiplied by the preset malicious value to obtain the malicious possibility of the second test protocol frame.
[0066] Finally, the malicious possibility of the second test protocol frame is compared with the preset malicious threshold. If the malicious possibility of the second test protocol frame is greater than the preset malicious threshold, it indicates that the second test protocol frame is a malicious information frame; if the malicious possibility of the second test protocol frame is not greater than the preset malicious threshold, it indicates that the second test protocol frame is not a malicious information frame. Then, the malicious information frame is screened out during connection debugging to ensure smooth debugging.
[0067] Through this embodiment, by calculating the malicious possibility of the second test protocol frame, it is determined whether the second test protocol frame is a malicious information frame. When performing connection debugging, the malicious information frame is screened out to ensure smooth debugging, thereby ensuring normal communication between the intelligent terminal and the main control device and improving the security of multi-protocol communication.
[0068] As an optional embodiment, S403 may specifically include: Determine, according to the port type of the second test protocol frame, the number of third frames matching the port type and an initial malicious value matching the port type; Divide the second frame number by the first frame number to obtain a first calculated value; Divide the frequency of occurrence of the port number of the second test protocol frame by the number of the third frame to obtain a second calculated value; The first calculated value, the second calculated value, and the initial malicious value are multiplied to obtain the malicious possibility of the second test protocol frame.
[0069] In this embodiment, the third frame quantity is the total number of first test protocol frames of the same port type as the second test protocol frame. For example, if the port type of the second test protocol frame is a normal port, the total number of first test protocol frames of the normal port type is obtained, and the number is determined as the third frame quantity.
[0070] Each port type corresponds to a preset initial malicious value. For example, if the second test protocol frame belongs to a normal port, its corresponding initial malicious value is 0.3; if the second test protocol frame belongs to an abnormal port, its corresponding initial malicious value is 0.7.
[0071] As an example, the malicious possibility of the second test protocol frame can be determined by the following formula 2: Formula 2 In the formula, Indicates the malicious possibility of the jth second test protocol frame corresponding to the nth matching protocol frame, Indicates the second frame number of the second test protocol frame corresponding to the nth matching protocol frame. It indicates that the second frame quantity of the second test protocol frame corresponding to each matching protocol frame is accumulated, that is, the first frame quantity of the first test protocol frame, and N indicates the quantity of the matching protocol frames. represents the initial malicious value of the jth second test protocol frame corresponding to the nth matching protocol frame, Indicates the frequency of occurrence of the port number of the jth second test protocol frame corresponding to the nth matching protocol frame, Indicates the number of third frames whose port types match the j-th second test protocol frame corresponding to the n-th matching protocol frame.
[0072] in, The larger the value of , the more second test protocol frames corresponding to the nth matching protocol frame there are in all matching protocol frames, and the more frequent the protocol communication frequency of the corresponding matching protocol frame is. The larger the value of , the more times the port number of the j-th second test protocol frame corresponding to the n-th matching protocol frame appears, and the greater the possibility of maliciousness.
[0073] Maliciousness probability of the jth second test protocol frame corresponding to the nth matching protocol frame The larger the value is, the greater the risk that the j-th second test protocol frame corresponding to the n-th matching protocol frame is an abnormal Trojan information frame. In this case, communication between the frame and the main control system should be avoided.
[0074] Through this embodiment, by accurately calculating the malicious possibility of the second test protocol frame, the risk of the second test protocol frame being a malicious information frame can be accurately assessed. Thus, it can be ensured that the malicious information frame is screened out in time during connection debugging to ensure smooth debugging, ensure normal communication between the intelligent terminal and the main control device, and improve the security of multi-protocol communication.
[0075] As an optional embodiment, Figure 5 As shown, before S104, the multi-protocol intelligent identification terminal direct communication method may also include S501-S506: S501, comparing the maximum structural similarity with the minimum similarity threshold to obtain a similarity comparison result; S502, when the similarity comparison result indicates that the maximum structural similarity is less than the minimum similarity threshold, determining the first test protocol frame as an unmatched test frame; S503, calculating the frame structure consistency between the unmatched test frames according to the frame lengths of the unmatched test frames; S504, clustering the unmatched test frames according to the consistency of the frame structure to obtain at least one unmatched test frame cluster; S505, when the unmatched test frame cluster meets the preset cluster abnormality condition, determining each unmatched test frame in the unmatched test frame cluster as an abnormal test frame; S506: When the unmatched test frame cluster does not satisfy the preset cluster abnormality condition, connection debugging is performed on each unmatched test frame in the unmatched test frame cluster.
[0076] In this embodiment, the preset cluster abnormality condition is a pre-set condition for determining whether the unmatched test frame cluster is abnormal. By way of example, the preset cluster abnormality condition may be that when the number of unmatched test frames in the cluster is greater than half of the total number of all unmatched test frames, it indicates that the unmatched test frames in the cluster belong to test frames with a higher communication frequency, and they are marked as abnormal test frames.
[0077] As an example, after obtaining the structural similarities of the verification protocol frames corresponding to the first test protocol frame, the server will also compare the maximum structural similarity with the minimum similarity threshold. If even the maximum structural similarity is less than the minimum similarity threshold, it means that the first test protocol frame does not match any verification protocol frame, which may be a user-set protocol or an abnormal information frame. In this case, it is first marked as an unmatched test frame.
[0078] Then, the server obtains the frame structure consistency between each unmatched test frame according to the frame length of each unmatched test frame. Specifically, the corresponding frame structure consistency is matched according to the absolute value of the difference between the frame lengths of two unmatched test frames. The smaller the absolute value of the difference between the frame lengths of two unmatched test frames is, the greater the corresponding frame structure consistency is.
[0079] Then use the K-means method to cluster all the unmatched test frames according to the corresponding frame structure consistency. If the number of unmatched test frames in a cluster after clustering is greater than half of the total number of all unmatched test frames, then each unmatched test frame in the cluster is determined as an abnormal test frame; if the number of unmatched test frames in a cluster after clustering is less than or equal to half of the total number of all unmatched test frames, then construct the corresponding protocol frame and device according to the corresponding features for connection testing, and save the structure of the unmatched test frame in the protocol library.
[0080] Through this embodiment, for each unmatched test frame, the frame structure consistency between each unmatched test frame is calculated according to the corresponding frame length. Then clustering is performed according to the frame structure consistency to determine whether each unmatched test frame is an abnormal test frame. A connection test is performed on each unmatched test frame that does not belong to an abnormal test frame, and its structure is stored in the protocol library. The communication protocol in the protocol library can be enriched, thereby expanding the communication mode of the communication system.
[0081] As an optional embodiment, the unmatched test frame includes a first unmatched test frame and a second unmatched test frame; S503 may specifically include: Subtracting the frame length of the first unmatched test frame from the frame length of the second unmatched test frame to obtain an absolute value of the frame length difference; The frame structure consistency between the first non-matching test frame and the second non-matching test frame is obtained according to the absolute value of the frame length difference.
[0082] In this embodiment, the frame structure consistency can be determined by the following formula 3: Formula 3 In the formula, Indicates the frame structure consistency between the ath first unmatched test frame and the bth second unmatched test frame, Indicates the frame length of the ath first unmatched test frame, Indicates the frame length of the bth second unmatched test frame.
[0083] in, It represents the absolute value of the frame length difference between the a-th first unmatched test frame and the b-th second unmatched test frame. The smaller the frame length difference is, the greater the consistency of the frame structures between the two unmatched test frames is.
[0084] Frame structure consistency between the ath first non-matching test frame and the bth second non-matching test frame The larger is , the more likely it is that the a-th first unmatched test frame and the b-th second unmatched test frame belong to the same unmatched test frame cluster.
[0085] Through this embodiment, the frame structure consistency between the first unmatched test frame and the second unmatched test frame is calculated according to the frame length of the first unmatched test frame and the frame length of the second unmatched test frame. Therefore, clustering can be performed using the frame structure consistency, which helps to accurately determine whether each unmatched test frame is an abnormal test frame in the subsequent process, thereby improving the security of communication between the terminal device and the main control system.
[0086] Based on the multi-protocol intelligent identification terminal direct communication method. Correspondingly, the present invention also provides a specific embodiment of the multi-protocol intelligent identification terminal direct communication system.
[0087] The multi-protocol intelligent identification terminal direct communication system specifically includes terminal equipment, a main control system and a controller; Terminal equipment, used to communicate with the main control system; A main control system, used to communicate with terminal devices; The controller is connected to the terminal device and the main control system, and is used to execute the multi-protocol intelligent identification terminal direct communication method provided in any one of the above aspects.
[0088] In this embodiment, the terminal device and the main control system are connected to each other to achieve communication between the terminal device and the main control system. The controller establishes connections with the terminal device and the main control system respectively to send control signals to the terminal device and the main control system, thereby executing the multi-protocol intelligent identification terminal direct communication method provided in any one of the above aspects.
[0089] It should be clear that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of simplicity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and shown as examples.
[0090] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.
[0091] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.
Claims
1. A multi-protocol intelligent identification terminal direct communication method, characterized in that: The method comprises: Obtaining a reliability type of each first test protocol frame of a terminal device, where the first test protocol frame is a test frame corresponding to each communication protocol in the terminal device; Grouping each of the first test protocol frames according to a corresponding reliability type to obtain at least one protocol frame set; For each of the first test protocol frames in the protocol frame set, respectively calculating the structural similarity between the first test protocol frame and each corresponding verification protocol frame in the protocol library of the main control system, and the reliability type of the verification protocol frame matches the reliability type of the protocol frame set; Sort the verification protocol frames corresponding to the first test protocol frame in order of the size of the structural similarity, and determine the verification protocol frame with the greatest structural similarity as the matching protocol frame corresponding to the first test protocol frame; Each of the first test protocol frames is connected and debugged according to the corresponding protocol frame sending end and the corresponding matching protocol frame to realize multi-protocol communication between the terminal device and the main control system.
2. The multi-protocol intelligent identification terminal direct communication method according to claim 1, characterized in that: The obtaining the reliability type of each first test protocol frame of the terminal device includes: Sending a type identification signal to the terminal device so that the terminal device sends each of the first test protocol frames to the main control system; In response to the terminal device receiving the confirmation frame fed back by the main control system, determining the reliability type of each of the first test protocol frames corresponding to the confirmation frame as a reliable protocol; The reliability type of each of the first test protocol frames except the reliable protocol is determined as an unreliable protocol.
3. The multi-protocol intelligent identification terminal direct communication method according to claim 1, characterized in that: The calculating, for each of the first test protocol frames in the protocol frame set, the structural similarity between the first test protocol frame and each corresponding verification protocol frame in the protocol library of the main control system includes: Divide the verification protocol frame into regions according to the corresponding protocol structure to obtain N verification regions corresponding to the verification protocol frame, where N is a positive integer; Divide the first test protocol frame into regions according to the same protocol division method as the verification protocol frame, to obtain N test regions corresponding to the first test protocol frame; Matching each of the test areas with the corresponding verification area to obtain a successfully matched matching area in each of the test areas; The structural similarity between the first test protocol frame and the verification protocol frame is determined by using each of the matching regions.
4. The multi-protocol intelligent identification terminal direct communication method according to claim 3, characterized in that: Before dividing the first test protocol frame into regions according to the same protocol division method as the verification protocol frame to obtain N test regions corresponding to the first test protocol frame, the method further includes: Obtaining the number of protocol frame bytes of the first test protocol frame; Compare the number of protocol frame bytes of the first test protocol frame with the number of header bytes of the verification protocol frame to obtain a byte comparison result; When the byte comparison result indicates that the number of bytes of the protocol frame is less than the number of bytes of the header, it is determined that the structural similarity between the first test protocol frame and the verification protocol frame is a preset similarity threshold.
5. The multi-protocol intelligent identification terminal direct communication method according to claim 3, characterized in that: The using each of the matching regions to determine the structural similarity between the first test protocol frame and the verification protocol frame includes: Sort the matching regions in order of their corresponding region numbers to obtain a matching region sequence; Accumulating the serial number differences between two adjacent matching regions in the matching region sequence to obtain a serial number difference cumulative value; Dividing the number of matching regions by N to obtain a region number ratio; According to the accumulated value of the number differences and the ratio of the number of regions, the structural similarity between the first test protocol frame and the verification protocol frame is obtained.
6. The multi-protocol intelligent identification terminal direct communication method according to claim 1, characterized in that: After sorting the verification protocol frames corresponding to the first test protocol frame in order of the size of the structural similarity and determining that the verification protocol frame with the greatest structural similarity is the matching protocol frame corresponding to the first test protocol frame, the method further includes: Obtaining port area information in each second test protocol frame corresponding to the matching protocol frame; According to each of the port area information, obtain the corresponding port type of each of the second test protocol frames; Determine the malicious possibility of each of the second test protocol frames respectively by using the number of first frames of the first test protocol frames, the number of second frames of the second test protocol frames, the port type of each of the second test protocol frames, and the frequency of occurrence of the port number of each of the second test protocol frames; Determine the second test protocol frame whose malicious possibility is greater than the malicious threshold as a malicious information frame; The step of connecting and debugging each of the first test protocol frames according to the corresponding protocol frame sending end and the corresponding matching protocol frame to realize multi-protocol communication between the terminal device and the main control system includes: Each of the first test protocol frames except the malicious information frame is connected and debugged according to the corresponding protocol frame sending end and the corresponding matching protocol frame to realize multi-protocol communication between the terminal device and the main control system.
7. The multi-protocol intelligent identification terminal direct communication method according to claim 6, characterized in that: The method of using the number of first frames of the first test protocol frames, the number of second frames of the second test protocol frames, the port type of each of the second test protocol frames, and the frequency of occurrence of the port number of each of the second test protocol frames to respectively determine the malicious possibility of each of the second test protocol frames, includes: Determine, according to the port type of the second test protocol frame, the number of third frames matching the port type and an initial malicious value matching the port type; Dividing the second frame quantity by the first frame quantity to obtain a first calculated value; Divide the frequency of occurrence of the port number of the second test protocol frame by the number of the third frames to obtain a second calculated value; The first calculated value, the second calculated value, and the initial malicious value are multiplied to obtain the malicious possibility of the second test protocol frame.
8. The multi-protocol intelligent identification terminal direct communication method according to any one of claims 1 to 7, characterized in that: Before sorting the verification protocol frames corresponding to the first test protocol frame in order of the size of the structural similarity and determining that the verification protocol frame with the greatest structural similarity is the matching protocol frame corresponding to the first test protocol frame, the method further includes: Comparing the maximum structural similarity with the minimum similarity threshold to obtain a similarity comparison result; In a case where the similarity comparison result indicates that the maximum structural similarity is less than a minimum similarity threshold, determining that the first test protocol frame is an unmatched test frame; Calculating the frame structure consistency between the unmatched test frames according to the frame length of each unmatched test frame; Clustering the unmatched test frames according to the frame structure consistency to obtain at least one unmatched test frame cluster; In the case where the unmatched test frame cluster meets a preset cluster abnormality condition, determining each of the unmatched test frames in the unmatched test frame cluster as an abnormal test frame; When the unmatched test frame cluster does not satisfy a preset cluster abnormality condition, connection debugging is performed on each of the unmatched test frames in the unmatched test frame cluster.
9. The multi-protocol intelligent identification terminal direct communication method according to claim 8, characterized in that: The unmatched test frame includes a first unmatched test frame and a second unmatched test frame; The calculating, according to the frame length of each of the unmatched test frames, the frame structure consistency between the unmatched test frames comprises: Subtracting the frame length of the first unmatched test frame from the frame length of the second unmatched test frame to obtain an absolute value of the frame length difference; The frame structure consistency between the first non-matching test frame and the second non-matching test frame is obtained according to the absolute value of the frame length difference.
10. A multi-protocol intelligent identification terminal direct communication system, characterized in that: The system includes a terminal device, a main control system and a controller; The terminal device is used to communicate with the main control system; The main control system is used to communicate with the terminal device; The controller is connected to the terminal device and the main control system, and is used to execute the multi-protocol intelligent identification terminal direct communication method described in any one of claims 1 to 9.
Citation Information
Patent Citations
Multi-protocol automatic identification system and method for heterogeneous link
CN104158627A
Multi-communication protocol intelligent sensing method
CN109889525A
Communication method and device compatible with multiple protocols, and electronic equipment
CN110351242A
Communication protocol automatic identification method and communication method
CN110784456A
AFDX switch supporting multiple types of data traffic
US10454656B1
