NetConfigGuard is a Python research prototype for scanning LLM-generated network and security configuration files. It checks SSH, firewall, Nginx, Docker Compose, and Kubernetes configurations for insecure settings using a rule-based verifier and an optional model-assisted analyzer.
- Python 3.10 or newer
- Dependencies listed in
requirements.txt
Install the project dependencies from the project root:
pip install -r requirements.txtThe recommended workflow for grading is:
pip install -r requirements.txt
python -m src.main --model-mode manual
python -m src.evaluate
python -m pytest testspython -m src.main --model-mode gemini --gemini-model gemini-2.5-flash --gemini-limit 1
python -m src.evaluatepython -m src.main --model-mode promptpython -m src.main --model-mode manualRun Gemini API mode with the model used in the final report:
python -m src.main --model-mode gemini --gemini-model gemini-2.5-flashTo limit the run to a smaller number of files:
python -m src.main --model-mode gemini --gemini-model gemini-2.5-flash --gemini-limit 3python -m src.evaluatepython -m pytest testsGemini mode requires an API key stored in the GEMINI_API_KEY environment variable.
$env:GEMINI_API_KEY="your_api_key_here"export GEMINI_API_KEY="your_api_key_here"Gemini API mode is optional. If the key, quota, or model is unavailable, prompt mode and manual mode still work.
The final report uses gemini-2.5-flash. Do not use gemini-1.5-flash unless it is available in the current Gemini API, because it was not available during the final project run.
After the project runs, generated outputs are written to the results/ directory:
results/rule_findings.csv
results/model_findings.csv
results/hybrid_findings.csv
results/summary.csv
results/issues_by_config_type.png
results/issues_by_severity.png
data/configs/ Sample configuration files
data/prompts/prompts.csv Baseline and security-aware prompts
data/model_outputs/ Manual model-output JSON file
src/ Source code
tests/ Rule-checker tests
results/ Generated CSV files, charts, and prompts
README.md Project documentation
requirements.txt Python dependencies
When run successfully, NetConfigGuard should:
- Scan 30 sample configuration files.
- Generate rule-based findings.
- Load manual model findings or use Gemini API mode when configured.
- Produce hybrid findings with de-duplication.
- Generate a summary CSV and two result charts.
- Pass the project test suite.