🔒 Security Audit

Scan your network for common vulnerabilities, risky open ports, and security misconfigurations.

⚠️ Important: Only scan networks you own or have explicit permission to test. Unauthorized scanning may violate laws and policies.

Quick Start

Access security auditing from the interactive menu:

netscan
# Press 's' for Security Audit

What's Checked

🚨 Risky Open Ports

PortServiceRisk LevelWhy
21FTPHighCleartext transmission
23TelnetCriticalNo encryption
445SMBCriticalRansomware target
3389RDPHighBrute force attacks
3306MySQLHighDatabase exposure
6379RedisCriticalOften no auth
27017MongoDBCriticalOften no auth

🔐 SSL/TLS Checks

  • Certificate expiration
  • Self-signed certificates
  • Weak cipher suites

🌐 HTTP Security Headers

  • X-Frame-Options
  • X-Content-Type-Options
  • Strict-Transport-Security (HSTS)
  • Content-Security-Policy
  • X-XSS-Protection

Risk Levels

LevelIconAction Required
Critical🔴Immediate attention required
High🟠Address within 24-48 hours
Medium🟡Plan remediation this week
Low🔵Consider for future improvement
Info⚪Informational only

CLI Usage

# Scan and audit network
python3 helpers/security.py --scan

# Audit single host
python3 helpers/security.py --target 192.168.1.1

# From existing scan results
python3 helpers/security.py --input scan.json

# Generate HTML report
python3 helpers/security.py --scan --html --output security_report.html

# JSON output
python3 helpers/security.py --scan --json --output security.json

Sample Report

======================================================================
  NETWORK SECURITY AUDIT REPORT
======================================================================

  Scan Time: 2026-01-06 14:30:00
  Hosts Scanned: 12

----------------------------------------------------------------------
  RISK SUMMARY
----------------------------------------------------------------------
  🔴 CRITICAL: 2
  🟠 HIGH: 5
  🟡 MEDIUM: 3
  🔵 LOW: 1

----------------------------------------------------------------------
  🔴 CRITICAL FINDINGS (2)
----------------------------------------------------------------------

  [192.168.1.50:23] Telnet Service Open (23)
    Telnet transmits data in cleartext. Use SSH instead.
    → Replace Telnet with SSH for secure remote access.

  [192.168.1.100:6379] Redis Service Open (6379)
    Redis often has no authentication.
    → Enable Redis AUTH and bind to localhost only.

----------------------------------------------------------------------
  RECOMMENDATIONS
----------------------------------------------------------------------
  • ⚠️ CRITICAL: Address critical findings immediately!
  • 🔒 Replace insecure protocols (Telnet, FTP) with encrypted alternatives.
  • 🗄️ Database services should not be exposed to the network.

======================================================================

HTML Reports

Generate beautiful, shareable HTML security reports:

python3 helpers/security.py --scan --html --output audit.html

Features:

  • 📊 Visual risk summary cards
  • 🎨 Color-coded severity indicators
  • 📋 Actionable recommendations
  • 📱 Mobile-responsive design
  • 🖨️ Print-friendly layout

Python API

from helpers.security import SecurityAuditor

# Create auditor
auditor = SecurityAuditor(timeout=5.0, threads=20)

# Audit single host
findings = auditor.audit_host("192.168.1.1")
for f in findings:
    print(f"[{f.severity}] {f.title}")
    print(f"  {f.description}")

# Audit network from device list
devices = [{"ip": "192.168.1.1"}, {"ip": "192.168.1.10"}]
report = auditor.audit_network(devices)

# Generate outputs
text_report = auditor.render_text()
html_report = auditor.render_html()

# Access report data
print(f"Critical: {report.risk_summary['critical']}")
print(f"Total findings: {len(report.findings)}")

Scheduling Security Audits

Combine with scheduled scans for ongoing security monitoring:

# Create weekly security audit job
python3 helpers/scheduler.py --create weekly_audit \
    --schedule weekly \
    --scan-type full \
    --notify security@company.com
💡 Best Practice: Run security audits after any network changes (new devices, firewall updates) and on a regular schedule (weekly/monthly).