How zenfish/satan works
Project Type and Purpose
• SATAN is a full-stack network vulnerability scanner with:
• A web front-end (CGI scripts in Perl under html/)
• An application-logic layer (Perl scripts and policy engine under perl/ and perllib/)
• A set of compiled probe binaries (C code under src/ → built into bin/)
• A file-based configuration & rules engine (config/ and rules/)
Main Components
A. Web Server / HTTP Interface
• e.g., Apache or NCSA HTTPd hosting html/*.pl CGIs
B. CGI Controllers (Perl)
• html/admin/*.pl, html/data/*.pl, html/running/*.pl, html/reporting/*.pl
• Entry points for user actions: configuration, execution, reporting
C. Application Logic Layer (Perl & Policy Engine)
• perl/*.pl scripts (policy-engine.pl, facts.pl, infer_facts.pl, etc.)
• perllib/ helper modules (getopts.pl, ctime.pl, etc.)
D. Configuration & Rules Store
• config/satan.cf, config/services, config/version.pl,
• rules/{facts,trust,services,…} defining vulnerability logic
E. Probe Binaries
• bin/*.satan wrappers invoking compiled C tools
• src/ subdirs (boot/, fping/, nfs-chk/, port_scan/, rpcgen/, yp-chk/)
F. Data Store
• Flat files or DB files under config/ or local working dir (satan.db?)
• “facts” produced by probes and policy engine
G. Reporting / HTML Renderer
• html/reporting/*.pl generating HTML pages from the data store
Relationships & Data Flow
1. User → HTTP Request → Web Server
2. Web Server → CGI Controller
3. CGI Controller ↔ Application Logic
• Loads config/satan.cf & rules
• Calls policy-engine to decide which probes to run
4. Application Logic → Spawns Probe Binaries (bin/)
5. Probe Binaries → Scan network targets → Produce raw “facts”
6. Application Logic ← Parses “facts” → Stores in Data Store
7. Reporting Controller → Reads Data Store → Renders HTML → User
Architectural Patterns & Principles
• MVC-like separation:
• View = HTML templates & generated pages
• Controller = html/*.pl scripts
• Model = policy engine + facts + rules + data store
• Modular plugin style:
• New probes added via src/ → compiled & dropped into bin/
• Rules in rules/ directory are pluggable
• File-based configuration for easy extension
Technology Stack Highlights
• Web server: CGI-capable (Perl)
• Perl 5 for business logic, controllers, and modules
• C for high-performance network probes
• Flat files for config, rules, and data persistence
• Makefile-driven build for C components (src/)
• Shell scripts (bin/*.satan) gluing Perl controllers to binaries
• Notes on key file locations (e.g., rules/ directory, config/satan.cf)