Network segment information compliance report generation method and system, storage medium and equipment
Through a network segment information compliance report generation method, the professional library uses the analysis and verification of IP addresses and subnet information in the network configuration file, the problem of manual inspection in traditional network management is solved, and efficient network compliance inspection and report generation is achieved, improving network security.
Patent Information
- Application Number
- CN202411885929.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-19
AI Technical Summary
In traditional network management, administrators need to manually check network configuration files to ensure that each IP address or subnet complies with the organization's network policies. This process is time-consuming and error-prone, which may lead to security vulnerabilities.
Provides a method for generating network segment information compliance report, which generates compliance reports by reading worksheet files, parsing and processing predefined network segment information in text files, verifying IP address and subnet information. This method uses professional libraries such as xlrd, ipaddress and xlwt to achieve efficient verification and report generation.
This method can efficiently verify IP address and subnet information, generate detailed compliance reports, reduce human errors, improve network security, and be suitable for diverse network environments.
Smart Images

Figure CN119766654A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of network security technology, and in particular relates to a method, system, storage medium and device for generating a network segment information compliance report. Background Art
[0002] In traditional network management, administrators need to manually check network configuration files to ensure that each IP address or subnet complies with the organization's network policy. This process is not only time-consuming but also prone to errors, especially when dealing with large amounts of data. Due to human negligence or misunderstanding, security vulnerabilities may occur, which in turn puts the entire network at risk.
[0003] Although existing technologies have alleviated the burden of manually checking network configurations to some extent, they usually require complex configurations and expertise, making them difficult for non-professionals to use. In addition, many tools focus on specific types of network devices or protocols and lack sufficient flexibility to cope with diverse network environments. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method for generating a network segment information compliance report, the method comprising:
[0005] Read the worksheet file, traverse the columns to be checked in the worksheet, and extract the IP address and subnet information;
[0006] Parse and process the predefined network segment information in the text file, obtain and save the network segment information compliance range;
[0007] Verify the IP address and subnet information according to the compliance range of the network segment information and generate a verification result;
[0008] Mark the verification results into a worksheet file and generate and save a network segment information compliance report.
[0009] Furthermore, the reading of the worksheet file includes: using the open workbook function of the xlrd library to read the worksheet file.
[0010] Furthermore, the parsing and processing of the predefined network segment information in the text file includes:
[0011] Read the text file content line by line and skip blank lines;
[0012] The text file content is parsed according to CIDR notation or IP address range.
[0013] Furthermore, parsing the text file content includes:
[0014] When the text file content is a subnet in CIDR format, use the IPv4Networks class of the ipaddress library to parse it;
[0015] When the text file content is a specific IP address range, use the IPv4Adress class and summarize_address_range function for parsing.
[0016] Furthermore, obtaining and saving the network segment information compliance range includes: storing the parsed text file content as the network segment information compliance range in the offices subnets list.
[0017] Further, the verifying the IP address and subnet information includes: using the ipaddress library to verify the IP address or subnet information of the to-be-checked column in the worksheet;
[0018] When the column to be checked in the worksheet is an IP address, use the IPv4Address and summarizeaddressrange functions for verification;
[0019] When the item to be checked in the worksheet is subnet information, use IPv4Network for verification.
[0020] Furthermore, the generating and saving of the network segment information compliance report includes:
[0021] Create a copy of the worksheet file;
[0022] Traverse each cell in the worksheet file and mark the IP addresses and subnet information that do not conform to the predefined ones according to the verification results;
[0023] Generate and save compliance reports.
[0024] A network segment information compliance report generation system, the system comprising: a file reading and parsing module, a predefined network segment information parsing module, an IP address and subnet information verification module and a compliance report generation module;
[0025] The file reading and parsing module uses the open_workbook function of the xlrd library to open the worksheet file, and then traverses the worksheet or the column contents to be checked one by one;
[0026] The predefined network range parsing module is used to process the predefined network segment information in the text file;
[0027] The IP address and subnet information verification module uses the ipaddress library to verify each IP address or subnet in the check column content one by one;
[0028] The compliance report generation module uses the xlwt library to mark the IP addresses and subnet information that do not comply with the network policy in the worksheet file, and attaches detailed instructions on the right side of the cell to generate a compliance report.
[0029] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described above is implemented.
[0030] An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0031] Memory, used to store computer programs;
[0032] The processor is used to implement any of the above-mentioned method steps when executing the program stored in the memory.
[0033] Compared with the prior art, the present invention has the following advantages:
[0034] 1. The present invention proposes a method for generating a network segment information compliance report, which realizes efficient IP address verification and network segment information compliance checking by adopting professional libraries and technologies.
[0035] 2. It can handle various situations such as CIDR format subnets, IP address ranges, etc., is suitable for diverse network environments, and provides customized network policy compliance checking solutions for different organizations and enterprises.
[0036] 3. By marking IP addresses and subnet information that do not meet the standards, potential network security risks can be discovered in a timely manner; through the use of professional libraries and technologies, the accuracy of verification is ensured, and the probability of missed reports and false alarms is reduced; it becomes an important auxiliary tool for network security management and effectively guarantees the overall security of the network.
[0037] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flow chart of a method for generating a network segment information compliance report is shown.
[0040] Figure 2 A schematic diagram of a network segment information compliance report generation system is shown. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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.
[0042] like Figure 1 As shown, a method for generating a network segment information compliance report comprises the following steps:
[0043] S1. Read the worksheet (Excel) file, traverse the columns to be checked in each worksheet, and extract the IP address and subnet information.
[0044] S1.1. Use the open workbook function of the xlrd library to read the worksheet (Excel) file, and then traverse the worksheet and the columns to be checked.
[0045] S1.2. Get the value of the worksheet or the column to be checked, and extract the IP address and subnet information.
[0046] S2. Parse and process the predefined network segment information in the text file, and obtain and save the allowed range of the network segment information.
[0047] S2.1. Read the text file content line by line and skip blank lines.
[0048] S2.2. According to the CIDR (Classless Inter-Domain Routing) notation or the IP address range, the read text file content is parsed accordingly.
[0049] Optionally, when the text file content is a CIDR-formatted subnet, use the IPv4Networks class of the ipaddress library for parsing;
[0050] When the text file content is a specific IP address range, use the IPv4Address class and summarize_address_range function for parsing.
[0051] S2.3. Store the parsed text file content as the network segment information compliance range in the officessubnets list.
[0052] S3. Verify the IP address and subnet information in the To-be-Checked column of the worksheet.
[0053] S3.1. Use the ipaddress library to verify each IP address or subnet information in the worksheet and the column to be checked one by one.
[0054] Optionally, when the worksheet and the column to be checked contain IP addresses, use the IPv4Address and summarizeaddress range functions for verification;
[0055] When the worksheet and the To be checked column contain subnet information, use IPv4Network for verification.
[0056] S4. Based on the verification results, mark the IP addresses and subnet information that do not comply with the predefined network segment information into a worksheet (Excel) file, provide detailed instructions, and generate a worksheet (Excel) file for the compliance report.
[0057] S4.1. Create copies of worksheets to facilitate modifications and maintain data integrity and traceability.
[0058] S4.2. Traverse each cell and mark the IP addresses and subnet information that do not conform to the predefined ones.
[0059] S4.3. Generate and save a worksheet (Excel) file containing the compliance report.
[0060] like Figure 2 The invention discloses a network segment information compliance report generating system, which comprises: a file reading and parsing module, a predefined network segment information parsing module, an IP address and subnet information verification module and a compliance report generating module.
[0061] The file reading and parsing module uses the open_workbook function of the xlrd library to open the worksheet (Excel) file, and then traverses the worksheet or the column contents to be checked one by one.
[0062] The predefined network range parsing module is used to process the predefined network segment information in the text file.
[0063] The IP address and subnet information verification module uses the ipaddress library to verify each IP address or subnet in the check column one by one.
[0064] The compliance report generation module uses the xlwt library to mark the IP addresses and subnet information that do not comply with the network policy in the worksheet (Excel) file, and attaches detailed instructions to the right of the cell to generate a compliance report.
[0065] Based on the above disclosed content, the present invention also provides an electronic device accordingly. The electronic device of an embodiment of the present invention includes at least one electrically connected processor and at least one storage medium, the storage medium is electrically connected to the processor, wherein the storage medium stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method as described above.
[0066] Based on the same inventive concept, the present invention also provides a storage medium, which stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method as described above.
[0067] The above description and the accompanying drawings fully illustrate the embodiments of the present invention so that those skilled in the art can practice them. Other embodiments may include structural and other changes. The embodiments represent only possible variations. Unless explicitly required, individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The embodiments of the present invention are not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for generating a network segment information compliance report, characterized in that: The method includes reading a worksheet file, traversing the columns to be checked in the worksheet, and extracting IP addresses and subnet information; Parse and process the predefined network segment information in the text file, obtain and save the network segment information compliance range; Verify the IP address and subnet information according to the compliance range of the network segment information and generate a verification result; Mark the verification results into a worksheet file and generate and save a network segment information compliance report.
2. The method for generating a network segment information compliance report according to claim 1, characterized in that: The reading of the worksheet file includes: using the open workbook function of the xlrd library to read the worksheet file.
3. The method for generating a network segment information compliance report according to claim 1, characterized in that: The parsing and processing of predefined network segment information in the text file includes: Read the text file content line by line and skip blank lines; The text file content is parsed according to CIDR notation or IP address range.
4. The method for generating a network segment information compliance report according to claim 3, characterized in that: Parsing the text file content includes: When the text file content is a subnet in CIDR format, use the IPv4Networks class of the ipaddress library to parse it; When the text file content is a specific IP address range, use the IPv4Adress class and summarize_address_range function for parsing.
5. The method for generating a network segment information compliance report according to claim 3, characterized in that: The network segment information compliance range is obtained and saved, including: storing the parsed text file content as the network segment information compliance range in the officessubnets list.
6. The method for generating a network segment information compliance report according to claim 1, characterized in that: The verifying the IP address and subnet information includes: using the ipaddress library to verify the IP address or subnet information of the to-be-checked column in the worksheet; When the column to be checked in the worksheet is an IP address, use the IPv4Address and summarize address range functions for verification; When the item to be checked in the worksheet is subnet information, use IPv4Network for verification.
7. The method for generating a network segment information compliance report according to claim 6, characterized in that: The generating and saving of the network segment information compliance report includes: Create a copy of the worksheet file; Traverse each cell in the worksheet file and mark the IP addresses and subnet information that do not conform to the predefined ones according to the verification results; Generate and save compliance reports.
8. A network segment information compliance report generation system, characterized in that: The system includes: a file reading and parsing module, a predefined network segment information parsing module, an IP address and subnet information verification module and a compliance report generation module; The file reading and parsing module uses the open_workbook function of the xlrd library to open the worksheet file, and then traverses the worksheet or the column contents to be checked one by one; The predefined network range parsing module is used to process the predefined network segment information in the text file; The IP address and subnet information verification module uses the ipaddress library to verify each IP address or subnet in the check column content one by one; The compliance report generation module uses the xlwt library to mark the IP addresses and subnet information that do not comply with the network policy in the worksheet file, and attaches detailed instructions on the right side of the cell to generate a compliance report.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.
Citation Information
Patent Citations
Inter-security-domain firewall security policy compliance baseline management method and inter-security-domain firewall security policy compliance baseline management device
CN112351014A
Method and apparatus for monitoring multiple network segments in local area networks for compliance with wireless security policy
US20060193300A1
Network segmentation
US20150236935A1