A file scanning method, device and medium based on fragmentation strategy
Through the fragmentation strategy, large files are split into small files and semantically analyzed, which solves the problem of system throughput reduction and process crash of the file scanning service in a high concurrency environment, and achieves fast scanning and high-throughput file parsing.
Patent Information
- Application Number
- CN202111494325.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-12-08
AI Technical Summary
In a high-concurrency environment, solutions based on whole file scanning lead to reduced system throughput and process crashes, especially when the system memory is insufficient, seriously affecting the high availability of the system.
The file scanning method based on the fragmentation strategy is used to divide the large file into several small files, and perform fragmentation storage and analysis through the console system and file parsing system. The identity identifier and offset information are used for semantic analysis and fragmentation redundancy. to avoid the problem that the file contents cannot be matched.
It improves the speed of file parsing, reduces the consumption of system resources by the file parsing process, achieves fast scanning and high throughput, and solves the problems of reduced system throughput and process crash.
Smart Images

Figure CN114238231B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file scanning, and in particular to a file scanning method, device and medium based on a fragmentation strategy. Background Art
[0002] At present, the reading and writing operations of large files consume a lot of system resources, and have a great impact on the overall throughput of the system in a high-concurrency environment. In order to achieve the goal of high throughput and low consumption in a high-concurrency environment for the file scanning server, a file segmentation reading strategy is usually adopted to reduce memory consumption, thereby improving system performance. This technology is mainly used in DLP (Data Loss Prevention) products based on file scanning. Currently, most services that implement similar file scanning functions are based on overall file scanning rather than segmented scanning solutions. Scanning based on the entire file will seriously affect the overall throughput of the system in a high-concurrency environment, and when the system memory is insufficient, it is easy to cause program memory overflow, causing the process to crash, affecting the high availability of the system. Summary of the invention
[0003] The purpose of the present invention is to provide a file scanning solution based on a sharding strategy to solve the technical problem existing in the prior art, namely, the file scanning service in a high-concurrency environment causes a reduction in system throughput and a process crash due to a resource bottleneck.
[0004] The first aspect of the present invention provides a file scanning method based on a sharding strategy. The file scanning method is implemented based on an architecture consisting of a console system, a file scanning system, and a file parsing system.
[0005] The file scanning method provided by the first aspect of the present invention specifically includes:
[0006] Step S1: The console system sends a file segmentation strategy to the file scanning system via the configuration center, and sends strategy information to the file parsing system.
[0007] Step S2: The file scanning system stores the scanned file in slices based on the file slice strategy for file parsing. The sliced files stored in slices have the following field information: identity, offset, and maximum offset.
[0008] Among them, the identity identifier is used to uniquely identify the slice file, the offset is the sequential number of the slice file in multiple slice files in the scan file to which it belongs, and the maximum offset is the maximum value of the offsets of each slice file in the scan file to which the slice file belongs.
[0009] Step S3: The file parsing system obtains the segmented file according to the identity identifier and the offset, and determines whether the segmented file complies with the policy information by parsing. If so, the file parsing system reports the segmented file that complies with the policy information to the console system.
[0010] According to the file scanning method provided by the first aspect of the present invention, in the step S1: the console system, via the configuration center, also sends first system configuration information to the file scanning system and sends second system configuration information to the file parsing system.
[0011] The first system configuration information is used to update the configuration of the file scanning system, and the second system configuration information is used to update the configuration of the file parsing system.
[0012] According to the file scanning method provided by the first aspect of the present invention, the file segmentation strategy is: semantic analysis is performed on the file content obtained at the offset, content with the same semantics is divided into the same segment, and when the field after the offset is a sentence separation field, the field is divided into file segments before and after the offset, so as to avoid the inability to match the segmented file content through field segmentation redundancy.
[0013] According to the file scanning method provided by the first aspect of the present invention, in step S3, the file parsing system obtains the segmented file according to the identity identifier and the offset, and determines whether the segmented file complies with the policy information through parsing. If not, the offset is increased by one bit and compared with the maximum offset.
[0014] When the offset after the self-increment is greater than the maximum offset, the parsing of all the fragment files of the scanned file is completed. When the offset after the self-increment is not greater than the maximum offset, the next fragment file in the queue is obtained to continue parsing.
[0015] The second aspect of the present invention provides a file scanning device based on a slicing strategy. The file scanning device is implemented based on an architecture consisting of a console system, a file scanning system, and a file parsing system.
[0016] The document scanning device provided in the second aspect of the present invention specifically comprises:
[0017] The information sending unit is configured to call the console system, send the file segmentation strategy to the file scanning system via the configuration center, and send the strategy information to the file parsing system.
[0018] The shard storage unit is configured to call the file scanning system to perform shard storage on the scanned file based on the file sharding strategy for file parsing, and the sharded file stored in shards has the following field information: identity, offset, and maximum offset.
[0019] Among them, the identity identifier is used to uniquely identify the slice file, the offset is the sequential number of the slice file in multiple slice files in the scan file to which it belongs, and the maximum offset is the maximum value of the offsets of each slice file in the scan file to which the slice file belongs.
[0020] The file parsing unit is configured to call the file parsing system to obtain the segmented file according to the identity identifier and the offset, and determine whether the segmented file complies with the policy information through parsing. If so, report the segmented file that complies with the policy information to the console system.
[0021] According to the file scanning device provided by the second aspect of the present invention, the information sending unit is further configured to: call the console system, and send the first system configuration information to the file scanning system and send the second system configuration information to the file parsing system via the configuration center.
[0022] The first system configuration information is used to update the configuration of the file scanning system, and the second system configuration information is used to update the configuration of the file parsing system.
[0023] According to the file scanning device provided by the second aspect of the present invention, the file segmentation strategy is: semantic analysis is performed on the file content obtained at the offset, content with the same semantics is divided into the same segment, and when the field after the offset is a sentence separation field, the field is divided into file segments before and after the offset, so as to avoid the inability to match the segmented file content through field segmentation redundancy.
[0024] According to the file scanning device provided by the second aspect of the present invention, the file parsing unit is specifically configured to call the file parsing system to obtain the segmented file according to the identity identifier and the offset, and determine whether the segmented file complies with the policy information through parsing. If not, the offset is increased by one bit and compared with the maximum offset.
[0025] When the offset after the self-increment is greater than the maximum offset, the parsing of all the fragment files of the scanned file is completed. When the offset after the self-increment is not greater than the maximum offset, the next fragment file in the queue is obtained to continue parsing.
[0026] A third aspect of the present invention provides a non-transitory computer-readable medium storing instructions, which, when executed by a processor, executes the steps of a file scanning method based on a sharding strategy according to the first aspect of the present invention.
[0027] In summary, this solution solves the problem of reduced system throughput and process crash due to resource bottlenecks in file scanning services in a high-concurrency environment; by splitting large files into several small files according to the sharding strategy, the file parsing speed is accelerated while the file parsing process consumes less system resources, achieving fast scanning and improving the file parsing system throughput. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 A flowchart of a file scanning method based on a sharding strategy according to an embodiment of the present invention;
[0030] Figure 2 A schematic diagram of a console implementing information transmission via a configuration center according to an embodiment of the present invention;
[0031] Figure 3 It is a schematic diagram showing that a console sends information to a file scanning system and a file parsing system via a configuration center according to an embodiment of the present invention;
[0032] Figure 4 A schematic diagram of a file scanning system performing file segment storage according to an embodiment of the present invention;
[0033] Figure 5 A schematic diagram of a file parsing system executing a parsing process according to an embodiment of the present invention;
[0034] Figure 6 A complete schematic diagram of the execution of a file scanning method based on the architecture of a console system, a file scanning system, and a file parsing system according to an embodiment of the present invention;
[0035] Figure 7 The structure diagram of a file scanning device based on a fragmentation strategy according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. 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.
[0037] The first aspect of the present invention provides a file scanning method based on a sharding strategy. The file scanning method is implemented based on an architecture consisting of a console system, a file scanning system, and a file parsing system.
[0038] The console system is used to provide system configuration (policy information, action type, file segmentation strategy information), parameter distribution, and background management visualization interface, which includes file scanning results, policy configuration information, and system user information.
[0039] The file scanning system is used to fragment and split the acquired files according to the file fragmentation strategy issued by the console, and generate field information of the files, including identity, offset, and maximum offset.
[0040] The file parsing system is used to obtain and parse the specific shard file based on the file identity and the offset of the shard file, and report the file information that hits the sensitive policy to the console.
[0041] Figure 1 FIG. 1 is a flowchart of a file scanning method based on a sharding strategy according to an embodiment of the present invention. Figure 1 As shown, the file scanning method specifically includes:
[0042] Step S1: The console system sends a file segmentation strategy to the file scanning system via the configuration center, and sends strategy information to the file parsing system;
[0043] Step S2: The file scanning system stores the scanned file in slices based on the file slice strategy for file parsing, and the sliced files stored in slices have the following field information: identity, offset, and maximum offset;
[0044] Step S3: The file parsing system obtains the segmented file according to the identity identifier and the offset, and determines whether the segmented file complies with the policy information through parsing; if so, the file parsing system reports the segmented file that complies with the policy information to the console system.
[0045] Figure 2 FIG. 1 is a schematic diagram of implementing information transmission via a configuration center according to an embodiment of the present invention. Figure 2As shown, the console system sends the file segmentation strategy to the file scanning system via the configuration center, and sends the strategy information to the file parsing system (in the step S1).
[0046] In some embodiments, the console system, via the configuration center, further sends first system configuration information to the file scanning system and second system configuration information to the file parsing system; wherein the first system configuration information is used to update the configuration of the file scanning system, and the second system configuration information is used to update the configuration of the file parsing system. Figure 3 As shown, Figure 3 This is a schematic diagram of a console sending information to a file scanning system and a file parsing system via a configuration center according to an embodiment of the present invention.
[0047] Figure 4 FIG. 1 is a schematic diagram of a file scanning system according to an embodiment of the present invention performing file segment storage. Figure 4 As shown, the file scanning system stores the scanned file in slices based on the file slice strategy for file parsing, and the sliced files stored in slices have the following field information: identity, offset, and maximum offset (in the step S2). The identity is used to uniquely identify the slice file, the offset is the sequence number of the slice file in the multiple slice files in the scan file to which it belongs, and the maximum offset is the maximum value of the offset of each slice file in the scan file to which the slice file belongs.
[0048] In some embodiments, the file scanning system first obtains the file information of the file to be scanned from the specified directory, and the file information is used to extract the file to be scanned from the file server. Then, the file scanning system stores the scanned file in slices according to the file slice strategy.
[0049] In some embodiments, the file segmentation strategy is: performing semantic analysis on the file content obtained at the offset, content with the same semantics is divided into the same segment, and when the field after the offset is a sentence separation field, the field is divided into file segments before and after the offset, so as to avoid the inability to match the segmented file content through field segmentation redundancy.
[0050] Specifically, when obtaining shard files, the file content will be obtained near the preset file offset position for semantic analysis, and the content with the same semantics will be divided into the same shard, and data redundancy will be used to avoid data mismatch caused by data splitting. For example, "hello everyone", when sharding, the original offset is between "home" and "good". At this time, after analysis, it is found that this is within a sentence. At this time, the content will be added to the two files before and after the sharding, and deduplication will be performed when merging the scan results to avoid repeated data calculation.
[0051] Figure 5 FIG. 1 is a schematic diagram of a file parsing system executing a parsing process according to an embodiment of the present invention. Figure 5 As shown, the file parsing system obtains the segmented file according to the identity identifier and the offset, and determines whether the segmented file complies with the policy information through parsing; if so, the file parsing system reports the segmented file that complies with the policy information to the console system (in the step S3).
[0052] In some embodiments, the file parsing system obtains the shard file according to the identity and the offset, and determines whether the shard file complies with the policy information through parsing; if not, the offset is increased by one bit and compared with the maximum offset. When the offset after the self-increment is greater than the maximum offset, the parsing of all shard files of the scanned file is completed; when the offset after the self-increment is not greater than the maximum offset, the next shard file in the queue is obtained to continue parsing.
[0053] In some embodiments, the sensitive information matching method is configured, including: keyword matching, when the content after file parsing contains keyword information, it is a hit on the keyword strategy; regular expression matching, when the content after file parsing can match the set regular expression, it is a hit on the regular expression strategy; file information strategy, the relevant attribute information of the file, such as the author, file size, file creation time, file modification time, etc., is matched in the relevant information obtained by parsing the file, that is, the file information strategy is hit. The purpose of configuring policy scanning is to control the outbound sending and storage of files, to avoid sending sensitive data during the outbound sending process or storing sensitive information in non-sensitive areas, which leads to sensitive data leakage.
[0054] Figure 6 It is a complete execution diagram of a file scanning method based on the architecture of a console system, a file scanning system, and a file parsing system according to an embodiment of the present invention.
[0055] The second aspect of the present invention provides a file scanning device based on a slicing strategy. The file scanning device is implemented based on an architecture consisting of a console system, a file scanning system, and a file parsing system.
[0056] Figure 7 FIG. 1 is a structural diagram of a file scanning device based on a slicing strategy according to an embodiment of the present invention. Figure 7 As shown, the document scanning device 700 provided by the second aspect of the present invention specifically includes:
[0057] The information sending unit 701 is configured to call the console system, send the file segmentation strategy to the file scanning system via the configuration center, and send the strategy information to the file parsing system.
[0058] The shard storage unit 702 is configured to call the file scanning system to perform shard storage on the scanned file based on the file sharding strategy for file parsing, and the sharded file stored in shards has the following field information: identity, offset, and maximum offset.
[0059] Among them, the identity identifier is used to uniquely identify the slice file, the offset is the sequential number of the slice file in multiple slice files in the scan file to which it belongs, and the maximum offset is the maximum value of the offsets of each slice file in the scan file to which the slice file belongs.
[0060] The file parsing unit 703 is configured to call the file parsing system to obtain the segmented file according to the identity and the offset, and determine whether the segmented file complies with the policy information through parsing. If so, report the segmented file that complies with the policy information to the console system.
[0061] According to the file scanning device provided by the second aspect of the present invention, the information sending unit 701 is also configured to: call the console system, and send the first system configuration information to the file scanning system and send the second system configuration information to the file parsing system via the configuration center.
[0062] The first system configuration information is used to update the configuration of the file scanning system, and the second system configuration information is used to update the configuration of the file parsing system.
[0063] According to the file scanning device provided by the second aspect of the present invention, the shard storage unit 702 is also configured to perform semantic analysis on the file content obtained at the offset, and content with the same semantics is divided into the same shard, and when the field after the offset is a sentence separation field, the field is divided into file shards before and after the offset, so as to avoid the inability to match the sharded file content through field shard redundancy.
[0064] According to the file scanning device provided by the second aspect of the present invention, the file parsing unit 703 is specifically configured to call the file parsing system to obtain the segmented file according to the identity identifier and the offset, and determine whether the segmented file complies with the policy information through parsing. If not, the offset is increased by one bit and compared with the maximum offset.
[0065] When the offset after the self-increment is greater than the maximum offset, the parsing of all the fragment files of the scanned file is completed. When the offset after the self-increment is not greater than the maximum offset, the next fragment file in the queue is obtained to continue parsing.
[0066] A third aspect of the present invention provides a non-transitory computer-readable medium storing instructions, which, when executed by a processor, executes the steps of a file scanning method based on a sharding strategy according to the first aspect of the present invention.
[0067] In summary, this solution solves the problem of reduced system throughput and process crash due to resource bottlenecks in file scanning services in a high-concurrency environment; by splitting large files into several small files according to the sharding strategy, the file parsing speed is accelerated while the file parsing process consumes less system resources, achieving fast scanning and improving the file parsing system throughput.
[0068] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A file scanning method based on a sharding strategy, characterized in that: The file scanning method is implemented based on an architecture consisting of a console system, a file scanning system, and a file parsing system. The file scanning method specifically includes: Step S1: The console system sends a file segmentation strategy to the file scanning system via the configuration center, and sends strategy information to the file parsing system; Step S2: The file scanning system stores the scanned file in slices based on the file slice strategy for file parsing, and the sliced files stored in slices have the following field information: identity, offset and maximum offset; The identity identifier is used to uniquely identify the shard file, the offset is the sequential number of the shard file in the multiple shard files in the scan file to which it belongs, and the maximum offset is the maximum value of the offsets of the shard files in the scan file to which the shard file belongs; Step S3: the file parsing system obtains the segmented file according to the identity identifier and the offset, and determines whether the segmented file complies with the policy information through parsing; If so, the file parsing system reports the segmented files that comply with the policy information to the console system.
2. A file scanning method based on a sharding strategy according to claim 1, characterized in that: In step S1: The console system also sends the first system configuration information to the file scanning system and sends the second system configuration information to the file parsing system via the configuration center; The first system configuration information is used to update the configuration of the file scanning system, and the second system configuration information is used to update the configuration of the file parsing system.
3. A file scanning method based on sharding strategy according to claim 2, characterized in that: In step S2, the file segmentation strategy is: perform semantic analysis on the file content obtained at the offset, and content with the same semantics is divided into the same segment, and when the field after the offset is a sentence separation field, the field is divided into file segments before and after the offset, so as to avoid the inability to match the segmented file content through field segmentation redundancy.
4. A file scanning method based on fragmentation strategy according to claim 3, characterized in that: In the step S3, the file parsing system obtains the segmented file according to the identity identifier and the offset, and determines whether the segmented file complies with the policy information through parsing; If not, the offset is increased by one bit and compared with the maximum offset; When the offset after the self-increment is greater than the maximum offset, parsing of all fragment files of the scanned file is completed; When the offset after self-increment is not greater than the maximum offset, the next fragment file in the queue is obtained to continue parsing.
5. A file scanning device based on a fragmentation strategy, characterized in that: The file scanning device is implemented based on an architecture consisting of a console system, a file scanning system, and a file parsing system. The file scanning device specifically includes: An information sending unit is configured to call the console system, send the file segmentation strategy to the file scanning system via the configuration center, and send the strategy information to the file parsing system; The slicing storage unit is configured to call the file scanning system to perform slicing storage on the scanned file based on the file slicing strategy for file parsing, and the slicing file stored in slicing has the following field information: identity, offset, and maximum offset; The identity identifier is used to uniquely identify the shard file, the offset is the sequential number of the shard file in the multiple shard files in the scan file to which it belongs, and the maximum offset is the maximum value of the offsets of the shard files in the scan file to which the shard file belongs; A file parsing unit is configured to call the file parsing system to obtain the segmented file according to the identity identifier and the offset, and determine whether the segmented file complies with the policy information through parsing; If so, the segment files that comply with the policy information are reported to the console system.
6. A file scanning device based on a sharding strategy according to claim 5, characterized in that: The information sending unit is further configured to: Calling the console system to send first system configuration information to the file scanning system and second system configuration information to the file parsing system via the configuration center; The first system configuration information is used to update the configuration of the file scanning system, and the second system configuration information is used to update the configuration of the file parsing system.
7. A file scanning device based on a fragmentation strategy according to claim 6, characterized in that: The shard storage unit is specifically configured to perform semantic analysis on the file content obtained at the offset, and content with the same semantics is divided into the same shard, and when the field after the offset is a sentence separation field, the field is divided into file shards before and after the offset, so as to avoid the inability to match the sharded file content through field shard redundancy.
8. The file scanning device based on the fragmentation strategy according to claim 7, characterized in that: The file parsing unit is specifically configured to call the file parsing system to obtain the segmented file according to the identity identifier and the offset, and determine whether the segmented file complies with the policy information through parsing; If not, the offset is increased by one bit and compared with the maximum offset; When the offset after the self-increment is greater than the maximum offset, parsing of all fragment files of the scanned file is completed; When the offset after self-increment is not greater than the maximum offset, the next fragment file in the queue is obtained to continue parsing.
9. A non-transitory computer-readable medium storing instructions, characterized in that: When the instruction is executed by the processor, the steps in the file scanning method based on the fragmentation strategy according to any one of claims 1 to 4 are performed.
