📊 Export & Reports
Export scan results to CSV, HTML, JSON, and PDF formats for documentation and sharing.
New in v2.1.0: Multi-format export with styled HTML reports, PDF generation, and automatic timestamping.
Quick Start
Access export from the interactive menu:
netscan
# Press 'x' for Export Scans
Supported Formats
| Format | Extension | Best For |
|---|---|---|
| CSV | .csv | Spreadsheet analysis, data import |
| HTML | .html | Web viewing, email reports |
| JSON | .json | API integration, programmatic use |
| Professional reports, archival |
Basic Export
# Export to CSV
python3 helpers/export.py --format csv --input scan_results.json --output report.csv
# Export to HTML
python3 helpers/export.py --format html --input scan_results.json --output report.html
# Export to JSON (formatted)
python3 helpers/export.py --format json --input scan_results.json --output report.json
# Export to PDF (requires wkhtmltopdf)
python3 helpers/export.py --format pdf --input scan_results.json --output report.pdf
Export Options
# Auto-generate filename with timestamp
python3 helpers/export.py --format html --input scan.json --auto-name
# Output: netscan_report_20260106_143022.html
# Include additional metadata
python3 helpers/export.py --format html --input scan.json \
--title "Network Audit Report" \
--company "Acme Corp"
# Export multiple scans to single report
python3 helpers/export.py --format html \
--input scan1.json scan2.json scan3.json \
--output combined_report.html
# Filter by device type
python3 helpers/export.py --format csv --input scan.json \
--filter-type router,server
CSV Export
Produces a clean spreadsheet-compatible format:
IP Address,MAC Address,Hostname,Vendor,Device Type,First Seen,Last Seen
192.168.1.1,00:11:22:33:44:55,router.local,Cisco Systems,Router,2026-01-01 10:00:00,2026-01-06 14:30:22
192.168.1.50,AA:BB:CC:DD:EE:FF,desktop-pc,Dell Inc.,Workstation,2026-01-02 08:15:00,2026-01-06 14:30:22
192.168.1.100,11:22:33:44:55:66,server.local,HP Inc.,Server,2026-01-01 10:00:00,2026-01-06 14:30:22
HTML Report
Generates a styled, interactive HTML report:
# Basic HTML report
python3 helpers/export.py --format html --input scan.json --output report.html
# HTML with all options
python3 helpers/export.py --format html --input scan.json \
--output report.html \
--title "Weekly Network Report" \
--company "Acme Corp" \
--logo logo.png \
--include-charts \
--include-timeline
HTML Report Features
- Responsive design for all screen sizes
- Sortable and filterable device tables
- Interactive charts (vendor distribution, device types)
- Timeline visualization of network changes
- Dark/light mode toggle
- Print-optimized styles
PDF Reports
Requirement: PDF export requires
wkhtmltopdf to be installed.
# Install wkhtmltopdf
# macOS
brew install wkhtmltopdf
# Ubuntu/Debian
sudo apt-get install wkhtmltopdf
# Generate PDF
python3 helpers/export.py --format pdf --input scan.json --output report.pdf
# PDF options
python3 helpers/export.py --format pdf --input scan.json \
--output report.pdf \
--page-size A4 \
--orientation landscape \
--margin 20
JSON Export
Formatted JSON with full device details:
{
"report": {
"generated": "2026-01-06T14:30:22Z",
"tool": "NetScan v2.1.0",
"network": "192.168.1.0/24"
},
"summary": {
"total_devices": 25,
"by_type": {
"router": 1,
"server": 3,
"workstation": 12,
"mobile": 6,
"iot": 3
}
},
"devices": [
{
"ip": "192.168.1.1",
"mac": "00:11:22:33:44:55",
"hostname": "router.local",
"vendor": "Cisco Systems",
"type": "router",
"ports": [22, 80, 443],
"first_seen": "2026-01-01T10:00:00Z",
"last_seen": "2026-01-06T14:30:22Z"
}
]
}
CLI Options Reference
| Option | Description |
|---|---|
--format FORMAT | Output format: csv, html, json, pdf |
--input FILE | Input scan file(s) |
--output FILE | Output filename |
--auto-name | Auto-generate timestamped filename |
--title TEXT | Report title |
--company TEXT | Company name for header |
--logo FILE | Logo image for HTML/PDF |
--include-charts | Add charts to HTML report |
--include-timeline | Add timeline to HTML report |
--filter-type TYPES | Filter by device types |
--page-size SIZE | PDF page size (A4, Letter) |
--orientation DIR | PDF orientation (portrait, landscape) |
Python API
from helpers.export import Exporter, ReportConfig
# Create exporter
exporter = Exporter()
# Load scan data
data = exporter.load("scan_results.json")
# Export to different formats
exporter.to_csv(data, "report.csv")
exporter.to_html(data, "report.html")
exporter.to_json(data, "report.json")
exporter.to_pdf(data, "report.pdf")
# With configuration
config = ReportConfig(
title="Network Audit",
company="Acme Corp",
include_charts=True,
include_timeline=True
)
exporter.to_html(data, "report.html", config=config)
Integration Examples
# Scan and export in one command
netscan --scan 192.168.1.0/24 --export html --output report.html
# Schedule weekly PDF reports
python3 helpers/scheduler.py --create weekly_report \
--schedule weekly \
--format pdf \
--notify admin@company.com
# Export for different teams
python3 helpers/export.py --format html --input scan.json \
--filter-type server --output servers_report.html
python3 helpers/export.py --format csv --input scan.json \
--filter-type workstation --output workstations.csv
💡 Tip: Use HTML format for sharing reports via email - they include all styling inline and look great in any browser.