A method for restoring HTTP traffic
By segmenting HTTP packets and extracting valid fields, combined with early warning rule judgment, real-time restoration of HTTP traffic and identification of attack information are achieved, solving the problem that existing technologies cannot identify hidden information, and providing reliable data support and network efficiency.
Patent Information
- Application Number
- CN202310386107.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-11
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2043-04-11
AI Technical Summary
Existing HTTP traffic restoration methods cannot identify and expose the attacker's hidden information, making it impossible to conduct effective security analysis and threat tracing.
By obtaining the HTTP packets in the network traffic, storing them in the cache area, segmenting and extracting the valid fields, judging whether to issue an attack alarm according to the early warning rules, restoring the traffic when no alarm is needed, identifying attack information, and providing alarm signals of different levels. and data analysis.
It realizes the identification and exposure of attack information, supports data support for threat traceability, malicious domain name analysis, email virus detection and other scenarios, while ensuring network efficiency and real-time data restoration.
Smart Images

Figure CN116319057B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a HTTP traffic restoration method. Background Art
[0002] Since the reform and opening up, the sustained and rapid growth of my country's economy and the development of network technology have jointly promoted the development of the Internet. On July 16, 2009, the China Internet Network Information Center released a report showing that in the first half of this year, the number of Internet users in my country has exceeded 300 million, and the three indicators of Internet user scale, number of broadband Internet users, and number of national top-level domain name registrations (12.96 million) still rank first in the world, and the Internet penetration rate has steadily increased. Therefore, how to supervise the information transmitted on the Internet and prevent the rapid spread of bad information is a serious problem.
[0003] In the existing HTTP traffic restoration research, it is proposed to encapsulate the transmitted data into the format of IP data packets and put them into the DNS payload for transmission, and use the existing DNS tunneling tools to achieve covert communication. For example, TCP-over-DNS and Dns2tcp use TXT records to place data and Iodine uses NULL records to store data, and finally parse and query the data. However, since this traffic restoration method can bypass the parsing tool, the transmitted data cannot be identified in the subsequent security analysis, and among the existing network traffic analysis and restoration tools, most tools cannot identify such special format data packets constructed according to the characteristics of the protocol, and cannot parse the hidden data therein, so the attacker's hidden information cannot be exposed.
[0004] Therefore, how to provide an HTTP traffic restoration method is a technical problem that needs to be solved. Summary of the invention
[0005] The embodiment of the present invention provides an HTTP traffic restoration method, which solves the technical problem in the prior art that the attacker's attack information cannot be exposed. The present invention has obvious effects in detecting bad content, preventing potential leakage risks, etc., and meets the needs of real-time data restoration.
[0006] In order to achieve the above object, the present invention provides an HTTP traffic restoration method, the method comprising:
[0007] Acquire HTTP network data packets in network traffic, and store the HTTP network data packets in a preset buffer area;
[0008] Segmenting the HTTP network data packet and extracting valid fields in the HTTP network data packet;
[0009] Acquire a preset warning rule according to the valid field, and determine whether to issue an attack alarm to the HTTP network data packet according to the warning rule;
[0010] When it is determined that there is no need to issue an attack alarm for the HTTP network data packet, traffic restoration is performed on the HTTP network data packet.
[0011] In one embodiment, when obtaining HTTP network data packets in network traffic and storing the HTTP network data packets in a preset cache area, it includes:
[0012] Parsing the HTTP network data packet to obtain identification information carried by the HTTP network data packet;
[0013] The HTTP network data packets are grouped according to the identification information, and the grouped HTTP network data packets are stored in the buffer area.
[0014] In one embodiment, when the HTTP network data packet is segmented and valid fields in the HTTP network data packet are extracted, the method includes:
[0015] After segmenting the HTTP network data packets, data parsing is performed to generate formatted data groups, and data cleaning is performed on the formatted data groups;
[0016] Extract the valid fields of the formatted data group after the cleaning process, and store the valid fields in the second buffer area, wherein the valid fields include: source IP address, destination IP address, packet byte length and timestamp.
[0017] In one embodiment, when a preset warning rule is obtained according to the valid field, and when it is determined whether to issue an attack alarm to the HTTP network data packet according to the warning rule, the method includes:
[0018] Determine whether the valid field matches the preset warning rule,
[0019] If not, no attack alarm will be issued;
[0020] If so, an attack alarm is issued for the HTTP network data packet, and the packet sequence number and file name corresponding to the HTTP network data packet are obtained. Based on the packet sequence number and the file name, the stream of the attack alarm event is queried from the cache area, and the traffic segment corresponding to the attack alarm is cut out from the stream of the attack alarm event, and attack analysis and evidence collection are performed.
[0021] In one embodiment, when an attack alarm is issued for the HTTP network data packet, it includes:
[0022] Obtaining a matching degree G between the HTTP network data packet and the preset warning rule, and issuing alarm signals of different levels according to the matching degree G;
[0023] Preset the matching degree matrix K, set K (β1, β2, β3), where β1 is the first preset matching degree, β2 is the second preset matching degree, β3 is the third preset matching degree, and β1 < β2 < β3;
[0024] Different levels of alarm signals are issued according to the relationship between the matching degree G and each preset matching degree:
[0025] When G≤β1, no alarm signal is issued;
[0026] When β1<G≤β2, a third-level alarm signal is issued;
[0027] When β2<G≤β3, a secondary alarm signal is issued;
[0028] When β3<G, a first-level alarm signal is issued.
[0029] In one embodiment, when it is determined that there is no need to issue an attack alarm for the HTTP network data packet, restoring the flow of the HTTP network data packet includes:
[0030] Obtaining the number of bytes of the HTTP network data packet, performing flow splitting processing on the HTTP network data packet according to the number of bytes of the HTTP network data packet, and obtaining a data packet to be restored;
[0031] The length of the data packet to be restored is obtained, a session index file is set according to the length of the data packet to be restored, and the data packet to be restored is indexed out of the buffer area according to the session index file.
[0032] In one of the embodiments, when the HTTP network data packet is shunted according to the number of bytes of the HTTP network data packet and the data packet to be restored is obtained, the method includes:
[0033] Obtaining the byte number A of the HTTP network data packet, and setting the number of the data packets to be restored according to the byte number A of the HTTP network data packet;
[0034] Preset a byte number matrix B of HTTP network data packets, set B (B1, B2, B3, B4), where B1 is a first preset byte number, B2 is a second preset byte number, B3 is a third preset byte number, B4 is a fourth preset byte number, and B1 < B2 < B3 < B4;
[0035] A matrix C of the number of data packets to be restored is preset, and C (C1, C2, C3, C4, C5) is set, wherein C1 is the number of the first preset data packets to be restored, C2 is the number of the second preset data packets to be restored, C3 is the number of the third preset data packets to be restored, C4 is the number of the fourth preset data packets to be restored, and C5 is the number of the fifth preset data packets to be restored, and C1<C2<C3<C4<C5;
[0036] The number of the data packets to be restored is set according to the relationship between the number of bytes A of the HTTP network data packet and the number of bytes of each preset HTTP network data packet:
[0037] When A<B1, the first preset number C1 of data packets to be restored is selected as the number of data packets to be restored;
[0038] When B1≤A<B2, selecting the second preset number C2 of data packets to be restored as the number of data packets to be restored;
[0039] When B2≤A<B3, the third preset number C3 of data packets to be restored is selected as the number of data packets to be restored;
[0040] When B3≤A<B4, the fourth preset number C4 of data packets to be restored is selected as the number of data packets to be restored;
[0041] When B4≤A, the fifth preset number C5 of data packets to be restored is selected as the number of data packets to be restored.
[0042] In one embodiment, when setting the session index file according to the length of the data packet to be restored, it includes:
[0043] Obtaining the length E of the data packet to be restored, and setting the index length of the session index file according to the length E of the data packet to be restored;
[0044] Preset a length matrix F of the data packet to be restored, set F (F1, F2, F3, F4), where F1 is a first preset length, F2 is a second preset length, F3 is a third preset length, F4 is a fourth preset length, and F1 < F2 < F3 < F4;
[0045] The index length matrix P of the preset session index file is set to P (P1, P2, P3, P4, P5), where P1 is the first preset index length, P2 is the second preset index length, P3 is the third preset index length, P4 is the fourth preset index length, P5 is the fifth preset index length, and P1 < P2 < P3 < P4 < P5;
[0046] The index length of the session index file is set according to the relationship between the length E of the data packet to be restored and the lengths of each preset data packet to be restored:
[0047] When E<F1, the first preset index length P1 is selected as the index length of the session index file;
[0048] When F1≤E<F2, the second preset index length P2 is selected as the index length of the session index file;
[0049] When F2≤E<F3, the third preset index length P3 is selected as the index length of the session index file;
[0050] When F3≤E<F4, the fourth preset index length P4 is selected as the index length of the session index file;
[0051] When F4≤E, the fifth preset index length P5 is selected as the index length of the session index file.
[0052] In one of the embodiments, after indexing the to-be-restored data packet out of the buffer area according to the session index file, the method further includes:
[0053] Traversing the HTTP network data packet and obtaining characteristic information of the HTTP network data packet, and determining original location information of the file content stored in the HTTP network data packet according to the characteristic information;
[0054] Based on the original location information, the flow of the HTTP network data packet is restored.
[0055] In one of the embodiments, after performing traffic restoration on the HTTP network data packet, the method further includes:
[0056] Obtain the file suffix name of the restored HTTP network data packet, match the file suffix name with the suffix name library, and if the file suffix name is not in the suffix name library, perform intelligent analysis on the restored HTTP network data packet to obtain session information, file header information and file data information of the restored HTTP network data packet;
[0057] The file format of the restored HTTP network data packet is determined according to the session information, the file header information and the file data information, and a correct suffix name is added to the restored HTTP network data packet based on the file format.
[0058] The present invention provides an HTTP traffic restoration method, which has the following beneficial effects compared with the prior art:
[0059] The present invention discloses an HTTP traffic restoration method, comprising: obtaining HTTP network data packets in network traffic, storing the HTTP network data packets in a preset cache area, segmenting the HTTP network data packets, extracting valid fields in the HTTP network data packets, obtaining preset warning rules according to the valid fields, judging whether to issue an attack alarm to the HTTP network data packets according to the warning rules, and restoring the traffic of the HTTP network data packets when it is judged that it is not necessary to issue an attack alarm to the HTTP network data packets. The present invention can identify the attack information of the attacker, and provide reliable data support for multiple scenarios such as threat tracing, malicious domain name analysis, email virus detection, user behavior analysis, etc., while ensuring normal network efficiency and meeting the needs of real-time data restoration. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A schematic diagram of a process of HTTP traffic restoration method in an embodiment of the present invention is shown;
[0061] Figure 2 A schematic diagram of a process of storing HTTP network data packets in a preset buffer area in an embodiment of the present invention is shown;
[0062] Figure 3 A schematic diagram of a process for extracting valid fields from an HTTP network data packet in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0063] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0064] In the description of the present application, it should be understood that the terms "center", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0065] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.
[0066] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0067] The following is a description of preferred embodiments of the present invention with reference to the accompanying drawings.
[0068] like Figure 1 As shown, an embodiment of the present invention discloses an HTTP traffic restoration method, the method comprising:
[0069] S110: Acquire HTTP network data packets in network traffic, and store the HTTP network data packets in a preset cache area.
[0070] like Figure 2 As shown, in order to ensure the restoration rate of HTTP network data packets, in some embodiments of the present application, when obtaining HTTP network data packets in network traffic and storing the HTTP network data packets in a preset buffer area, it includes:
[0071] S111: parsing the HTTP network data packet to obtain identification information carried by the HTTP network data packet;
[0072] S112: Grouping the HTTP network data packets according to the identification information, and storing the grouped HTTP network data packets in the buffer area.
[0073] In this embodiment, when an HTTP network data packet is obtained, the HTTP network data packet is parsed to obtain identification information carried by the HTTP network data packet, the identification information including: a request line, a request header, a blank line, and request data. The HTTP network data packet is then grouped according to the identification information, and the grouped HTTP network data packet is stored in a cache area. If the data packet is large and difficult to process when being transmitted in the network, the present invention can ensure the restoration rate of the HTTP network data packet and improve the utilization rate of network resources by grouping the HTTP network data packet.
[0074] S120: Segment the HTTP network data packet and extract valid fields from the HTTP network data packet.
[0075] like Figure 3As shown, in order to clean invalid data in an HTTP network data packet, in some embodiments of the present application, when the HTTP network data packet is segmented and valid fields in the HTTP network data packet are extracted, the steps include:
[0076] S121: After segmenting the HTTP network data packet, perform data parsing to generate a formatted data group, and perform data cleaning on the formatted data group;
[0077] S122: Extract valid fields of the formatted data group after the cleaning process, and store the valid fields into the second buffer area, wherein the valid fields include: source IP address, destination IP address, packet byte length and timestamp.
[0078] In this embodiment, the HTTP network data packet is segmented, and then the segmented files are parsed. The present invention puts the parsed data into a thread pool, and then cleans the data, removes data that does not meet the conditions, selects useful fields, and uses these fields as valid fields to store these fields in the second cache area. The present invention can ensure the validity of the data, and can shorten the time for traffic packet parsing by directly parsing and storing it in the second cache area.
[0079] S130: Acquire a preset warning rule according to the valid field, and determine whether to issue an attack alarm to the HTTP network data packet according to the warning rule.
[0080] In order to identify an attack event carried in an HTTP network data packet, in some embodiments of the present application, when a preset warning rule is obtained according to the valid field, and when determining whether to issue an attack alarm for the HTTP network data packet according to the warning rule, the method includes:
[0081] Determine whether the valid field matches the preset warning rule,
[0082] If not, no attack alarm will be issued;
[0083] If so, an attack alarm is issued for the HTTP network data packet, and the packet sequence number and file name corresponding to the HTTP network data packet are obtained. Based on the packet sequence number and the file name, the stream of the attack alarm event is queried from the cache area, and the traffic segment corresponding to the attack alarm is cut out from the stream of the attack alarm event, and attack analysis and evidence collection are performed.
[0084] In this embodiment, a preset warning rule is obtained, and it is determined whether the valid field matches the preset warning rule according to the warning rule. When the valid field matches the preset warning rule, that is, if the data of the HTTP network data packet can match one or more rules, the packet sequence number and file name corresponding to the HTTP network data packet are obtained, and the stream of the attack alarm event is queried from the cache area based on the packet sequence number and the file name, and the traffic segment corresponding to the attack alarm is cut out from the stream of the attack alarm event, and attack analysis and evidence collection are performed, wherein a stream is a process of establishing a connection and disconnecting a connection. By determining whether to issue an attack alarm to the HTTP network data packet according to the warning rule, the present invention can provide reliable data support for multiple scenarios such as threat tracing, malicious domain name analysis, email virus detection, and user behavior analysis.
[0085] In order to send out an alarm signal in real time to send out an attack alarm to the HTTP network data packet, in some embodiments of the present application, when sending out an attack alarm to the HTTP network data packet, the following steps are included:
[0086] Obtaining a matching degree G between the HTTP network data packet and the preset warning rule, and issuing alarm signals of different levels according to the matching degree G;
[0087] Preset the matching degree matrix K, set K (β1, β2, β3), where β1 is the first preset matching degree, β2 is the second preset matching degree, β3 is the third preset matching degree, and β1 < β2 < β3;
[0088] Different levels of alarm signals are issued according to the relationship between the matching degree G and each preset matching degree:
[0089] When G≤β1, no alarm signal is issued;
[0090] When β1<G≤β2, a third-level alarm signal is issued;
[0091] When β2<G≤β3, a secondary alarm signal is issued;
[0092] When β3<G, a first-level alarm signal is issued.
[0093] In this embodiment, when the data of the HTTP network data packet can match one or more rules, the matching degree G is determined according to the number of matching rules. When the number of matching rules is greater, the matching degree is higher. The specific matching degree can be set in the mapping table according to the actual situation to determine the matching degree. The present invention sends out alarm signals of different levels according to the relationship between the matching degree G and each preset matching degree, thereby reminding the network operation and maintenance personnel to process the HTTP network data packet with the attack event to prevent the further transmission of the HTTP network data packet.
[0094] S140: When it is determined that there is no need to issue an attack alarm for the HTTP network data packet, restore the flow of the HTTP network data packet.
[0095] In order to ensure that the HTTP network data packet can be completely and accurately restored, in some embodiments of the present application, when it is determined that there is no need to issue an attack alarm for the HTTP network data packet, the flow restoration of the HTTP network data packet includes:
[0096] Obtaining the number of bytes of the HTTP network data packet, performing flow splitting processing on the HTTP network data packet according to the number of bytes of the HTTP network data packet, and obtaining a data packet to be restored;
[0097] When the HTTP network data packet is shunted according to the number of bytes of the HTTP network data packet and the data packet to be restored is obtained, the method includes:
[0098] Obtaining the byte number A of the HTTP network data packet, and setting the number of the data packets to be restored according to the byte number A of the HTTP network data packet;
[0099] Preset a byte number matrix B of HTTP network data packets, set B (B1, B2, B3, B4), where B1 is a first preset byte number, B2 is a second preset byte number, B3 is a third preset byte number, B4 is a fourth preset byte number, and B1 < B2 < B3 < B4;
[0100] A matrix C of the number of data packets to be restored is preset, and C (C1, C2, C3, C4, C5) is set, wherein C1 is the number of the first preset data packets to be restored, C2 is the number of the second preset data packets to be restored, C3 is the number of the third preset data packets to be restored, C4 is the number of the fourth preset data packets to be restored, and C5 is the number of the fifth preset data packets to be restored, and C1<C2<C3<C4<C5;
[0101] The number of the data packets to be restored is set according to the relationship between the number of bytes A of the HTTP network data packet and the number of bytes of each preset HTTP network data packet:
[0102] When A<B1, the first preset number C1 of data packets to be restored is selected as the number of data packets to be restored;
[0103] When B1≤A<B2, selecting the second preset number C2 of data packets to be restored as the number of data packets to be restored;
[0104] When B2≤A<B3, the third preset number C3 of data packets to be restored is selected as the number of data packets to be restored;
[0105] When B3≤A<B4, the fourth preset number C4 of data packets to be restored is selected as the number of data packets to be restored;
[0106] When B4≤A, the fifth preset number C5 of data packets to be restored is selected as the number of data packets to be restored.
[0107] In this embodiment, the number of bytes of an HTTP network data packet, such as 64 bytes, 1518 bytes, etc., is obtained, the HTTP network data packet is shunted according to the number of bytes of the HTTP network data packet, and a data packet to be restored is obtained, wherein the present invention sets the number of data packets to be restored according to the relationship between the number of bytes A of the HTTP network data packet and the number of bytes of each preset HTTP network data packet. By shunting the HTTP network data packet and obtaining the data packet to be restored, the present invention can ensure that the length of each data packet to be restored is in an optimal state, thereby effectively ensuring network efficiency.
[0108] In order to increase the speed of the indexing operation, in some embodiments of the present application, the length of the data packet to be restored is obtained, a session index file is set according to the length of the data packet to be restored, and the data packet to be restored is indexed out of the cache area according to the session index file.
[0109] When the session index file is set according to the length of the data packet to be restored, it includes:
[0110] Obtaining the length E of the data packet to be restored, and setting the index length of the session index file according to the length E of the data packet to be restored;
[0111] Preset a length matrix F of the data packet to be restored, set F (F1, F2, F3, F4), where F1 is a first preset length, F2 is a second preset length, F3 is a third preset length, F4 is a fourth preset length, and F1 < F2 < F3 < F4;
[0112] The index length matrix P of the preset session index file is set to P (P1, P2, P3, P4, P5), where P1 is the first preset index length, P2 is the second preset index length, P3 is the third preset index length, P4 is the fourth preset index length, P5 is the fifth preset index length, and P1 < P2 < P3 < P4 < P5;
[0113] The index length of the session index file is set according to the relationship between the length E of the data packet to be restored and the lengths of each preset data packet to be restored:
[0114] When E<F1, the first preset index length P1 is selected as the index length of the session index file;
[0115] When F1≤E<F2, the second preset index length P2 is selected as the index length of the session index file;
[0116] When F2≤E<F3, the third preset index length P3 is selected as the index length of the session index file;
[0117] When F3≤E<F4, the fourth preset index length P4 is selected as the index length of the session index file;
[0118] When F4≤E, the fifth preset index length P5 is selected as the index length of the session index file.
[0119] In this embodiment, a session index file is set according to the length of the data packet to be restored, and the data packet to be restored is indexed out of the cache area according to the session index file. The present invention sets the index length of the session index file according to the relationship between the length E of the data packet to be restored and the lengths of each preset data packet to be restored. By setting the index length of the session index file, the present invention can reduce the burden of a single session index file, thereby saving a large amount of disk space and effectively improving the speed of the indexing operation.
[0120] In order to ensure that the HTTP network data packet can be completely and accurately restored to the original location, in some embodiments of the present application, after the data packet to be restored is indexed out of the cache area according to the session index file, the method further includes:
[0121] Traversing the HTTP network data packet and obtaining characteristic information of the HTTP network data packet, and determining original location information of the file content stored in the HTTP network data packet according to the characteristic information;
[0122] Based on the original location information, the flow of the HTTP network data packet is restored.
[0123] In the present embodiment, the HTTP network data packet includes a header part and a data part. When traversing the HTTP network data packet, the header part can be traversed first. When the target feature is traversed in the header part, there is no need to traverse the data part. Since the header of the data packet only includes the destination of the data and the relationship between the data packet and other data, the amount of data is small. If the target feature information can be traversed in the header part, the traversal time can be saved and the traversal efficiency can be improved. Among them, the feature information is the source port number. The original location information of the file content stored in the HTTP network data packet is determined according to the source port number. By determining the original location information of the file content stored in the HTTP network data packet, the present invention can accurately restore the HTTP network data packet to the original location, effectively improving the restoration efficiency, reducing network congestion, and reducing the probability of HTTP network data packet loss.
[0124] In order to ensure the accuracy of restoration of HTTP network data packets, in some embodiments of the present application, after performing traffic restoration on the HTTP network data packets, the method further includes:
[0125] Obtain the file suffix name of the restored HTTP network data packet, match the file suffix name with the suffix name library, and if the file suffix name is not in the suffix name library, perform intelligent analysis on the restored HTTP network data packet to obtain session information, file header information and file data information of the restored HTTP network data packet;
[0126] The file format of the restored HTTP network data packet is determined according to the session information, the file header information and the file data information, and a correct suffix name is added to the restored HTTP network data packet based on the file format.
[0127] In this embodiment, the file suffix name of the restored HTTP network data packet is obtained, and the file suffix name is matched with a suffix name library, wherein the suffix name library can be set according to actual needs. If the file suffix name is not in the suffix name library, the restored HTTP network data packet is intelligently analyzed, and the file format of the HTTP network data packet is determined through the session information, file header information and file data information of the restored HTTP network data packet, and the correct suffix name is added to the restored HTTP network data packet based on the file format. By adding the correct suffix name to the restored HTTP network data packet, it is convenient for users to determine the file type and improve work efficiency.
[0128] In summary, the embodiment of the present invention obtains HTTP network data packets in network traffic, stores the HTTP network data packets in a preset cache area, segments the HTTP network data packets, extracts valid fields in the HTTP network data packets, obtains preset warning rules according to the valid fields, and determines whether to issue an attack alarm for the HTTP network data packets according to the warning rules. When it is determined that there is no need to issue an attack alarm for the HTTP network data packets, the traffic of the HTTP network data packets is restored. The present invention can identify the attack information of the attacker and provide reliable data support for multiple scenarios such as threat tracing, malicious domain name analysis, email virus detection, user behavior analysis, etc. At the same time, it not only ensures normal network efficiency, but also meets the needs of real-time data restoration.
[0129] In the description of the above embodiments, specific features, structures, materials or characteristics may be combined in a suitable manner in any one or more embodiments or examples.
[0130] Although the present invention has been described above with reference to the embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present invention. In particular, as long as there is no structural conflict, the various features in the embodiments disclosed by the present invention may be used in combination with each other in any manner, and the fact that these combinations are not fully described in this specification is only for the sake of omitting space and saving resources. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
[0131] Those skilled in the art can understand that the above are only preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A HTTP traffic restoration method, characterized in that: The method comprises: Acquire HTTP network data packets in network traffic, and store the HTTP network data packets in a preset buffer area; Segmenting the HTTP network data packet and extracting valid fields in the HTTP network data packet; Acquire a preset warning rule according to the valid field, and determine whether to issue an attack alarm to the HTTP network data packet according to the warning rule; When it is determined that there is no need to issue an attack alarm for the HTTP network data packet, traffic restoration is performed on the HTTP network data packet.
2. The HTTP traffic restoration method according to claim 1, characterized in that: When obtaining HTTP network data packets in network traffic and storing the HTTP network data packets in a preset buffer area, it includes: Parsing the HTTP network data packet to obtain identification information carried by the HTTP network data packet; The HTTP network data packets are grouped according to the identification information, and the grouped HTTP network data packets are stored in the buffer area.
3. The HTTP traffic restoration method according to claim 1, characterized in that: When the HTTP network data packet is segmented and valid fields in the HTTP network data packet are extracted, the method includes: After segmenting the HTTP network data packets, data parsing is performed to generate formatted data groups, and data cleaning is performed on the formatted data groups; Extract the valid fields of the formatted data group after the cleaning process, and store the valid fields in the second buffer area, wherein the valid fields include: source IP address, destination IP address, packet byte length and timestamp.
4. The HTTP traffic restoration method according to claim 1, characterized in that: When a preset warning rule is obtained according to the valid field, and when it is determined whether to issue an attack alarm to the HTTP network data packet according to the warning rule, it includes: Determine whether the valid field matches the preset warning rule, If not, no attack alarm will be issued; If so, an attack alarm is issued for the HTTP network data packet, and the packet sequence number and file name corresponding to the HTTP network data packet are obtained. Based on the packet sequence number and the file name, the stream of the attack alarm event is queried from the cache area, and the traffic segment corresponding to the attack alarm is cut out from the stream of the attack alarm event, and attack analysis and evidence collection are performed.
5. The HTTP traffic restoration method according to claim 4, characterized in that: When an attack alarm is issued for the HTTP network data packet, it includes: Obtaining a matching degree G between the HTTP network data packet and the preset warning rule, and issuing alarm signals of different levels according to the matching degree G; Preset the matching degree matrix K, set K (β1, β2, β3), where β1 is the first preset matching degree, β2 is the second preset matching degree, β3 is the third preset matching degree, and β1 < β2 < β3; Different levels of alarm signals are issued according to the relationship between the matching degree G and each preset matching degree: When G≤β1, no alarm signal is issued; When β1<G≤β2, a third-level alarm signal is issued; When β2<G≤β3, a secondary alarm signal is issued; When β3<G, a first-level alarm signal is issued.
6. The HTTP traffic restoration method according to claim 1, characterized in that: When it is determined that there is no need to issue an attack alarm to the HTTP network data packet, the flow of the HTTP network data packet is restored, including: Obtaining the number of bytes of the HTTP network data packet, performing flow splitting processing on the HTTP network data packet according to the number of bytes of the HTTP network data packet, and obtaining a data packet to be restored; The length of the data packet to be restored is obtained, a session index file is set according to the length of the data packet to be restored, and the data packet to be restored is indexed out of the buffer area according to the session index file.
7. The HTTP traffic restoration method according to claim 6, characterized in that: When the HTTP network data packet is shunted according to the number of bytes of the HTTP network data packet and the data packet to be restored is obtained, the method includes: Obtaining the byte number A of the HTTP network data packet, and setting the number of the data packets to be restored according to the byte number A of the HTTP network data packet; Preset a byte number matrix B of HTTP network data packets, set B (B1, B2, B3, B4), where B1 is a first preset byte number, B2 is a second preset byte number, B3 is a third preset byte number, B4 is a fourth preset byte number, and B1 < B2 < B3 < B4; A matrix C of the number of data packets to be restored is preset, and C (C1, C2, C3, C4, C5) is set, wherein C1 is the number of the first preset data packets to be restored, C2 is the number of the second preset data packets to be restored, C3 is the number of the third preset data packets to be restored, C4 is the number of the fourth preset data packets to be restored, and C5 is the number of the fifth preset data packets to be restored, and C1<C2<C3<C4<C5; The number of the data packets to be restored is set according to the relationship between the number of bytes A of the HTTP network data packet and the number of bytes of each preset HTTP network data packet: When A<B1, the first preset number C1 of data packets to be restored is selected as the number of data packets to be restored; When B1≤A<B2, selecting the second preset number C2 of data packets to be restored as the number of data packets to be restored; When B2≤A<B3, the third preset number C3 of data packets to be restored is selected as the number of data packets to be restored; When B3≤A<B4, the fourth preset number C4 of data packets to be restored is selected as the number of data packets to be restored; When B4≤A, the fifth preset number C5 of data packets to be restored is selected as the number of data packets to be restored.
8. The HTTP traffic restoration method according to claim 6, characterized in that: When the session index file is set according to the length of the data packet to be restored, it includes: Obtaining the length E of the data packet to be restored, and setting the index length of the session index file according to the length E of the data packet to be restored; Preset a length matrix F of the data packet to be restored, set F (F1, F2, F3, F4), where F1 is a first preset length, F2 is a second preset length, F3 is a third preset length, F4 is a fourth preset length, and F1 < F2 < F3 < F4; The index length matrix P of the preset session index file is set to P (P1, P2, P3, P4, P5), where P1 is the first preset index length, P2 is the second preset index length, P3 is the third preset index length, P4 is the fourth preset index length, P5 is the fifth preset index length, and P1 < P2 < P3 < P4 < P5; The index length of the session index file is set according to the relationship between the length E of the data packet to be restored and the lengths of each preset data packet to be restored: When E<F1, the first preset index length P1 is selected as the index length of the session index file; When F1≤E<F2, the second preset index length P2 is selected as the index length of the session index file; When F2≤E<F3, the third preset index length P3 is selected as the index length of the session index file; When F3≤E<F4, the fourth preset index length P4 is selected as the index length of the session index file; When F4≤E, the fifth preset index length P5 is selected as the index length of the session index file.
9. The HTTP traffic restoration method according to claim 6, characterized in that: After the data packet to be restored is indexed out of the buffer area according to the session index file, the method further includes: Traversing the HTTP network data packet and obtaining characteristic information of the HTTP network data packet, and determining original location information of the file content stored in the HTTP network data packet according to the characteristic information; Based on the original location information, the flow of the HTTP network data packet is restored.
10. The HTTP traffic restoration method according to claim 1, characterized in that: After restoring the traffic of the HTTP network data packet, the method further includes: Obtain the file suffix name of the restored HTTP network data packet, match the file suffix name with the suffix name library, and if the file suffix name is not in the suffix name library, perform intelligent analysis on the restored HTTP network data packet to obtain session information, file header information and file data information of the restored HTTP network data packet; The file format of the restored HTTP network data packet is determined according to the session information, the file header information and the file data information, and a correct suffix name is added to the restored HTTP network data packet based on the file format.
