01Overview
The Fortinet FortiGate Security Scanner is a Python security-posture assessment tool that grades FortiGate next-gen firewalls against best-practice hardening, five compliance frameworks, real FortiOS CVEs, and MITRE ATT&CK resilience. It ships as two scanners that share the exact same rule engine: a live scanner that talks to the FortiOS REST API, and an offline scanner that parses an exported .conf backup with zero network access and zero third-party dependencies — purpose-built for OT, ICS, and air-gapped networks where you can't reach the firewall's management plane.
Under the hood it runs 260+ checks across 18 audit domains — admin access, firewall policy hygiene, SSL/IPsec VPN crypto, security profiles, logging, HA, certificates, network hardening, ZTNA/SD-WAN, wireless, backup/DR, and advanced FIPS-grade hardening. Beyond static config review, it does two things most config auditors don't: it matches the parsed firmware version against 66 known FortiOS CVEs (2019-2026, sourced from FortiGuard PSIRT) using train-based version logic across six release trains, and it runs 31 MITRE ATT&CK technique tests across 11 tactics to produce a 0-100% attacker-resilience score.
Every finding auto-resolves to CIS FortiGate, PCI-DSS 4.0, NIST 800-53 Rev 5, SOC 2, and HIPAA controls, and to a ready-to-paste FortiOS CLI remediation block — so the same scan feeds an auditor's evidence CSV and an engineer's fix script. It's a zero-agent, single-file design with a non-zero exit code on CRITICAL/HIGH for CI/CD gating and JSON inventory-driven fleet scanning across many firewalls at once.
It's built for firewall and network-security engineers, red/blue teams, OT/ICS security staff, and GRC auditors who need a repeatable, evidence-grade FortiGate review that works whether the box is online or locked behind an air gap.
02Key Capabilities
Dual live + offline scanning
One rule engine, two front doors: scan a live FortiGate over the REST API, or audit an exported .conf backup offline with no network and no pip install.
260+ checks across 18 domains
Eighteen dedicated check methods cover admin access, policy hygiene, VPN crypto, security profiles, logging, HA, certs, network hardening, wireless, ZTNA/SD-WAN, backup, and auth.
66 FortiOS CVE detection
Matches the parsed firmware against 66 FortiGuard PSIRT CVEs (2019-2026) using train-based version logic across six release trains, flagging known-exploited SSL VPN, fgfmd, and FortiJump bugs.
31-technique MITRE ATT&CK resilience
Tests 31 ATT&CK techniques across 11 tactics and emits a 0-100% resilience score showing how well the firewall's controls actually blunt real-world attacks.
Five-framework compliance mapping
Every finding auto-maps to CIS FortiGate, PCI-DSS 4.0, NIST 800-53 Rev 5, SOC 2, and HIPAA controls (76 rule-to-framework mappings) for instant audit evidence.
One-click remediation export
Exports 42 ready-to-paste FortiOS CLI config blocks tied to specific findings via --remediation, turning a scan into an actionable fix script.
Multi-device fleet scanning
Batch-scans an entire firewall fleet from a JSON inventory file and produces a unified summary and aggregated JSON report.
Air-gapped / OT mode
The offline scanner is stdlib-only so it runs on locked-down OT operator workstations, delivering the full 18-category audit from a config backup alone.
Six output formats
Console, JSON, dark-themed interactive HTML, compliance CSV, remediation script, and an ATT&CK resilience score cover engineers, auditors, and pipelines.
CI/CD-ready gating
Returns exit code 1 on any CRITICAL or HIGH finding so it drops straight into GitHub Actions or any pipeline as a security gate.
Zero-agent, read-only
Uses only a read-only FortiOS API token with no software installed on the target, keeping the assessment low-footprint and safe for production firewalls.
03Architecture
A single-file live engine (fortinet_scanner.py) holds all data (CVE list, compliance map, remediation commands) and logic (18 check methods, report mixin, multi-device orchestrator). A thin offline adapter (fortinet_offline_scanner.py) subclasses the engine and overrides only the data-access seam (_api_get), so a parsed .conf feeds the identical checks. Data flows Connect/Parse -> Collect -> Audit -> CVE match -> MITRE score -> Compliance resolve -> Report.
04Project Structure
fortinet_scanner.pyLive REST-API scanner and the shared rule engine (~5,587 lines): all 18 check methods, CVE/compliance/remediation data, report mixin, and multi-device scanner.fortinet_offline_scanner.pyStdlib-only offline scanner (~506 lines): FortiGateConfParser plus OfflineFortinetScanner that reuses the live engine against a .conf backup.README.mdFull documentation: capabilities table, architecture diagram, usage, CLI reference, MITRE and CVE breakdowns, CI/CD examples.CLAUDE.mdEngineering guide: architecture internals, check-method table, compliance and MITRE mappings, offline-parser design, and dev conventions.test_data/test_offline_parser.pyPytest suite (23 test functions) covering header parsing, section-to-API-path mapping, reference shaping, VDOM wrappers, malformed input, and an end-to-end smoke run.test_data/sample_insecure.confIntentionally insecure mini-config that triggers ~115 findings across all 18 categories for smoke testing.test_data/sample_74_outdated.confSample FortiOS 7.4 backup on an outdated build used to exercise CVE and version-train matching.test_data/fortinet_report.jsonReference JSON report artifact produced by a scan run.test_data/fortinet_report.htmlReference dark-themed HTML report artifact showing the interactive output.banner.svgProject banner graphic used in the README header.fortigate-scanner-medium-article.mdLong-form write-up / article about the scanner's design and use.LICENSEMIT license.05Security Controls
06Technology Stack
- Language
- Python 3.10+
- Live dependency
- requests (lazy-imported; only needed for REST-API mode)
- Offline dependency
- None — Python standard library only (stdlib re/argparse), runs on air-gapped hosts
- Target API
- FortiOS REST API v2 (cmdb + monitor endpoints), Bearer-token auth; FortiOS 6.x/7.x
- Testing
- pytest — 23 test functions in test_data/test_offline_parser.py plus sample .conf smoke fixtures
- Reporting
- Built-in JSON, dark-theme HTML (Catppuccin Mocha), compliance CSV, and CLI remediation exporters
- Deployment
- Single-file scanners, zero-agent, git clone; CI-ready via CRITICAL/HIGH exit-code gating
07Quick Start
$ git clone https://github.com/Krishcalin/Fortinet-Network-Security.git && cd Fortinet-Network-Security && pip install requests $ python fortinet_scanner.py 10.1.1.1 --token <API-TOKEN> $ python fortinet_scanner.py 10.1.1.1 --token <TOKEN> --json report.json --html report.html --compliance-csv audit.csv --remediation fix.txt $ python fortinet_scanner.py --inventory devices.json --json unified_report.json $ python fortinet_offline_scanner.py /path/to/fortigate.conf --json report.json --html report.html --severity HIGH $ python -m pytest test_data/test_offline_parser.py -v
08Compliance & Frameworks
09Integrations & Outputs
Explore Fortinet FortiGate Scanner
Full source, documentation, and deployment guides live on GitHub.