A method and system for restoring text of network traffic content
By detecting the encoding method and confidence of network traffic text, combined with data segmentation and sorting and interception methods, the problem of garbled characters caused by byte misalignment is solved, the accuracy of text restoration is improved, and the garbled parts are effectively restored.
Patent Information
- Application Number
- CN202111483777.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-12-07
AI Technical Summary
When the existing technology restores text in network traffic, it is difficult to accurately detect the text encoding method due to byte misalignment resulting in garbled characters, which in turn leads to erroneous decoding and more garbled characters.
By obtaining the text to be detected, the coding method is detected and the confidence level is determined. If the confidence level is high, the data block counter and coding method are used to sort and intercept the text content to restore the text content; if the confidence level is low, the text is updated and the detection is repeated until reliable result.
It effectively corrects byte misalignment, improves the accuracy of text restoration, solves the problem of unreliable detection results caused by garbled characters, and restores the content of the garbled parts as much as possible.
Smart Images

Figure CN114118017B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text encoding, and in particular to a method and system for restoring text of network traffic content. Background Art
[0002] When transmitting traffic in the network, when restoring the text content of the captured traffic, the restored text content often appears garbled. Without considering encryption, how to correctly detect the encoding method of the text and restore the text content of the garbled part as much as possible. The existing method of detecting text encoding methods is based on normal text for detection. For text with garbled characters, it is easy to get wrong detection results due to the interference of the garbled part. The solution starts with the cause of garbled characters. Due to poor network signals and other reasons, packet loss often occurs during data transmission, so the captured traffic is not complete. The loss of data packets causes the original text to lose some bytes, resulting in byte misalignment under the original encoding method. In this case, even if the decoding is correct, garbled characters may be generated, not to mention that byte misalignment will also make it impossible to detect the correct encoding method. Decoding in the wrong way will generate more garbled characters. Summary of the invention
[0003] The purpose of the present invention is to provide a method and system for restoring text of network traffic content, so as to solve the problem of garbled characters caused by byte misalignment and improve the accuracy of text restoration.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] A method for restoring text of network traffic content, comprising:
[0006] Get the text to be detected;
[0007] Performing encoding detection on the text to be detected to obtain the encoding method and the confidence of the detection result;
[0008] Determine whether the confidence level is greater than a set confidence level threshold, and obtain a first determination result;
[0009] If the first judgment result indicates that the confidence is greater than the set confidence threshold, the confidence counter value is increased by one, and the text restoration content is obtained by using the sorting and truncation method according to the data block counter value and the encoding method;
[0010] If the first judgment result indicates that the confidence is less than or equal to the set confidence threshold, then the file number of the text to be detected is recorded and it is determined whether the value of the confidence counter is equal to 0 to obtain a second judgment result;
[0011] If the second judgment result indicates that the confidence counter value is equal to 0, then the text to be detected is updated according to the data block counter value and the process returns to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result";
[0012] If the second judgment result indicates that the value of the confidence counter is not equal to 0, the text to be detected is sorted and intercepted to obtain the text restoration content.
[0013] Optionally, before performing encoding detection on the text to be detected and obtaining the encoding method and the confidence of the detection result, the method further includes:
[0014] Set both the confidence counter value and the data block counter value to 0.
[0015] Optionally, obtaining the text restoration content by using a sorting and truncation method according to the data block counter value and the encoding method specifically includes:
[0016] Determine whether the value of the data block counter is equal to 0, and obtain a third determination result;
[0017] If the third judgment result indicates that the value of the data block counter is equal to 0, the text to be detected is restored according to the encoding method to obtain text restoration content;
[0018] If the third judgment result indicates that the value of the data block counter is not equal to 0, the text to be detected is sorted and intercepted to obtain the text restoration content.
[0019] Optionally, the step of sorting and intercepting the text to be detected to obtain text restoration content specifically includes:
[0020] Determine a first encoding mode and a second encoding mode according to the encoding mode and the confidence level;
[0021] Sort the file numbers and obtain the maximum and minimum values of the file numbers;
[0022] The file to be detected is intercepted by using the maximum value and the minimum value of the file number to obtain an intercepted file, a first retained file and a third retained file; the content of the first retained file is located before the content of the intercepted file; the content of the third retained file is located after the content of the intercepted file;
[0023] intercepting and completing the intercepted files to obtain an intercepted file group;
[0024] Integrate the first retained file, the intercepted file group and the third retained file in sequence to obtain an integrated file;
[0025] The integrated file is restored using the first encoding method and the second encoding method respectively to obtain text restoration content.
[0026] Optionally, determining the first encoding mode and the second encoding mode according to the encoding mode and the confidence level specifically includes:
[0027] Obtaining the encoding method of the text to be detected with the highest confidence;
[0028] The encoding method of the text to be detected with the highest confidence is used as the first encoding method;
[0029] The encoding method with the largest number is obtained and used as the second encoding method.
[0030] Optionally, the updating of the text to be detected according to the value of the data block counter and returning to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result" specifically includes:
[0031] Determine whether the value of the data block counter is greater than a set data block threshold, and obtain a fourth determination result;
[0032] If the fourth judgment result indicates that the value of the data block counter is greater than the set data block threshold, outputting that no reliable result is detected;
[0033] If the fourth judgment result indicates that the value of the data block counter is less than or equal to the set data block threshold, the text to be detected is divided into data blocks to obtain multiple data blocks;
[0034] The value of the data block counter is increased by one, and the plurality of data blocks are respectively used as the text to be detected and the process returns to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence level of the detection result".
[0035] Optionally, dividing the text to be detected into data blocks to obtain multiple data blocks specifically includes:
[0036] Increasing the value of the data block counter by one;
[0037] The text to be detected is split at a set byte to obtain an original file and a split file; the set byte is a byte numbered as a value of a data block counter;
[0038] The split file is split into data to obtain multiple data blocks.
[0039] A text restoration system for network traffic content, comprising:
[0040] An acquisition module is used to acquire the text to be detected;
[0041] An encoding method detection module is used to detect the encoding method of the text to be detected and obtain the encoding method and the confidence of the detection result;
[0042] A first judgment module, used to judge whether the confidence level is greater than a set confidence level threshold, and obtain a first judgment result;
[0043] A first sorting and intercepting module, configured to increase the value of the confidence counter by one if the first judgment result indicates that the confidence is greater than a set confidence threshold, and obtain text restoration content by using a sorting and intercepting method according to the value of the data block counter and the encoding method;
[0044] A second judgment module is used to record the file number of the text to be detected and determine whether the value of the confidence counter is equal to 0 to obtain a second judgment result if the first judgment result indicates that the confidence is less than or equal to the set confidence threshold;
[0045] A return module, for updating the text to be detected according to the value of the data block counter and returning to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result" if the second judgment result indicates that the confidence counter value is equal to 0;
[0046] The second sorting and intercepting module is used to sort and intercept the text to be detected to obtain text restoration content if the second judgment result indicates that the value of the confidence counter is not equal to 0.
[0047] Optionally, it also includes:
[0048] The initial setting module is used to set the confidence counter value and the data block counter value to 0.
[0049] Optionally, the first sorting and intercepting module specifically includes:
[0050] A judging unit, used for judging whether the value of the data block counter is equal to 0, and obtaining a third judging result;
[0051] A restoration unit, configured to restore the text to be detected according to the encoding method to obtain text restoration content if the third judgment result indicates that the value of the data block counter is equal to 0;
[0052] The sorting and intercepting unit is used to sort and intercept the text to be detected to obtain text restoration content if the third judgment result indicates that the value of the data block counter is not equal to 0.
[0053] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0054] The present invention provides a method and system for text restoration of network traffic content, which detects the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result; if the first judgment result indicates that the confidence is greater than the set confidence threshold, the confidence counter value is increased by one, and the text restoration content is obtained by sorting and intercepting the data block counter value and the encoding method; if the first judgment result indicates that the confidence is less than or equal to the set confidence threshold, the file number of the text to be detected is recorded and it is determined whether the confidence counter value is equal to 0, and if the confidence counter value is not equal to 0, the text to be detected is sorted and intercepted to obtain the text restoration content. By sorting and intercepting the text to be detected, the part with byte misalignment is corrected to achieve the purpose of restoring the garbled part of the content, thereby improving the accuracy of text restoration. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be 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 labor.
[0056] Figure 1 A flow chart of the text restoration method of network traffic content provided by the present invention;
[0057] Figure 2 A specific flow chart of the text restoration method of network traffic content provided by the present invention;
[0058] Figure 3 A schematic diagram of the first data segmentation result provided by the present invention;
[0059] Figure 4 A schematic diagram of the second data segmentation result provided by the present invention;
[0060] Figure 5 A schematic diagram of the interception results provided by the present invention;
[0061] Figure 6 A schematic diagram of the interception and completion method provided by the present invention;
[0062] Figure 7 This is a schematic diagram of the integrated file provided by the present invention. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] The purpose of the present invention is to provide a method and system for restoring text of network traffic content, so as to solve the problem of garbled characters caused by byte misalignment and improve the accuracy of text restoration.
[0065] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0066] like Figure 1 As shown, the present invention provides a text restoration method for network traffic content, comprising:
[0067] Step 101: Obtain the text to be detected.
[0068] Step 102: Perform encoding detection on the text to be detected to obtain the encoding method and the confidence of the detection result.
[0069] Step 103: Determine whether the confidence is greater than a set confidence threshold and obtain a first judgment result; if the first judgment result indicates that the confidence is greater than the set confidence threshold, execute step 104; if the first judgment result indicates that the confidence is less than or equal to the set confidence threshold, execute step 105.
[0070] Step 104: adding one to the confidence counter value, and obtaining the text restoration content by using the sorting and truncation method according to the data block counter value and the encoding method.
[0071] Step 105: Record the file number of the text to be detected and determine whether the confidence counter value is equal to 0 to obtain a second determination result. If the second determination result indicates that the confidence counter value is equal to 0, execute step 106; if the second determination result indicates that the confidence counter value is not equal to 0, execute step 107.
[0072] Step 106: Update the text to be detected according to the value of the data block counter and return to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result".
[0073] Step 107: sort and intercept the text to be detected to obtain text restoration content.
[0074] In practical applications, before the encoding method of the to-be-detected text is detected and the confidence of the encoding method and the detection result is obtained, the method further includes: setting the confidence counter value and the data block counter value to 0.
[0075] Wherein, the step 104 obtains the text restoration content by using the sorting and interception method according to the data block counter value and the encoding method, and specifically includes:
[0076] It is determined whether the value of the data block counter is equal to 0 to obtain a third determination result.
[0077] If the third judgment result indicates that the value of the data block counter is equal to 0, the text to be detected is restored according to the encoding method to obtain the text restoration content.
[0078] If the third judgment result indicates that the value of the data block counter is not equal to 0, the text to be detected is sorted and intercepted to obtain the text restoration content. The text to be detected is sorted and intercepted to obtain the text restoration content, specifically including:
[0079] Determine the first encoding mode and the second encoding mode according to the encoding mode and the confidence. Determine the first encoding mode and the second encoding mode according to the encoding mode and the confidence, specifically including: obtaining the encoding mode of the to-be-detected text with the highest confidence; using the encoding mode of the to-be-detected text with the highest confidence as the first encoding mode; obtaining the largest number of encoding modes and using the largest number of encoding modes as the second encoding mode.
[0080] The file numbers are sorted and the maximum and minimum values of the file numbers are obtained.
[0081] The file to be detected is intercepted using the maximum and minimum values of the file number to obtain an intercepted file, a first retained file and a third retained file; the content of the first retained file is located before the content of the intercepted file; the content of the third retained file is located after the content of the intercepted file; the text area to be detected before the minimum value of the file number is intercepted as the first retained file, the text area to be detected after the maximum value of the file number is intercepted as the third retained file, and the text area to be detected between the minimum and maximum values of the file number is intercepted as the intercepted file.
[0082] The intercepted files are intercepted and completed to obtain an intercepted file group.
[0083] The first retained file, the intercepted file group and the third retained file are sequentially integrated to obtain an integrated file.
[0084] The integrated file is restored using the first encoding method and the second encoding method respectively to obtain text restoration content.
[0085] In practical applications, the step 106 updates the text to be detected according to the value of the data block counter and returns to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result", which specifically includes:
[0086] It is determined whether the value of the data block counter is greater than a set data block threshold to obtain a fourth determination result.
[0087] If the fourth judgment result indicates that the value of the data block counter is greater than the set data block threshold, then a reliable result that is not detected is output.
[0088] If the fourth judgment result indicates that the value of the data block counter is less than or equal to the set data block threshold, the text to be detected is divided into data blocks to obtain multiple data blocks. Particularly, the text to be detected is divided into data blocks to obtain multiple data blocks, including: adding one to the value of the data block counter; splitting the text to be detected at the set byte to obtain the original file and the split file; the set byte is the byte numbered by the value of the data block counter; splitting the split file into data to obtain multiple data blocks.
[0089] The value of the data block counter is increased by one, and the plurality of data blocks are respectively used as the text to be detected and the process returns to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence level of the detection result".
[0090] like Figure 2 As shown, the present invention also provides a specific working steps of a text restoration method for network traffic content in practical application, wherein the confidence threshold is set to 0.9 and the data block threshold is set to 3.
[0091] Step 1: For the text to be detected, use the chardet module of Python to detect the encoding of the text. After the detection, the encoding encoding and the confidence of the detection result are returned, where the confidence value ranges from 0 to 1. Before the detection, set the global variables t and n to 0. T is a counter for the number of data block operations. Each time a data block operation is performed, t is increased by 1. When t is greater than 3, no data block operation is performed and the program stops. Before each data block operation, the first t bytes are cut off from the original file, i.e., the text to be detected, and the file with t bytes cut off is named the original file t. After that, data blocks are performed on the basis of the original file t (see step 5 for data block example). n is a counter with a confidence greater than a certain value, i.e., a confidence counter (such as in step 2, if the confidence is greater than 0.9, n is increased by 1). Once n is greater than 0, it means that a reliable detection result has been obtained, that is, n is a counter to record whether a reliable result has been obtained in the entire process.
[0092] Step 2: Determine whether the confidence return value is greater than 0.9. 0.9 is an adjustable parameter that can be adjusted according to actual conditions.
[0093] Confidence is the confidence of the detection result, and its value range is 0 to 1. The more reliable the detection result, the higher the confidence. If the confidence of the detection result is greater than 0.9, it means that the detection result is very reliable and can be used for the final content restoration (see step 7 for details); if the confidence is less than 0.9, it means that the detection result is not very reliable and data segmentation is required. The significance of 0.9 as an adjustable parameter is that if you pursue higher confidence, you can adjust it to 0.95 or even 0.99, otherwise it can be adjusted to 0.85 or 0.8. Note that if the value of this parameter is too low, it is meaningless.
[0094] Step 3: When the confidence is greater than 0.9, n is increased by 1, and then it is determined whether t is equal to 0. If t is equal to 0, it means that the file to be tested has not been segmented, and the text content can be directly restored according to the encoding method return value in step 1. When t is not equal to 0, it means that the file to be tested has been segmented, and then the sorting and interception step is entered.
[0095] Step 4: When the confidence is less than or equal to 0.9, it means that the detection result of step 1 is not reliable enough. The garbled part in the text affects the program's detection of the text. The text needs to be reprocessed before detection. Record the file number to be detected, and then determine whether n is equal to 0. When n is equal to 0, determine whether t is greater than 3. When t is greater than 3, it means that the number of data blocks has reached 4 times, and no data block operation will be performed. The program stops. At this time, n=0, indicating that there is no situation in the entire detection process where the confidence of the detection result is greater than 0.9, that is, it can be considered that this detection did not obtain the reliable result we think, and the output is "no reliable result detected" (at this time, you can consider lowering 0.9 in step 2 to 0.85 or 0.8, and then repeat the whole process). When t is less than or equal to 3, enter the data block step.
[0096] Step 5: According to the currently known encoding methods, the size of a character in the text may be 1 byte, such as ASCII code; 2 bytes such as gb2312; 3 bytes such as Chinese in UTF-8 encoding; 4 bytes such as UTF-16 encoding. Take their lowest common multiple 12 to ensure that multiple bytes of a character will not be divided into two blocks when the data is segmented, resulting in artificial byte misalignment in the latter part. At the same time, if the detection text is too small, it will also affect the detection result. Therefore, when performing data segmentation, it is necessary to ensure that the size of the data block is sufficient for detection. Set a parameter for the data block size, which is adjustable. The initial data block size is set to 96 bytes. Theoretically, if there is no byte misalignment in the data block, it can be guaranteed that at least 24 characters are detected in each data block. Because a character is at most 4 bytes, data segmentation is performed at most 4 times, that is, in step 4, when t is greater than 3, no data segmentation operation is performed. The object of each data segmentation is the original text to be tested, and the starting position is determined according to the t value. An example is as follows:
[0097] When the data is divided into blocks for the first time, t=0, the starting position of the block is 0, the original file is saved as original file 0, and each data block is numbered 1-1, 1-2, etc., and t+1 is added. Figure 3 shown.
[0098] When the data is divided into blocks for the second time, t=1, the starting position of the block is 1, the first byte is cut off, and the file with the 1-byte cut off is saved as the original file 1. Each data block is numbered 2-1, 2-2...: t+1. The result of the second data division is as follows: Figure 4 shown.
[0099] The same applies for the third and fourth times.
[0100] Step 6: For all the data blocks after the first block division, use the Python chardet module to detect the text encoding method and determine whether the confidence is greater than 0.9. If the confidence is greater than 0.9, proceed to step 3, otherwise proceed to step 4. Until n is not equal to 0 or t is greater than 3, no more data block division is performed.
[0101] Step 7: For all data blocks with confidence greater than 0.9, compare their detected confidence values, and take the encoding value of the data block with the largest confidence value as encoding method 1 of the original file t, that is, the first encoding method; compare the encoding values of all data blocks, and take the encoding value that is consistent and the largest in number as encoding method 2 of the original file t, that is, the second encoding method. For data blocks with confidence less than or equal to 0.9, record the file numbers and sort them, take the minimum and maximum numbers, and cut the entire section of the original file t from the starting position of the smallest number to the ending position of the largest number, and save it as cut file 0. The content before the cut part is saved as retained file 1, that is, the first retained file, and the content after the cut part is saved as retained file 3, that is, the third retained file. The cut result is as follows: Figure 5 shown.
[0102] Based on interception file 0, cut off the first byte and add a byte 0x00 or 0xff at the end, and save it as interception file 1; based on interception file 0, cut off the first 2 bytes and add 2 bytes 0x00 or 0xff at the end, and save it as interception file 2; based on interception file 0, cut off the first 3 bytes and add 3 bytes 0x00 or 0xff at the end, and save it as interception file 3. The interception and completion methods are as follows: Figure 6 shown.
[0103] According to the order of retained file 1, intercepted file n, and retained file 3, integrated file n is synthesized, and integrated file n is restored using encoding methods 1 and 2 respectively, and saved as restored file 1n and restored file 2n. The values of all n above are 1, 2, and 3. The integrated file is as follows Figure 7 shown.
[0104] The present invention also provides a text restoration system for network traffic content, comprising:
[0105] The acquisition module is used to obtain the text to be detected.
[0106] The encoding method detection module is used to detect the encoding method of the text to be detected and obtain the encoding method and the confidence of the detection result.
[0107] The first judgment module is used to judge whether the confidence level is greater than a set confidence level threshold, and obtain a first judgment result.
[0108] The first sorting and intercepting module is used to increase the confidence counter value by one if the first judgment result indicates that the confidence is greater than the set confidence threshold, and obtain the text restoration content by using the sorting and intercepting method according to the data block counter value and the encoding method.
[0109] The second judgment module is used to record the file number of the text to be detected and judge whether the value of the confidence counter is equal to 0 if the first judgment result indicates that the confidence is less than or equal to the set confidence threshold, so as to obtain a second judgment result.
[0110] The return module is used to update the text to be detected according to the value of the data block counter and return to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result" if the second judgment result indicates that the confidence counter value is equal to 0.
[0111] The second sorting and intercepting module is used to sort and intercept the text to be detected to obtain text restoration content if the second judgment result indicates that the value of the confidence counter is not equal to 0.
[0112] In practical applications, the text restoration system of network traffic content also includes: an initial setting module, which is used to set the confidence counter value and the data block counter value to 0.
[0113] Wherein, the first sorting and intercepting module specifically includes:
[0114] The judging unit is used to judge whether the value of the data block counter is equal to 0, and obtain a third judgment result.
[0115] A restoration unit is used to restore the text to be detected according to the encoding method to obtain text restoration content if the third judgment result indicates that the value of the data block counter is equal to 0.
[0116] The sorting and intercepting unit is used to sort and intercept the text to be detected to obtain text restoration content if the third judgment result indicates that the value of the data block counter is not equal to 0.
[0117] When the existing technology for detecting text encoding methods encounters garbled characters in the text, the detection results are often not very reliable. The above method uses the method of dividing the data into blocks to separate the garbled part of a text content, eliminating the factor that garbled characters affect the detection results, and achieving the purpose of correctly detecting the text encoding method. The garbled characters in some texts are caused by byte misalignment. The byte misaligned part is corrected by sorting and intercepting, so as to achieve the purpose of restoring the garbled part content. On the basis of the existing technology for detecting text encoding, the method provided by the present invention performs block and sorting and intercepting operations on the text content, corrects the misaligned bytes, and then detects the correct encoding method by using the existing method, which solves the problem that the existing technology detects the encoding method when there is garbled characters in the text, and the result is unreliable. At the same time, it solves the garbled characters caused by byte misalignment and restores the content of the garbled part as much as possible.
[0118] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0119] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for restoring text of network traffic content, characterized in that: include: Get the text to be detected; Performing encoding detection on the text to be detected to obtain the encoding method and the confidence of the detection result; Determine whether the confidence level is greater than a set confidence level threshold, and obtain a first determination result; If the first judgment result indicates that the confidence is greater than the set confidence threshold, the confidence counter value is increased by one, and the text restoration content is obtained by using the sorting and truncation method according to the data block counter value and the encoding method; If the first judgment result indicates that the confidence is less than or equal to the set confidence threshold, then the file number of the text to be detected is recorded and it is determined whether the value of the confidence counter is equal to 0 to obtain a second judgment result; If the second judgment result indicates that the confidence counter value is equal to 0, then the text to be detected is updated according to the data block counter value and the process returns to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result"; If the second judgment result indicates that the value of the confidence counter is not equal to 0, the text to be detected is sorted and intercepted to obtain the text restoration content.
2. The text restoration method of network traffic content according to claim 1, characterized in that: Before performing encoding detection on the text to be detected and obtaining the encoding method and the confidence of the detection result, the method further includes: Set both the confidence counter value and the data block counter value to 0.
3. The text restoration method of network traffic content according to claim 1 is characterized in that: The method of obtaining text restoration content by using a sorting and interception method according to the data block counter value and the encoding method specifically includes: Determine whether the value of the data block counter is equal to 0, and obtain a third determination result; If the third judgment result indicates that the value of the data block counter is equal to 0, the text to be detected is restored according to the encoding method to obtain text restoration content; If the third judgment result indicates that the value of the data block counter is not equal to 0, the text to be detected is sorted and intercepted to obtain the text restoration content.
4. The text restoration method of network traffic content according to claim 3 is characterized in that: The step of sorting and intercepting the text to be detected to obtain text restoration content specifically includes: Determine a first encoding mode and a second encoding mode according to the encoding mode and the confidence level; Sort the file numbers and obtain the maximum and minimum values of the file numbers; The file to be detected is intercepted by using the maximum value and the minimum value of the file number to obtain an intercepted file, a first retained file and a third retained file; the content of the first retained file is located before the content of the intercepted file; the content of the third retained file is located after the content of the intercepted file; intercepting and completing the intercepted files to obtain an intercepted file group; Integrate the first retained file, the intercepted file group and the third retained file in sequence to obtain an integrated file; The integrated file is restored using the first encoding method and the second encoding method respectively to obtain text restoration content.
5. The text restoration method of network traffic content according to claim 4 is characterized in that: The determining the first encoding mode and the second encoding mode according to the encoding mode and the confidence level specifically includes: Obtaining the encoding method of the text to be detected with the highest confidence; The encoding method of the text to be detected with the highest confidence is used as the first encoding method; The encoding method with the largest number is obtained and used as the second encoding method.
6. The text restoration method of network traffic content according to claim 1, characterized in that: The step of updating the text to be detected according to the value of the data block counter and returning to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result" specifically includes: Determine whether the value of the data block counter is greater than a set data block threshold, and obtain a fourth determination result; If the fourth judgment result indicates that the value of the data block counter is greater than the set data block threshold, outputting that no reliable result is detected; If the fourth judgment result indicates that the value of the data block counter is less than or equal to the set data block threshold, the text to be detected is divided into data blocks to obtain multiple data blocks; The value of the data block counter is increased by one, and the plurality of data blocks are respectively used as the text to be detected and the process returns to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence level of the detection result".
7. The text restoration method of network traffic content according to claim 6, characterized in that: The data segmentation of the to-be-detected text to obtain a plurality of data blocks specifically includes: Increasing the value of the data block counter by one; The text to be detected is split at a set byte to obtain an original file and a split file; the set byte is a byte numbered as a value of a data block counter; The split file is split into data to obtain multiple data blocks.
8. A text restoration system for network traffic content, characterized in that: include: An acquisition module is used to acquire the text to be detected; An encoding method detection module is used to detect the encoding method of the text to be detected and obtain the encoding method and the confidence of the detection result; A first judgment module, used to judge whether the confidence level is greater than a set confidence level threshold, and obtain a first judgment result; A first sorting and intercepting module, configured to increase the value of the confidence counter by one if the first judgment result indicates that the confidence is greater than a set confidence threshold, and obtain text restoration content by using a sorting and intercepting method according to the value of the data block counter and the encoding method; A second judgment module is used to record the file number of the text to be detected and determine whether the value of the confidence counter is equal to 0 to obtain a second judgment result if the first judgment result indicates that the confidence is less than or equal to the set confidence threshold; A return module, for updating the text to be detected according to the value of the data block counter and returning to the step of "detecting the encoding method of the text to be detected to obtain the encoding method and the confidence of the detection result" if the second judgment result indicates that the confidence counter value is equal to 0; The second sorting and intercepting module is used to sort and intercept the text to be detected to obtain text restoration content if the second judgment result indicates that the value of the confidence counter is not equal to 0.
9. The text restoration system of network traffic content according to claim 8, characterized in that: Also includes: The initial setting module is used to set the confidence counter value and the data block counter value to 0.
10. The text restoration system of network traffic content according to claim 8, characterized in that: The first sorting and intercepting module specifically includes: A judging unit, used for judging whether the value of the data block counter is equal to 0, and obtaining a third judging result; A restoration unit, configured to restore the text to be detected according to the encoding method to obtain text restoration content if the third judgment result indicates that the value of the data block counter is equal to 0; The sorting and intercepting unit is used to sort and intercept the text to be detected to obtain text restoration content if the third judgment result indicates that the value of the data block counter is not equal to 0.
