Data filtering method, device and equipment, readable storage medium and program product
By performing bit value analysis and field splitting on the data to be tested, and using the candidate matching rule table for filtering, the problem of low efficiency in the existing technology when the data volume is large is solved, and efficient abnormal data filtering is achieved.
Patent Information
- Application Number
- CN202410947597.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-17
AI Technical Summary
Existing data filtering technology is inefficient when the amount of data is large, and cannot effectively handle abnormal data in large amounts of data.
By performing bit value analysis on the data to be tested, the fields to be tested are determined and split into corresponding candidate matching rule tables for filtering, thereby improving the efficiency and accuracy of data filtering.
It improves the accuracy of exception filtering and data filtering efficiency, reduces data filtering pressure, and reduces storage resource consumption.
Smart Images

Figure CN118656528A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data filtering method, device, equipment, readable storage medium and program product. Background Art
[0002] With the continuous development of the Internet, the accompanying information security issues have become increasingly prominent, such as network worms, computer viruses, botnets, etc. Therefore, in order to ensure the security of the Internet, detection technology for data packets in the Internet has emerged.
[0003] The existing detection technology first uses a Bloom filter to filter out data that may be abnormal, and then uses a ternary content addressable memory (TCAM) to perform in-depth detection on the data that may be abnormal, so as to filter out the data that actually has abnormalities.
[0004] However, when the amount of data is large, directly filtering all the data will reduce the efficiency of data filtering. Summary of the invention
[0005] Based on this, it is necessary to provide a data filtering method, device, equipment, readable storage medium and program product that can improve data filtering efficiency in response to the above technical problems.
[0006] In a first aspect, the present application provides a data filtering method, comprising:
[0007] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0008] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0009] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0010] Filter out abnormal fields in at least one field to be tested.
[0011] In the embodiment of the present application, compared with the related art of directly filtering all data, the above method can, on the one hand, improve the accuracy of anomaly filtering by performing anomaly detection on the fields to be tested that contain a larger amount of data information; on the other hand, by diverting the fields to be tested to the corresponding target matching rule table, it can effectively alleviate the pressure of data filtering, thereby improving the efficiency of data filtering.
[0012] In one embodiment, at least one candidate matching rule table is split in the following manner:
[0013] Extract rule features corresponding to each matching rule in the full matching rule table; and split the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule.
[0014] In the embodiment of the present application, by splitting the full matching rule table based on the rule features corresponding to each matching rule, the rationality of the splitting of the full matching rule table can be ensured.
[0015] In one embodiment, according to the rule features corresponding to each matching rule, the full matching rule table is split into at least one candidate matching rule table, including:
[0016] According to the data input bit width of the data to be tested, the target number of candidate matching rule tables is determined; according to the rule features corresponding to each matching rule, each matching rule is clustered to obtain a target number of candidate matching rule tables.
[0017] In the embodiment of the present application, by determining the number of candidate matching rule tables according to the data input bit width of the data to be tested, the rationality of the number of candidate matching rule tables can be ensured, while ensuring the high efficiency of data filtering.
[0018] In one embodiment, the method further comprises:
[0019] A reference identifier is generated according to rule features corresponding to matching rules with the same clustering result; and the reference identifier is used as a table identifier of a candidate matching rule table with the same clustering result.
[0020] In the embodiment of the present application, by determining the table identifier according to the rule features corresponding to the matching rules with the same clustering results, the rationality of the table identifier determination can be guaranteed, while ensuring the convenience of data diversion.
[0021] In one embodiment, determining a target matching rule table that matches the field to be tested from at least one candidate matching rule table includes:
[0022] Extract the field features corresponding to the field to be tested; obtain the table identifiers corresponding to each candidate matching rule table; wherein the table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table; match the field features with the table identifiers corresponding to each candidate matching rule table to determine a target matching rule table from at least one candidate matching rule table.
[0023] In the embodiment of the present application, the target matching rule table is determined by matching the field features with the table identifiers corresponding to the candidate matching rule tables, which can effectively ensure the compatibility between the field features and the target matching rule table.
[0024] In one embodiment, determining at least one field to be tested according to the bit value of each bit position of the data to be tested includes:
[0025] Determine the preset number of bytes according to the data input bit width of the data to be tested; for any field splitting process, determine the field starting position of this field splitting process based on the preset data offset and the field starting position of the previous field splitting process; wherein, the field starting position of the first field splitting process is the first bit of the data to be tested; determine the field to be tested corresponding to this field splitting process according to the field starting position of this field splitting process and the bit value of the data to be tested at each bit; wherein, the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0026] In the embodiment of the present application, by determining each field to be tested from the data to be tested in sequence starting from the first bit of the data to be tested based on a preset data offset, it is possible to avoid missing the data to be tested and ensure the accuracy of data filtering.
[0027] In a second aspect, the present application also provides a data filtering device, comprising:
[0028] A field determination module, used to determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0029] A rule table determination module is used to determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0030] An anomaly detection module, used to determine whether the field to be tested is an abnormal field according to the target matching rule table matched by the field to be tested;
[0031] The abnormal filtering module is used to filter abnormal fields in at least one field to be tested.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0034] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0035] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0036] Filter out abnormal fields in at least one field to be tested.
[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0038] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0039] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0040] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0041] Filter out abnormal fields in at least one field to be tested.
[0042] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0043] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0044] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0045] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0046] Filter out abnormal fields in at least one field to be tested.
[0047] The above-mentioned data filtering method, device, equipment, readable storage medium and program product determine at least one field to be tested according to the bit value of each bit of the data to be tested, and determine the target matching rule table that matches the field to be tested from at least one candidate matching rule table obtained by splitting the full matching rule table; then, according to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field, and then filter the abnormal field in at least one field to be tested. Compared with the related art, in which all data is directly filtered, the above-mentioned method, on the one hand, can improve the accuracy of abnormal filtering by performing abnormal detection on the field to be tested that contains a larger amount of data information; on the other hand, by diverting the field to be tested to the corresponding target matching rule table, it can effectively alleviate the pressure of data filtering, thereby improving the efficiency of data filtering. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1A A schematic diagram of a data filtering method in one embodiment;
[0050] Figure 1B A schematic diagram of using a target matching rule table to perform exception matching in one embodiment;
[0051] Figure 2 A schematic diagram of a process for dividing a global matching rule table in one embodiment;
[0052] Figure 3A A schematic diagram of a process for determining a candidate matching rule table in one embodiment;
[0053] Figure 3B is a schematic diagram of a data filtering device in one embodiment;
[0054] Figure 4 A schematic diagram of a process for determining a target matching rule table in one embodiment;
[0055] Figure 5 A schematic diagram of a flow chart of determining a field to be tested in one embodiment;
[0056] Figure 6 is a flow chart of a data filtering method in another embodiment;
[0057] Figure 7is a structural block diagram of a data filtering device in one embodiment;
[0058] Figure 8 is a structural block diagram of a data filtering device in another embodiment;
[0059] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] With the continuous development of the Internet, the accompanying information security issues have become increasingly prominent, such as network worms, computer viruses, botnets, etc. Therefore, in order to ensure the security of the Internet, detection technology for data packets in the Internet has emerged.
[0062] The existing detection technology first uses Bloom filters to filter out data that may be abnormal, and then uses TCAM to perform in-depth detection on the data that may be abnormal to identify the data that actually has abnormalities. However, when the amount of data is large, directly filtering all the data will reduce the efficiency of data filtering.
[0063] Based on this, in an exemplary embodiment, a data filtering method is provided, and the method is applied to a Bloom filter in a data filtering device as an example for explanation. Figure 1A As shown, the specific steps include:
[0064] S101, determining at least one field to be tested according to the bit value of each bit position of the data to be tested.
[0065] The data to be tested refers to the data that needs to be preliminarily screened; the fields to be tested refers to the fields extracted from the data to be tested.
[0066] Optionally, in order to ensure the security of each data information in the server where the data filtering device is located, the data to be tested that has not been security verified can be intercepted; further, since the bit value on a single bit position contains less data information, in order to accurately filter out abnormal data, at least one field to be tested can be determined based on the bit value of the data to be tested at each bit position.
[0067] Exemplarily, the bit values of multiple consecutive bits can be extracted from the data to be tested as the fields to be tested. For example, if the data to be tested is "0101001011101111", the fields to be tested can be field 1 "0101", field 2 "0010", field 3 "1110" and field 4 "1111".
[0068] S102: Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table.
[0069] Among them, the full matching rule table is used to store various data features that pose a threat to the server; at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table; the target matching rule table refers to the matching rule table corresponding to the field to be tested.
[0070] It is understandable that the volume of the full matching rule table is large. In the prior art, in order to improve data filtering efficiency, multiple full matching rule tables are configured at the same time to filter the fields to be tested in parallel. However, configuring multiple full matching rule tables at the same time will greatly consume the memory in the data filtering device.
[0071] Based on this, a full matching rule table can be split into multiple candidate matching rule tables; then, each candidate matching rule table is used in parallel to filter the field to be tested.
[0072] Optionally, a data diversion model can be trained based on the splitting strategy of the full matching rule table; accordingly, the field to be tested can be input into the data diversion model, and the data diversion model determines the target matching rule table that matches the field to be tested from at least one candidate matching rule table based on the field to be tested and model parameters.
[0073] S103: Determine whether the field to be tested is an abnormal field according to the target matching rule table matched by the field to be tested.
[0074] Optionally, after determining the target matching rule table for detecting the field to be tested, each matching rule in the target matching rule table can be used to match the field to be tested one by one. If the match is successful, the field to be tested is determined to be an abnormal field; if the match fails, the field to be tested is determined to be a normal field.
[0075] It is understandable that in order to ensure the accuracy of data matching, multiple matching algorithms can be used simultaneously to determine whether the field to be tested is an abnormal field based on the target matching rule table.
[0076] For example, refer to Figure 1B , hash algorithms A, B, and C can be used to simultaneously calculate the hash value of the field to be tested, and the hash value H A , H B, H C ; Accordingly, hash algorithms A, B and C can be used to calculate the target matching rule table S corresponding to the field to be tested, and the hash data set S corresponding to each matching rule can be obtained. A , S B and S C .
[0077] Furthermore, the hash value H is used A In the hash dataset S A Search in and use the hash value H B In the hash dataset S B Search in and use the hash value H C In the hash dataset S C If the three search results all have the same hash value, the field to be tested is determined to be an abnormal field; if one of the three search results does not have the same hash value, the field to be tested is determined to be a normal field.
[0078] S104: Filter abnormal fields in at least one field to be tested.
[0079] Optionally, normal fields in the fields to be tested may be released, while abnormal fields in the fields to be tested may be filtered out and transmitted to the next abnormality detection module to improve the accuracy of data detection.
[0080] In the above data filtering method, at least one field to be tested is determined according to the bit value of each bit of the data to be tested, and a target matching rule table matching the field to be tested is determined from at least one candidate matching rule table obtained by splitting the full matching rule table; then, according to the target matching rule table matching the field to be tested, it is determined whether the field to be tested is an abnormal field, and then the abnormal field in at least one field to be tested is filtered. Compared with the related art, in which all data is directly filtered, the above method can, on the one hand, improve the accuracy of abnormal filtering by performing abnormal detection on the field to be tested that contains a larger amount of data information; on the other hand, by diverting the field to be tested to the corresponding target matching rule table, it can effectively alleviate the pressure of data filtering, thereby improving the efficiency of data filtering.
[0081] In order to ensure the rationality of the division of the full matching rule table, based on the above embodiment, in this embodiment, an optional method of dividing the global matching rule table is provided, such as Figure 2 As shown, the specific steps include:
[0082] S201, extracting rule features corresponding to each matching rule in the full matching rule table.
[0083] Among them, the matching rules are the rules in the full matching rule table used to match abnormal fields. Each matching rule may include but is not limited to information such as data type, feature string, search starting position, and response operation after matching.
[0084] Optionally, for each matching rule in the full matching rule table, dimensional features of the matching rule under each preset dimension may be extracted; then, the dimensional features are concatenated to obtain a rule feature corresponding to the matching rule.
[0085] For example, for matching rule H, the data type feature H1, feature string feature H2, search start position feature H3, and matched response operation feature H4 contained in matching rule H can be extracted; then, H1, H2, H3 and H4 are concatenated to obtain the rule feature H' corresponding to matching rule H.
[0086] Alternatively, for each matching rule in the full matching rule table, a preset hash algorithm may be used to process the matching rule, and the processed hash value may be used as a rule feature corresponding to the matching rule.
[0087] S202: split the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule.
[0088] Optionally, after determining the rule features corresponding to each matching rule, for each matching rule, the rule features corresponding to the matching rule can be input one by one into the trained rule splitting model, and the rule splitting model determines the candidate matching rule table corresponding to the matching rule based on the rule features and model parameters corresponding to the matching rule, so as to realize the splitting of the full matching rule table.
[0089] In the embodiment of the present application, by splitting the full matching rule table based on the rule features corresponding to each matching rule, the rationality of the splitting of the full matching rule table can be ensured.
[0090] After determining the rule features corresponding to each matching rule, in order to further ensure the rationality of the division of the full matching rule table, based on the above embodiment, in this embodiment, an optional method for determining the candidate matching rule table is provided, such as Figure 3A As shown, the specific steps include:
[0091] S301, determining a target number of candidate matching rule tables according to the data input bit width of the data to be tested.
[0092] The data input bit width is used to characterize the number of ports for data input in the data filtering device; the target number refers to the number of candidate matching rule tables.
[0093] Optionally, the data input bit width of the data to be tested can be determined from the configuration information; then, in order to ensure the efficiency of data filtering, the data input bit width of the data to be tested can be directly used as the target number of the candidate matching rule table. Figure 3B , the data input bit width is 16, and accordingly, 16 candidate matching rule tables need to be determined.
[0094] Alternatively, a target quantity determination model can be trained based on historical data filtering information corresponding to each data input bit width; accordingly, the data input bit width of the data to be tested can be input into the target quantity determination model, and the target quantity determination model outputs the target quantity of the candidate matching rule table based on the data input bit width and model parameters.
[0095] S302: Cluster each matching rule according to the rule features corresponding to each matching rule to obtain a target number of candidate matching rule tables.
[0096] Optionally, when determining the rule features corresponding to the matching rules based on the dimensional features of the matching rules in each dimension, a target number of cluster centers can be set, and then each rule feature can be processed by clustering processing to obtain a target number of cluster sets; then, for each cluster set, the matching rules corresponding to each rule feature in the cluster set can be used as a candidate matching rule table corresponding to the cluster set.
[0097] Alternatively, when a hash algorithm is used to determine rule features corresponding to matching rules, matching rules with the same hash value may be clustered according to hash values corresponding to the matching rules to obtain a target number of candidate matching rule tables.
[0098] It is understandable that in the prior art, if one wants to filter 400G of test data with 10,000 rules, 1536 random access memories (RAM) totaling 24Mbits are required. At this time, the filtering ratio is 3.3‰.
[0099] In the case of using 16 candidate matching rule tables, if you want to achieve 400G of test data filtering, you can design 8 modules in parallel, each module can achieve 51.2Gbit of test data filtering; then, in each module, 16 candidate matching rule tables are configured, and each candidate matching rule table is configured with 3 RAM blocks, each RAM block has a capacity of 20Kbits, and the 16 candidate matching rule tables have a total depth of 320Kbits. When the number of rules is set to 50,000, the filtering ratio of each RAM is 5 / 32, and the comprehensive filtering ratio of the 3 RAMs is 3.3‰.
[0100] The 8 modules consume a total of 384 RAMs, store 50,000 rules, and have a filtering ratio of 3.3‰. Compared with the prior art, RAM resource usage is reduced from 1536 to 384, that is, reduced to 1 / 4 of the previous amount, and the rule capacity is increased from 10,000 to 50,000, an increase of 5 times, while the filtering ratio remains unchanged. In summary, this embodiment can effectively improve the overall performance of the data filtering device and reduce the consumption of storage resources.
[0101] In the embodiment of the present application, by determining the number of candidate matching rule tables according to the data input bit width of the data to be tested, the rationality of the number of candidate matching rule tables can be ensured, while ensuring the high efficiency of data filtering.
[0102] It can be understood that in order to ensure the convenience of data diversion, after determining each candidate matching rule table, the table identifier corresponding to the candidate matching rule table can be determined separately for each candidate matching rule table. Specifically, a reference identifier is generated based on the rule features corresponding to the matching rules with the same clustering results; the reference identifier is used as the table identifier of the candidate matching rule table under the same clustering result.
[0103] The table identifier is used to characterize the matching features of the candidate matching rule table.
[0104] Optionally, when determining the rule features corresponding to the matching rules based on the dimensional features of the matching rules in each dimension, the rule features corresponding to the matching rules with the same clustering results can be simultaneously input into a trained identification determination model, and the identification determination model outputs the reference identification corresponding to the matching rules with the same clustering results based on the rule features and model parameters.
[0105] Alternatively, when a hash algorithm is used to determine the rule features corresponding to the matching rules, the hash values corresponding to the matching rules with the same clustering results can be directly used as reference identifiers corresponding to the matching rules with the same clustering results. For example, in the case of 16 candidate matching rule tables, a 4-bit character can be used as a reference identifier.
[0106] Furthermore, each determined reference identifier may be used as a table identifier of a candidate matching rule table under the same clustering result.
[0107] In the embodiment of the present application, by determining the table identifier according to the rule features corresponding to the matching rules with the same clustering results, the rationality of the table identifier determination can be guaranteed, while ensuring the convenience of data diversion.
[0108] In practical applications, when the full matching rule table is split into multiple candidate matching rule tables, there may be a problem of assigning the field to be tested to an unmatched candidate matching rule table. Based on this, on the basis of the above embodiment, in this embodiment, an optional method for determining the target matching rule table is provided, such as Figure 4 As shown, the specific steps include:
[0109] S401, extracting field features corresponding to the field to be tested.
[0110] Among them, the field characteristics can represent the characteristics of the field to be tested.
[0111] Optionally, the field to be tested may be input into a feature extraction model trained based on a splitting strategy of the full matching rule table, and the feature extraction model outputs field features corresponding to the field to be tested according to the field to be tested and model parameters.
[0112] Alternatively, a preset hash algorithm may be used to calculate the field to be tested, and the calculated hash value may be used as the field feature corresponding to the field to be tested.
[0113] S402: Obtain table identifiers corresponding to each candidate matching rule table.
[0114] The table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table.
[0115] Optionally, after extracting the field feature corresponding to the field to be tested, an identification acquisition request may be generated in a data distribution device in the Bloom filter, and the identification acquisition request may be sent to a storage device in the Bloom filter for storing each candidate matching rule table.
[0116] Further, after receiving the identification acquisition request, the storage device will obtain the table identification corresponding to each candidate matching rule table, and send each table identification to the data diversion device. It is understandable that in order to improve the efficiency of data diversion, after the data diversion device obtains each table identification for the first time, each table identification can be directly stored in the data diversion device for next use.
[0117] S403: Match the field feature with the table identifier corresponding to each candidate matching rule table to determine a target matching rule table from at least one candidate matching rule table.
[0118] Optionally, the field feature can be used as an index to index from the table identifiers corresponding to each candidate matching rule table, thereby determining a target table identifier that matches the field feature; subsequently, the candidate matching rule table corresponding to the target table identifier can be used as the target matching rule table.
[0119] In the embodiment of the present application, the target matching rule table is determined by matching the field features with the table identifiers corresponding to the candidate matching rule tables, which can effectively ensure the compatibility between the field features and the target matching rule table.
[0120] In order to ensure the accuracy of data filtering, based on the above embodiments, in this embodiment, an optional method for determining the field to be tested is provided, such as Figure 5 As shown, the specific steps include:
[0121] S501, determining a preset number of bytes according to the data input bit width of the data to be tested.
[0122] The preset number of bytes refers to a number of bytes that is preset and adapted to the data filtering process.
[0123] Optionally, the preset number of bytes in this data filtering process may be determined based on the data input bit width of the data to be tested and the degree of inclusion of field information under different numbers of bytes.
[0124] S502: For any field splitting process, determine the field starting position of the current field splitting process based on a preset data offset and the field starting position of the previous field splitting process.
[0125] Among them, the data offset is used to represent the offset between the first bits in two adjacent detection fields; the field starting position is used to represent the position of the first bit in the field to be tested in the data to be tested; the field starting position of the first field splitting process is the first bit of the data to be tested.
[0126] It is understandable that in order to ensure the accuracy of data screening, the data splitting result of the data to be tested can be adjusted based on the data offset, wherein the smaller the data offset, the more fields to be tested are split.
[0127] Optionally, for the first field splitting process, the first bit of the data to be tested can be used as the field starting position; correspondingly, for other field splitting processes, the field starting position of this field splitting process can be determined based on the field starting position of the previous field splitting process and the data offset. Exemplarily, the sum of the sequence number corresponding to the field starting position of the previous field splitting process and the data offset can be used as the sequence number corresponding to the field starting position of this field splitting process.
[0128] S503, determining the field to be tested corresponding to the current field splitting process according to the field start position of the current field splitting process and the bit value of the data to be tested at each bit position.
[0129] The number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0130] Optionally, after determining the starting position of the field in this field splitting process, a character string corresponding to a continuous preset number of bytes of bits can be split out from the data to be tested based on the bit value of each bit of the data to be tested, as the field to be tested corresponding to this field splitting process.
[0131] For example, the data to be tested is “0101001011101111”, when the data offset is 1 and the preset number of bytes is 4, the fields to be tested may be field K1 “0101”, field K2 “1010”, field K3 “0100” and field K4 “1001”….
[0132] In the embodiment of the present application, by determining each field to be tested from the data to be tested in sequence starting from the first bit of the data to be tested based on a preset data offset, it is possible to avoid missing the data to be tested and ensure the accuracy of data filtering.
[0133] Figure 6 FIG. 1 is a flow chart of a data filtering method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a data filtering method. Figure 6 The specific implementation process is as follows:
[0134] S601, extracting rule features corresponding to each matching rule in the full matching rule table.
[0135] S602: Determine the target number of candidate matching rule tables according to the data input bit width of the data to be tested.
[0136] S603: Cluster the matching rules according to the rule features corresponding to the matching rules to obtain a target number of candidate matching rule tables.
[0137] S604: Generate a reference identifier according to rule features corresponding to matching rules with the same clustering result.
[0138] S605: Use the reference identifier as a table identifier of a candidate matching rule table under the same clustering result.
[0139] S606: Determine at least one field to be tested according to the bit value of each bit position of the data to be tested.
[0140] Optionally, a preset number of bytes is determined based on the data input bit width of the data to be tested; for any field splitting process, the field starting position of this field splitting process is determined based on the preset data offset and the field starting position of the previous field splitting process; wherein, the field starting position of the first field splitting process is the first bit of the data to be tested; according to the field starting position of this field splitting process and the bit value of the data to be tested at each bit, the field to be tested corresponding to this field splitting process is determined; wherein, the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0141] S607: extracting field features corresponding to each field to be tested.
[0142] The table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table.
[0143] S608: Match the field features corresponding to each field to be tested with the table identifiers corresponding to each candidate matching rule table, so as to determine a target matching rule table corresponding to each field to be tested from at least one candidate matching rule table.
[0144] Among them, at least one candidate matching rule table is a splitting processing result obtained by splitting the full matching rule table.
[0145] S609: Determine whether each field to be tested is an abnormal field according to the target matching rule table matched by each field to be tested, and filter it.
[0146] The specific process of the above S601-S609 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0147] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0148] Based on the same inventive concept, the embodiment of the present application also provides a data filtering device for implementing the data filtering method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data filtering device embodiments provided below can refer to the limitations on the data filtering method above, and will not be repeated here.
[0149] In an exemplary embodiment, Figure 7 As shown, a data filtering device 1 is provided, comprising: a field determination module 10, a rule table determination module 20, an anomaly detection module 30 and an anomaly filtering module 40, wherein:
[0150] A field determination module 10, configured to determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0151] A rule table determination module 20 is used to determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0152] Anomaly detection module 30, used to determine whether the field to be tested is an abnormal field according to the target matching rule table matched by the field to be tested;
[0153] The abnormal filtering module 40 is used to filter abnormal fields in at least one field to be tested.
[0154] In an exemplary embodiment, the data filtering device 1 further includes a rule table splitting module 50, such as Figure 8 As shown, the rule table splitting module 50 includes:
[0155] A feature extraction unit 51 is used to extract rule features corresponding to each matching rule in the full matching rule table;
[0156] The rule table splitting unit 52 is used to split the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule.
[0157] In an exemplary embodiment, the rule table splitting unit 52 is specifically used for:
[0158] According to the data input bit width of the data to be tested, the target number of candidate matching rule tables is determined; according to the rule features corresponding to each matching rule, each matching rule is clustered to obtain a target number of candidate matching rule tables.
[0159] In an exemplary embodiment, the rule table splitting module 50 is further used to:
[0160] A reference identifier is generated according to rule features corresponding to matching rules with the same clustering result; and the reference identifier is used as a table identifier of a candidate matching rule table with the same clustering result.
[0161] In an exemplary embodiment, the rule table determination module 20 is specifically used to:
[0162] Extract the field features corresponding to the field to be tested; obtain the table identifiers corresponding to each candidate matching rule table; wherein the table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table; match the field features with the table identifiers corresponding to each candidate matching rule table to determine a target matching rule table from at least one candidate matching rule table.
[0163] In an exemplary embodiment, the field determination module 10 is specifically configured to:
[0164] Determine the preset number of bytes according to the data input bit width of the data to be tested; for any field splitting process, determine the field starting position of this field splitting process based on the preset data offset and the field starting position of the previous field splitting process; wherein, the field starting position of the first field splitting process is the first bit of the data to be tested; determine the field to be tested corresponding to this field splitting process according to the field starting position of this field splitting process and the bit value of the data to be tested at each bit; wherein, the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0165] Each module in the above data filtering device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0166] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig. 9As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data of the full matching rule table. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data filtering method is implemented.
[0167] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0168] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0169] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0170] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0171] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0172] Filter out abnormal fields in at least one field to be tested.
[0173] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0174] Extract rule features corresponding to each matching rule in the full matching rule table; and split the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule.
[0175] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0176] According to the data input bit width of the data to be tested, the target number of candidate matching rule tables is determined; according to the rule features corresponding to each matching rule, each matching rule is clustered to obtain a target number of candidate matching rule tables.
[0177] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0178] A reference identifier is generated according to rule features corresponding to matching rules with the same clustering result; and the reference identifier is used as a table identifier of a candidate matching rule table with the same clustering result.
[0179] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0180] Extract the field features corresponding to the field to be tested; obtain the table identifiers corresponding to each candidate matching rule table; wherein the table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table; match the field features with the table identifiers corresponding to each candidate matching rule table to determine a target matching rule table from at least one candidate matching rule table.
[0181] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0182] Determine the preset number of bytes according to the data input bit width of the data to be tested; for any field splitting process, determine the field starting position of this field splitting process based on the preset data offset and the field starting position of the previous field splitting process; wherein, the field starting position of the first field splitting process is the first bit of the data to be tested; determine the field to be tested corresponding to this field splitting process according to the field starting position of this field splitting process and the bit value of the data to be tested at each bit; wherein, the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0183] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0184] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0185] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0186] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0187] Filter out abnormal fields in at least one field to be tested.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0189] Extract rule features corresponding to each matching rule in the full matching rule table; and split the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0191] According to the data input bit width of the data to be tested, the target number of candidate matching rule tables is determined; according to the rule features corresponding to each matching rule, each matching rule is clustered to obtain a target number of candidate matching rule tables.
[0192] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0193] A reference identifier is generated according to rule features corresponding to matching rules with the same clustering result; and the reference identifier is used as a table identifier of a candidate matching rule table with the same clustering result.
[0194] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0195] Extract the field features corresponding to the field to be tested; obtain the table identifiers corresponding to each candidate matching rule table; wherein the table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table; match the field features with the table identifiers corresponding to each candidate matching rule table to determine a target matching rule table from at least one candidate matching rule table.
[0196] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0197] Determine the preset number of bytes according to the data input bit width of the data to be tested; for any field splitting process, determine the field starting position of this field splitting process based on the preset data offset and the field starting position of the previous field splitting process; wherein, the field starting position of the first field splitting process is the first bit of the data to be tested; determine the field to be tested corresponding to this field splitting process according to the field starting position of this field splitting process and the bit value of the data to be tested at each bit; wherein, the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0198] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0199] Determine at least one field to be tested according to the bit value of each bit position of the data to be tested;
[0200] Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table;
[0201] According to the target matching rule table that matches the field to be tested, determine whether the field to be tested is an abnormal field;
[0202] Filter out abnormal fields in at least one field to be tested.
[0203] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0204] Extract rule features corresponding to each matching rule in the full matching rule table; and split the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule.
[0205] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0206] According to the data input bit width of the data to be tested, the target number of candidate matching rule tables is determined; according to the rule features corresponding to each matching rule, each matching rule is clustered to obtain a target number of candidate matching rule tables.
[0207] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0208] A reference identifier is generated according to rule features corresponding to matching rules with the same clustering result; and the reference identifier is used as a table identifier of a candidate matching rule table with the same clustering result.
[0209] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0210] Extract the field features corresponding to the field to be tested; obtain the table identifiers corresponding to each candidate matching rule table; wherein the table identifier of each candidate matching rule table is generated based on the rule features of the candidate matching rule table; match the field features with the table identifiers corresponding to each candidate matching rule table to determine a target matching rule table from at least one candidate matching rule table.
[0211] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0212] Determine the preset number of bytes according to the data input bit width of the data to be tested; for any field splitting process, determine the field starting position of this field splitting process based on the preset data offset and the field starting position of the previous field splitting process; wherein, the field starting position of the first field splitting process is the first bit of the data to be tested; determine the field to be tested corresponding to this field splitting process according to the field starting position of this field splitting process and the bit value of the data to be tested at each bit; wherein, the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
[0213] It should be noted that the data involved in this application (including but not limited to the full matching rule table and other data) are all authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0214] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0215] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0216] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data filtering method, characterized in that: The method comprises: Determine at least one field to be tested according to the bit value of each bit position of the data to be tested; Determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein the at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table; Determine whether the field to be tested is an abnormal field according to the target matching rule table matched by the field to be tested; Filter out abnormal fields in the at least one field to be tested.
2. The method according to claim 1, characterized in that The at least one candidate matching rule table is obtained by splitting in the following manner: Extract the rule features corresponding to each matching rule in the full matching rule table; According to the rule features corresponding to each matching rule, the full matching rule table is split into at least one candidate matching rule table.
3. The method according to claim 2, characterized in that The step of splitting the full matching rule table into at least one candidate matching rule table according to the rule features corresponding to each matching rule includes: Determining a target number of candidate matching rule tables according to a data input bit width of the data to be tested; Each matching rule is clustered according to the rule features corresponding to each matching rule to obtain the target number of candidate matching rule tables.
4. The method according to claim 3, characterized in that The method further comprises: Generate a reference identifier according to the rule features corresponding to the matching rules with the same clustering results; The reference identifier is used as a table identifier of a candidate matching rule table under the same clustering result.
5. The method according to claim 1, characterized in that The step of determining a target matching rule table that matches the field to be tested from at least one candidate matching rule table includes: Extracting field features corresponding to the field to be tested; Obtaining table identifiers corresponding to each of the candidate matching rule tables; wherein the table identifier of each candidate matching rule table is generated based on rule features of the candidate matching rule table; The field feature is matched with the table identifier corresponding to each of the candidate matching rule tables to determine the target matching rule table from at least one candidate matching rule table.
6. The method according to any one of claims 1 to 5, characterized in that: The step of determining at least one field to be tested according to the bit value of each bit position of the data to be tested comprises: Determining a preset number of bytes according to the data input bit width of the data to be tested; For any field splitting process, based on the preset data offset and the field starting position of the previous field splitting process, the field starting position of this field splitting process is determined; wherein the field starting position of the first field splitting process is the first bit of the data to be tested; According to the starting position of the field in this field splitting process and the bit value of the data to be tested at each bit position, the field to be tested corresponding to this field splitting process is determined; wherein the number of bytes of the field to be tested corresponding to this field splitting process is the same as the preset number of bytes.
7. A data filtering device, characterized in that: The device comprises: A field determination module, used to determine at least one field to be tested according to the bit value of each bit position of the data to be tested; A rule table determination module, used to determine a target matching rule table that matches the field to be tested from at least one candidate matching rule table; wherein the at least one candidate matching rule table is a split processing result obtained by splitting the full matching rule table; An anomaly detection module, used to determine whether the field to be tested is an abnormal field according to a target matching rule table matched by the field to be tested; The abnormal filtering module is used to filter abnormal fields in the at least one field to be tested.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data packet filtering method and device
CN106790170A
Abnormal access monitoring method and device, computer equipment and storage medium
CN116991675A
Data compression method and data decompression method for electronic device, and electronic device
US20220121626A1
