A data processing method and device based on multi-protocol and multi-port services
By optimizing the data processing methods of multi-protocol and multi-port services, including legitimacy checking, de-replication and quick sorting, the problems of high maintenance costs and inefficiency in multi-protocol scenarios are solved, and efficient protocol and port management are achieved.
Patent Information
- Application Number
- CN202211453330.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2042-11-21
AI Technical Summary
When facing multi-protocol and multi-port services, multiple service policies need to be added, resulting in high maintenance costs and low matching efficiency.
By obtaining the initial protocol and port range corresponding to the protocol type, legality checking, de-replication and processing are performed, and matching using quick sorting algorithms and dichotomies, the storage and matching process of protocols and ports are optimized.
It reduces the maintenance cost of service policies, improves matching efficiency, avoids redundant processing and multiple matching, and realizes efficient protocol and port management.
Smart Images

Figure CN115842874B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of protocol port data processing. Specifically, it relates to a data processing method and device for multi-protocol multi-port services. Background Art
[0002] In a service policy of existing multi-protocol multi-port services, generally one protocol and port are configured. In the face of multi-protocol scenarios, multiple service policies often need to be added, thus increasing the maintenance cost of service policies. On the other hand, the current way of saving single ports and range ports is to save them separately, and this saving method corresponds to sequential matching. Therefore, this inevitably reduces the matching efficiency of service policies. Summary of the Invention
[0003] The purpose of the embodiments of this application is to provide a data processing method and device for multi-protocol multi-port services, which can reduce the maintenance cost brought by a large number of service policies and can also effectively improve the matching efficiency of service policies.
[0004] The first aspect of the embodiments of this application provides a data processing method for multi-protocol multi-port services, including:
[0005] Obtain an initial protocol corresponding to the protocol type, and obtain initial ports that meet the port range; wherein, the initial protocol and the initial ports are paired data;
[0006] Detect whether the initial protocol and the initial ports pass the legality check;
[0007] When the initial protocol and the initial ports pass the legality check, perform deduplication and merging processing based on the initial protocol and the initial ports to obtain an updated protocol and updated ports; wherein, the updated protocol and the updated ports are paired data;
[0008] Sort the updated protocol and the updated ports to obtain a sorting result;
[0009] Add the sorting result as a service object to the database.
[0010] In the above implementation process, the method can preferentially obtain the initial protocol corresponding to the protocol type and obtain the initial ports that meet the port range. It can be seen that the method can preferentially set the protocol type and port range in the service addition window, and can even continue to select the addition of the same or different protocol types after the addition is completed. After the initial protocol and the initial ports are paired and added, they are regarded as the basis for the method to process and trigger the further execution of the method, so that the method can achieve the optimal protocol port storage effect based on the valid basic data. Then, the method can detect whether the initial protocol and the initial ports pass the legality check to ensure the execution effectiveness of the method, avoid meaningless processing of illegal protocols and ports, and thus ensure the processing effect of the method. After that, when the initial protocol and the initial ports pass the legality check, the method performs deduplication and merging processing based on the initial protocol and the initial ports to obtain the updated protocol and the updated ports. It can be seen that the method can perform deduplication and merging on the protocol and the ports after obtaining valid and legal protocols and ports, so as to ensure that redundancy can be eliminated after this step is executed, and thus facilitate the execution of subsequent steps. Finally, the method sorts the updated protocol and the updated ports to obtain the sorting result. It can be seen that the method can obtain the protocols and ports that are convenient for storage and call by sorting the protocols and ports, and further add the sorting result as a service object to the database, so as to achieve low-cost storage of the protocols and ports, and thus facilitate the subsequent call of the protocols and ports. In addition, the protocols and ports stored by this method can be more convenient for subsequent matching and calling, so that the subsequent service policy matching efficiency is higher and the effect is better.
[0011] Further, the method further includes:
[0012] Receiving a data packet;
[0013] Parsing the data packet to obtain the packet protocol and the packet port;
[0014] Judging whether the packet protocol and the packet port match the updated protocol and the updated ports stored in the database;
[0015] When the packet protocol and the packet port match the updated protocol and the updated ports, outputting a matching result.
[0016] In the above implementation process, the method can preferentially receive data packets arriving at the firewall; then, it parses the data packets to obtain the packet protocol and packet port. It can be seen that the method can parse the data packets after receiving them, so as to obtain the packet protocol and packet port for matching, and enter the protocol port matching process based on this. Subsequently, the method can further determine whether the packet protocol and packet port match the updated protocol and updated port stored in the database; and when the packet protocol and packet port match the updated protocol and updated port, it outputs the matching result. It can be seen that the method can detect the protocol port group in the database, thus select the matching result and output it for the execution of subsequent steps.
[0017] Further, the step of determining whether the packet protocol and the packet port match the updated protocol and the updated port stored in the database includes:
[0018] Based on the binary method, determine whether the packet protocol is the same as the updated protocol stored in the database;
[0019] When the packet protocol is the same as the updated protocol, determine whether the packet port matches the updated port stored in the database;
[0020] When the packet port matches the updated port stored in the database, trigger the execution of the step of outputting the matching result.
[0021] In the above implementation process, when the method determines whether the packet protocol and packet port match the updated protocol and updated port stored in the database, it can determine whether the packet protocol is the same as the updated protocol stored in the database based on the binary method. It can be seen that the method can improve the overall data matching effect based on the binary matching method. Then, when the packet protocol is the same as the updated protocol, the method further determines whether the packet port matches the updated port stored in the database. It can be seen that the method can perform one-by-one matching on the protocol port group, avoiding the increased matching burden caused by full-scale simultaneous matching of both, thus improving the overall data matching efficiency in another aspect. Finally, when the packet port matches the updated port stored in the database, the method outputs the final matching result, so that the subsequent process can perform corresponding processing based on this matching result.
[0022] Further, the step of detecting whether the initial protocol and the initial port pass the legality check includes:
[0023] Detect whether the characters in the initial protocol and the characters in the initial port all meet the requirements of character legality;
[0024] When both the characters in the initial protocol and the characters in the initial port meet the character legality requirements, detect whether the starting port in the initial port is not greater than the ending port;
[0025] When the starting port is not greater than the ending port, determine that the initial protocol and the initial port pass the legality check.
[0026] In the above implementation process, when the method detects whether the initial protocol and the initial port pass the legality check, it can first detect whether the characters in the initial protocol and the characters in the initial port both meet the character legality requirements; it can be seen that the method can determine whether the protocol and the port are legal through character legality detection, and further perform further legality detection on the basis of character legality. Then, when the characters in the initial protocol and the characters in the initial port both meet the character legality requirements, the method detects whether the starting port in the initial port is not greater than the ending port; it can be seen that the method also requires further legality detection on the relationship between the starting port and the ending port during the legality detection process, so as to ensure that the port is correct, and further ensure that the protocol and the port are legal. Based on the result that the starting port is not greater than the ending port, the method can determine that the initial protocol and the initial port pass the legality check and further trigger the execution of subsequent steps.
[0027] Further, the step of performing deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port includes:
[0028] When there is a single port belonging to a certain range of ports under the same initial protocol, remove the single port;
[0029] When there are range ports with an inclusion relationship under the same initial protocol, remove the included ports;
[0030] When there are intersections among multiple range ports under the same initial protocol, merge the multiple range ports.
[0031] In the above implementation process, when the method performs deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port, it can perform different deduplication and merging processing based on different situations, so as to ensure that the combination of the obtained updated protocol and updated port meets the requirements and has no redundancy.
[0032] Further, the step of sorting the updated protocol and the updated port to obtain a sorting result includes:
[0033] Based on the quicksort algorithm, sort the updated protocol and the updated port to obtain a sorting result.
[0034] In the above implementation process, the method can perform a dual sorting on the combination of the update protocol and the update port based on the quicksort algorithm, so that the method can preferentially obtain the sorting result under the update protocol, and then further obtain the sorting result of the update port in the sorting result under the update protocol, thereby obtaining the overall sorting result. It can be seen that the method can simply and efficiently complete the sorting of the update protocol and the update port.
[0035] A second aspect of the embodiments of the present application provides a data processing device based on multi-protocol multi-port services. The data processing device based on multi-protocol multi-port services includes:
[0036] An acquisition unit, configured to acquire an initial protocol corresponding to a protocol type and acquire an initial port that meets the port range; wherein, the initial protocol and the initial port are paired data;
[0037] A detection unit, configured to detect whether the initial protocol and the initial port pass a legality check;
[0038] A deduplication and merging unit, configured to perform deduplication and merging processing based on the initial protocol and the initial port when the initial protocol and the initial port pass the legality check, so as to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data;
[0039] A sorting unit, configured to sort the updated protocol and the updated port to obtain a sorting result;
[0040] A storage unit, configured to add the sorting result as a service object to a database.
[0041] In the above implementation process, the device can acquire an initial protocol corresponding to a protocol type through the acquisition unit and acquire an initial port that meets the port range; wherein, the initial protocol and the initial port are paired data; detect whether the initial protocol and the initial port pass a legality check through the detection unit; when the initial protocol and the initial port pass the legality check, perform deduplication and merging processing based on the initial protocol and the initial port through the deduplication and merging unit to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data; then sort the updated protocol and the updated port through the sorting unit to obtain a sorting result; finally, add the sorting result as a service object to the database through the storage unit. It can be seen that the method can reduce the maintenance cost brought by a large number of service policies and can also effectively improve the matching efficiency of service policies.
[0042] Further, the data processing device based on multi-protocol multi-port services further includes:
[0043] A receiving unit, configured to receive data packets;
[0044] A parsing unit for parsing the data packet to obtain a packet protocol and a packet port;
[0045] A judgment unit for judging whether the packet protocol and the packet port match the update protocol and the update port stored in the database;
[0046] An output unit for outputting a matching result when the packet protocol and the packet port match the update protocol and the update port.
[0047] Further, the judgment unit includes:
[0048] A first judgment subunit for judging whether the packet protocol is the same as the update protocol stored in the database based on the dichotomy method;
[0049] A second judgment subunit for judging whether the packet port matches the update port stored in the database when the packet protocol is the same as the update protocol;
[0050] The output unit is specifically configured to output a matching result when the packet port matches the update port stored in the database.
[0051] Further, the detection unit includes:
[0052] A detection subunit for detecting whether the characters in the initial protocol and the characters in the initial port both meet the character legality requirements;
[0053] The detection subunit is further configured to detect whether the starting port in the initial port is not greater than the ending port when the characters in the initial protocol and the characters in the initial port both meet the character legality requirements;
[0054] A determination subunit for determining that the initial protocol and the initial port pass the legality check when the starting port is not greater than the ending port.
[0055] Further, the duplicate removal and merging unit includes:
[0056] A removal subunit for removing the single port when there is a single port belonging to a certain range of ports under the same initial protocol;
[0057] The removal subunit is further configured to remove the included port when there is an inclusion relationship of range ports under the same initial protocol;
[0058] A merging subunit, configured to merge the multiple range ports when there are intersections among multiple range ports under the same initial protocol.
[0059] Further, the sorting unit is specifically configured to sort the updated protocol and the updated ports based on the quicksort algorithm to obtain a sorting result.
[0060] A third aspect of the embodiments of the present application provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the data processing method based on multi-protocol multi-port services according to any one of the first aspects of the embodiments of the present application.
[0061] A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores computer program instructions. When the computer program instructions are read and run by a processor, the data processing method based on multi-protocol multi-port services according to any one of the first aspects of the embodiments of the present application is executed. Description of the Drawings
[0062] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0063] Figure 1 A flowchart of a data processing method based on multi-protocol multi-port services provided by an embodiment of the present application;
[0064] Figure 2 A flowchart of another data processing method based on multi-protocol multi-port services provided by an embodiment of the present application;
[0065] Figure 3 A structural diagram of a data processing device based on multi-protocol multi-port services provided by an embodiment of the present application;
[0066] Figure 4 A structural diagram of another data processing device based on multi-protocol multi-port services provided by an embodiment of the present application. Detailed Embodiments
[0067] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
[0068] It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, terms such as "first" and "second" are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0069] Embodiment 1
[0070] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a data processing method based on multi - protocol multi - port services provided for this embodiment. Among them, the data processing method based on multi - protocol multi - port services includes:
[0071] S101. Obtain an initial protocol corresponding to the protocol type and obtain an initial port that meets the port range; wherein, the initial protocol and the initial port are paired data.
[0072] In this embodiment, the method can obtain the protocol type selected by the user in the service addition window. The protocol types include TCP protocol, UDP protocol, ICMP protocol, and other protocols. Each protocol supports configuring a single port or a port range, and the port range takes values from 0 to 65535. If it is a single port, only the starting port is filled, or the starting port and the ending port number are the same; if it is a range port, the starting port and the ending port need to be filled; if the port number is not filled, the default port is 0 - 65535.
[0073] In this embodiment, the user can select a certain protocol type in the service addition window, set its port range, and can continue to add the same or different protocol types after the addition is completed.
[0074] S102. Detect whether the initial protocol and the initial port pass the legality check. If so, execute step S103; if not, end this process.
[0075] S103. Perform deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data.
[0076] As an alternative implementation, the step of performing deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port includes:
[0077] When there is a single port belonging to a certain range port under the same initial protocol, remove the single port;
[0078] [[ID=...]]When there are range ports with an inclusion relationship under the same initial protocol, remove the included ports;
[0079] When there are multiple range ports with intersections under the same initial protocol, merge the multiple range ports.
[0080] S104. Sort the updated protocol and updated ports to obtain a sorting result.
[0081] S105. Add the sorting result as a service object to the database.
[0082] In this embodiment, the execution subject of this method can be a computing device such as a computer or a server, and no limitation is made in this embodiment.
[0083] In this embodiment, the execution subject of this method can also be a smart device such as a smart phone or a tablet computer, and no limitation is made in this embodiment.
[0084] It can be seen that implementing the data processing method based on multi-protocol multi-port service described in this embodiment can add various protocol types and ports when adding services, thereby effectively reducing the maintenance cost brought by configuring a large number of policies; at the same time, by integrating single ports and range ports, the effect of common storage and matching can be achieved, so that the situation of multiple matches can be avoided, and further the effect of improving performance can be achieved.
[0085] Embodiment 2
[0086] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a data processing method based on multi-protocol multi-port service provided in this embodiment. Among them, the data processing method based on multi-protocol multi-port service includes:
[0087] S201. Obtain an initial protocol corresponding to the protocol type, and obtain initial ports that meet the port range; among them, the initial protocol and the initial ports are paired data.
[0088] S202. Detect whether the characters in the initial protocol and the characters in the initial ports all meet the requirements of character legality. If so, execute step S203; if not, end this process.
[0089] In this embodiment, this method can check the legality of the input protocol and ports. Among them, each character of the protocol and ports must be a number between 0 and 9, and the starting port cannot be greater than the ending port.
[0090] S203. Detect whether the starting port in the initial ports is not greater than the ending port. If so, execute step S204; if not, end this process..
[0091] S204. Determine that the initial protocol and the initial ports pass the legality check.
[0092] S205. Perform deduplication and merging processing based on the initial protocol and initial port to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data.
[0093] As an optional implementation manner, the step of performing deduplication and merging processing based on the initial protocol and initial port to obtain an updated protocol and an updated port includes:
[0094] When there is a single port belonging to a certain range of ports under the same initial protocol, remove the single port;
[0095] When there are range ports with an inclusion relationship under the same initial protocol, remove the included ports;
[0096] When there are intersections among multiple range ports under the same initial protocol, merge the multiple range ports.
[0097] In this embodiment, the method can perform deduplication and merging on ports based on the following multiple situations:
[0098] (1) If a certain single port under the same protocol number belongs to a certain range of ports, then remove the single port. For example: 1024 and 1023 - 1027, after deduplication, port 1024 is deleted;
[0099] (2) If range port 1 in the same protocol number is included by range port 2, then remove range port 1. For example: 1024 - 1026 and 1023 - 1027, after deduplication, range port 1024 - 1026 is deleted;
[0100] (3) If there is an intersection between range port 1 and range port 2 in the same protocol number, then take the union of the two range ports. For example: 1023 - 1027 and 1026 - 1030, the merged range port is 1023 - 1030.
[0101] S206. Based on the quicksort algorithm, sort the updated protocol and the updated port to obtain a sorting result.
[0102] In this embodiment, the input protocols and ports are as follows:
[0103] Protocol 6 17 6 17 17 6 Port 1030 1024 1025 1030 1026 1020-1023
[0104] After sorting in ascending order by protocol number and port, the result is as follows:
[0105] Protocol 6 6 6 17 17 17 Port 1020-1023 1025 1030 1024 1026 1030
[0106] S207. Add the sorting result as a service object to the database.
[0107] S208. Receive data packets.
[0108] In this embodiment, the method can parse the data packets arriving at the firewall and obtain the protocols and ports in the packets.
[0109] S209. Parse the data packet to obtain the packet protocol and the packet port.
[0110] S210. Based on the binary search method, determine whether the packet protocol is the same as the update protocol stored in the database. If so, execute step S211; if not, end this process.
[0111] S211. Determine whether the packet port matches the update port stored in the database. If so, execute step S212; if not, end this process.
[0112] In this embodiment, the binary search matching strategy applied in this method is as follows:
[0113] (1) First, compare whether the protocols are the same. If they are the same, continue to compare the ports; otherwise, perform binary search again.
[0114] (2) Compare whether the ports are the same or within the range. If they are the same or within the range, the matching is successful; otherwise, continue the binary search.
[0115] S212. Output the matching result.
[0116] In this embodiment, the execution entity of this method can be a computing device such as a computer or a server, and no specific limitation is made in this embodiment.
[0117] In this embodiment, the execution entity of this method can also be a smart device such as a smart phone or a tablet computer, and no specific limitation is made in this embodiment.
[0118] It can be seen that implementing the data processing method based on multi - protocol multi - port services described in this embodiment can add multiple protocol types and ports when adding services, thus effectively reducing the maintenance cost brought by configuring a large number of policies. At the same time, by integrating single ports and range ports, the effect of common storage and matching can be achieved, thus avoiding the situation of multiple matches and further achieving the effect of improving performance. In addition, the quick - sort algorithm can be used to efficiently sort the protocol numbers and ports, and the binary search method can be used to improve the matching efficiency.
[0119] Embodiment 3
[0120] Please refer to Figure 3 , Figure 3 which is a schematic structural diagram of a data processing device based on multi - protocol multi - port services provided in this embodiment. As Figure 3 shown, the data processing device based on multi - protocol multi - port services includes:
[0121] An acquisition unit 310, configured to acquire an initial protocol corresponding to a protocol type and acquire an initial port that meets a port range; wherein, the initial protocol and the initial port are paired data;
[0122] A detection unit 320, configured to detect whether the initial protocol and the initial port pass a legality check;
[0123] A deduplication and merging unit 330, configured to perform deduplication and merging processing based on the initial protocol and the initial port when the initial protocol and the initial port pass the legality check, to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data;
[0124] A sorting unit 340, configured to sort the updated protocol and the updated port to obtain a sorting result;
[0125] A storage unit 350, configured to add the sorting result as a service object to a database.
[0126] In this embodiment, the explanation of the data processing device for multi-protocol multi-port services can refer to the description in Embodiment 1 or Embodiment 2, and thus will not be elaborated herein.
[0127] It can be seen that implementing the data processing device for multi-protocol multi-port services described in this embodiment can add multiple protocol types and ports when adding services, thereby effectively reducing the maintenance cost brought by configuring a large number of policies; at the same time, by fusing single ports and range ports, the effect of common storage and matching can be achieved, thereby avoiding the situation of multiple matches and further achieving the effect of improving performance.
[0128] Embodiment 4
[0129] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a data processing device for multi-protocol multi-port services provided in this embodiment. As Figure 4 shown, the data processing device for multi-protocol multi-port services includes:
[0130] An acquisition unit 310, configured to acquire an initial protocol corresponding to a protocol type and acquire an initial port that meets a port range; wherein, the initial protocol and the initial port are paired data;
[0131] A detection unit 320, configured to detect whether the initial protocol and the initial port pass a legality check;
[0132] A deduplication and merging unit 330, configured to perform deduplication and merging processing based on the initial protocol and the initial port when the initial protocol and the initial port pass the legality check, to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data;
[0133] A sorting unit 340, configured to sort the update protocol and the update port to obtain a sorting result;
[0134] A storage unit 350, configured to add the sorting result as a service object to the database.
[0135] As an optional implementation manner, the data processing device based on multi-protocol multi-port service further includes:
[0136] A receiving unit 360, configured to receive data packets;
[0137] A parsing unit 370, configured to parse the data packets to obtain a packet protocol and a packet port;
[0138] A judging unit 380, configured to judge whether the packet protocol and the packet port match the update protocol and the update port stored in the database;
[0139] An output unit 390, configured to output a matching result when the packet protocol and the packet port match the update protocol and the update port.
[0140] As an optional implementation manner, the judging unit 380 includes:
[0141] A first judging subunit 381, configured to judge whether the packet protocol is the same as the update protocol stored in the database based on the dichotomy method;
[0142] A second judging subunit 382, configured to judge whether the packet port matches the update port stored in the database when the packet protocol is the same as the update protocol;
[0143] The output unit 390 is specifically configured to output a matching result when the packet port matches the update port stored in the database.
[0144] As an optional implementation manner, the detection unit 320 includes:
[0145] A detection subunit 321, configured to detect whether the characters in the initial protocol and the characters in the initial port all meet the character legality requirements;
[0146] The detection subunit 321 is further configured to detect whether the starting port in the initial port is not greater than the ending port when the characters in the initial protocol and the characters in the initial port all meet the character legality requirements;
[0147] A determination subunit 322, configured to determine that the initial protocol and the initial port pass the legality check when the starting port is not greater than the ending port.
[0148] As an optional implementation manner, the duplicate removal and merging unit 330 includes:
[0149] The removal subunit 331 is used to remove a single port when there is a single port belonging to a range of ports under the same initial protocol.
[0150] The removal subunit 331 is also used to remove the included ports when there are range ports with an inclusion relationship under the same initial protocol.
[0151] The merging subunit 332 is used to merge multiple range ports when there are intersections among multiple range ports under the same initial protocol.
[0152] As an optional implementation manner, the sorting unit 340 is specifically configured to sort the updated protocol and the updated ports based on the quicksort algorithm to obtain a sorting result.
[0153] In this embodiment, the explanation of the data processing device for multi-protocol multi-port services may refer to the description in Embodiment 1 or Embodiment 2, and will not be elaborated herein.
[0154] It can be seen that implementing the data processing device for multi-protocol multi-port services described in this embodiment can add multiple protocol types and ports when adding services, thereby effectively reducing the maintenance cost brought by configuring a large number of policies. At the same time, by fusing single ports and range ports, the effect of common storage and matching can be achieved, thus avoiding the situation of multiple matches and further achieving the effect of improving performance. In addition, the quicksort algorithm can be used to efficiently sort the protocol numbers and ports, and the binary method can be used to improve the matching efficiency.
[0155] This application embodiment provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the data processing method for multi-protocol multi-port services in Embodiment 1 or Embodiment 2 of this application.
[0156] This application embodiment provides a computer-readable storage medium, which stores computer program instructions. When the computer program instructions are read and run by a processor, the data processing method for multi-protocol multi-port services in Embodiment 1 or Embodiment 2 of this application is executed.
[0157] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0158] In addition, each functional module in various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0159] If the described functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0160] The above are only embodiments of the present application and are not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application. It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0161] As mentioned above, the above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or replacements, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0162] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
Claims
1. A data processing method based on multi - protocol and multi - port services, characterized in that, Including: Obtain an initial protocol corresponding to the protocol type, and obtain an initial port that meets the port range; wherein, the initial protocol and the initial port are paired data; Detect whether the initial protocol and the initial port pass the legality check; When the initial protocol and the initial port pass the legality check, perform deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port; wherein, the updated protocol and the updated port are paired data; Sort the updated protocol and the updated port to obtain a sorting result; Add the sorting result as a service object to the database; Wherein, the method further includes: Receive a data packet; Parse the data packet to obtain a packet protocol and a packet port; Judge whether the packet protocol and the packet port match the updated protocol and the updated port stored in the database; When the packet protocol and the packet port match the updated protocol and the updated port, output a matching result.
2. The data processing method based on multi-protocol multi-port service according to claim 1, characterized in that The step of judging whether the packet protocol and the packet port match the updated protocol and the updated port stored in the database includes: Judge whether the packet protocol is the same as the updated protocol stored in the database based on the dichotomy method; When the packet protocol is the same as the updated protocol, judge whether the packet port matches the updated port stored in the database; When the packet port matches the updated port stored in the database, trigger the execution of the step of outputting the matching result.
3. The data processing method based on multi - protocol multi - port service according to claim 1, wherein The step of detecting whether the initial protocol and the initial port pass the legality check includes: Detect whether the characters in the initial protocol and the characters in the initial port all meet the character legality requirements; When the characters in the initial protocol and the characters in the initial port all meet the character legality requirements, detect whether the starting port in the initial port is not greater than the ending port; When the starting port is not greater than the ending port, determine that the initial protocol and the initial port pass the legality check.
4. The data processing method based on multi-protocol multi-port service according to claim 1, characterized in that The step of performing deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port includes: When there is a single port belonging to a certain range of ports under the same initial protocol, remove the single port; When there is a case of range ports with an inclusion relationship under the same initial protocol, remove the included ports; When there is a case where multiple range ports have an intersection under the same initial protocol, merge the multiple range ports.
5. The data processing method based on multi-protocol multi-port service according to claim 1, characterized in that, The step of sorting the updated protocol and the updated port to obtain a sorting result includes: Based on the quicksort algorithm, sort the updated protocol and the updated port to obtain a sorting result.
6. A data processing device based on multi - protocol and multi - port services, characterized in that, The data processing device based on multi-protocol multi-port service includes: An acquisition unit for acquiring an initial protocol corresponding to the protocol type and acquiring an initial port that meets the port range; wherein, the initial protocol and the initial port are paired data; A detection unit for detecting whether the initial protocol and the initial port pass the legality check; A deduplication and merging unit for, when the initial protocol and the initial port pass the legality check, performing deduplication and merging processing based on the initial protocol and the initial port to obtain an updated protocol and an updated port; wherein the updated protocol and the updated port are paired data; A sorting unit for sorting the updated protocol and the updated port to obtain a sorting result; A storage unit for adding the sorting result as a service object to a database; Wherein, the data processing device based on multi-protocol multi-port service further includes: A receiving unit for receiving data packets; A parsing unit for parsing the data packet to obtain a packet protocol and a packet port; A judging unit for judging whether the packet protocol and the packet port match the updated protocol and the updated port stored in the database; An output unit for outputting a matching result when the packet protocol and the packet port match the updated protocol and the updated port.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory is used for storing a computer program, and the processor runs the computer program to enable the electronic device to execute the data processing method based on multi-protocol multi-port service according to any one of claims 1 to 5.
8. A readable storage medium, characterized in that, Computer program instructions are stored in the readable storage medium, and when the computer program instructions are read and run by a processor, the data processing method based on multi-protocol multi-port service according to any one of claims 1 to 5 is executed.
Citation Information
Patent Citations
Port management system and method of deep learning training platform, equipment and medium
CN113590415A
Network asset custom protocol identification method and device, terminal and storage medium
CN115242692A