Author: Octomany
LinkedIn: LinkedIn
Date Created: 2024-11-06
Last Update: 2025-14-03
CIS Benchmark Converter is a Python script that extracts recommendations from CIS Benchmark PDF documents and exports them into CSV, Excel, or JSON formats. The script converts unstructured PDF content into a structured table, simplifying compliance reviews and audits.
-
Configurable Extraction:
Set the start page to skip tables of contents or disclaimers, and adjust the logging level via command-line options. -
Multiple Output Formats:
Export the extracted data as CSV (using a pipe|delimiter), Excel (with styled headers, dropdowns, and conditional formatting), or JSON for easy data integration. -
Robust and Maintainable:
Usespathlibfor modern file path management, extended type annotations for static type checking, enhanced exception handling, and a progress bar (viatqdm) for user feedback.
-
Clone this repository.
-
Install dependencies using the provided
requirements.txt:pip install -r requirements.txt
requirements.txt:
pdfplumber openpyxl tqdm
Run the script from the command line as follows:
python cis_benchmark_converter.py \
-i path/to/input_file.pdf \
-o path/to/output_file \
-f [csv|excel|json] \
--start_page 10 \
--log_level INFO-i, --input: Path to the input CIS Benchmark PDF file (required).-o, --output: Path to the output file (defaults to the input file name with a.csv,.xlsx, or.jsonextension).-f, --format: Output file format:csv,excel, orjson(default:excel).--start_page: Page number to start extraction (default: 10).--log_level: Logging level (DEBUG,INFO,WARNING, orERROR; default:INFO).
python cis_benchmark_converter.py -i ./CIS_AWS_Benchmark.pdf -o ./CIS_AWS_Benchmark.json -f json --start_page 10 --log_level INFOFor JSON output, the data is structured as a list of dictionaries, with each dictionary representing a recommendation and its associated sections.
Note: The script automatically excludes any sections labeled "CIS Controls" to focus solely on the core recommendations.
Special thanks to Flavien Fouqueray (UnBonWhisky) for his valuable bug fixes and contributions in earlier versions of this script.
This project is licensed under the MIT License. Please respect the copyrights of the CIS Benchmark documents when using and sharing this tool.