Production-ready · Multi-client · Automated · Report-generating
Deploy on Ubuntu 22.04 VPS in under 10 minutes.
- Overview
- Architecture
- Quick Start
- Configuration
- Client Management
- Running Audits
- Reports
- Notifications
- Cron Scheduling
- Google Sheets Dashboard
- Troubleshooting
- Security Notes
- Extending the Framework
CyberGuard is a professional, modular cybersecurity audit platform designed for security consultants and MSPs who manage multiple clients. It automates:
- Port & service scanning (Nmap)
- SSL/TLS certificate analysis
- Cyber hygiene scoring (0–100)
- Professional PDF report generation
- Automated email delivery of reports
- Priority alerts via email/WhatsApp for CRITICAL/HIGH findings
- Scan diffing — surfaces new and resolved issues between scans
cyberguard/
├── scripts/
│ ├── menu.py ← Main CLI entry point
│ ├── utils.py ← Shared helpers, config, logging
│ ├── setup_client.py ← Add / delete clients
│ ├── nmap_scan.py ← Port & service scanner
│ ├── ssl_checker.py ← SSL/TLS certificate checker
│ ├── parse_and_diff.py ← Scoring engine + diff
│ ├── generate_report.py ← HTML → PDF report builder
│ ├── send_report.py ← SMTP email delivery
│ ├── notify.py ← WhatsApp + alert emails
│ ├── sheets_update.py ← Google Sheets integration
│ └── cron_setup.sh ← Cron job generator
│
├── clients/
│ └── <client_name>/
│ ├── client.json ← Client metadata + config
│ ├── scans/ ← Raw scan output (JSON, XML)
│ ├── reports/ ← PDF reports
│ └── logs/ ← Per-client audit logs
│
├── templates/
│ └── report_template.html ← PDF report HTML template
│
├── logs/ ← Global framework logs
├── config.json ← Framework configuration
├── .env ← Secrets (SMTP, API keys)
├── requirements.txt
├── install.sh ← One-command installer
└── cyberguard.sh ← CLI launcher
# Clone or unzip the project
cd /opt
unzip cyberguard.zip # or: git clone ...
cd cyberguard
# Run installer (requires root)
sudo bash install.shnano .envFill in at minimum:
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your@gmail.com
SMTP_PASSWORD=your_app_password # Gmail App Password
EMAIL_FROM=your@gmail.combash cyberguard.sh| Key | Purpose |
|---|---|
framework.clients_dir |
Where client folders live |
scoring.critical_weight |
Score deduction per CRITICAL finding (default: 25) |
scoring.high_weight |
Score deduction per HIGH finding (default: 15) |
nmap.default_arguments |
Nmap flags (default: -sV -sC --open -T4) |
ssl.warn_days_before_expiry |
Days before cert expiry to warn (default: 30) |
notifications.send_on_severities |
Which severities trigger alerts |
report.company_name |
Your company name on reports |
# ── SMTP Email (required for reports) ──────────────
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=you@gmail.com
SMTP_PASSWORD=xxxx xxxx xxxx xxxx # Gmail App Password
# ── WhatsApp Business API (optional) ───────────────
WHATSAPP_ENABLED=false
WHATSAPP_API_TOKEN=your_token
WHATSAPP_FROM_NUMBER=+1234567890
# ── Google Sheets (optional) ───────────────────────
GOOGLE_SHEETS_ENABLED=false
GOOGLE_SHEETS_ID=your_spreadsheet_id
# ── Logging ────────────────────────────────────────
LOG_LEVEL=INFO # DEBUG | INFO | WARNING | ERRORGmail setup:
Go to myaccount.google.com → Security → App Passwords → Generate a password for "Mail".
From the main menu, select 1. Add new client and fill in:
- Company/client name (becomes the folder ID)
- Target IP(s) or hostname(s) — one per line
- Contact email (for report delivery)
- Contact phone (optional, for WhatsApp alerts)
- Service tier:
basic/professional/enterprise
This automatically creates:
clients/
└── acme_corp/
├── client.json
├── scans/
├── reports/
└── logs/
Select 2. Delete client → choose client → confirm.
A ZIP backup of all client data is saved to logs/deleted_clients/ before deletion.
Select 6. Update client payment status → choose active / suspended / pending.
Audits will be blocked for suspended clients.
For bulk imports, edit clients/<name>/client.json directly:
{
"name": "acme_corp",
"meta": {
"company": "ACME Corporation",
"contact_email": "security@acme.com",
"contact_name": "John Smith",
"contact_phone": "+1234567890",
"targets": ["192.168.1.1", "acme.com"],
"tier": "professional",
"payment_status": "active",
"notes": "Quarterly audit client"
}
}bash cyberguard.sh
# → Select 4. Run audit for a client
# → Select the client numberbash cyberguard.sh --client acme_corp[1/6] Nmap port & service scan
→ Identifies open ports, running services, outdated software
[2/6] SSL/TLS certificate check
→ Expiry, weak protocols, cipher suites, HSTS, self-signed
[3/6] Parse results + diff with previous scan
→ Computes score, categorizes findings, finds new/resolved issues
[4/6] Generate PDF report
→ Professional HTML → PDF report saved to client/reports/
[5/6] Send PDF via email
→ Delivered to client contact address
[6/6] Send priority notifications
→ WhatsApp/email for CRITICAL & HIGH findings only
| Score | Label | Severity |
|---|---|---|
| 91–100 | GOOD | ✅ |
| 76–90 | LOW RISK | 🟢 |
| 61–75 | MEDIUM RISK | 🟡 |
| 41–60 | HIGH RISK | 🟠 |
| 0–40 | CRITICAL RISK | 🔴 |
Deductions per finding:
- CRITICAL: −25 pts
- HIGH: −15 pts
- MEDIUM: −8 pts
- LOW: −3 pts
- INFO: 0 pts
Reports are saved to: clients/<client>/reports/report_<timestamp>.pdf
Report sections:
- Cover page — Score, client, date, severity summary
- Executive Summary — Score dashboard, findings counts, diff vs previous
- Findings Detail — Each finding with description + recommendation
- Remediation Roadmap — Prioritized table with timelines
PDF Engine priority:
- WeasyPrint (best quality) —
pip install weasyprint - pdfkit / wkhtmltopdf —
sudo apt install wkhtmltopdf - Chromium headless (if installed)
- HTML fallback (+ stub PDF)
Sent automatically for CRITICAL/HIGH findings. Configured via .env.
- Set
WHATSAPP_ENABLED=truein.env - Add your WhatsApp Business API token
- Add
contact_phoneto the client'sclient.json
Messages are sent via the WhatsApp Business Cloud API (Meta/Facebook).
You need a Meta Business account and approved WhatsApp Business API access.
Generate cron jobs for automated recurring audits:
bash scripts/cron_setup.shSelect a schedule (daily/weekly/monthly/custom) and optionally auto-install to crontab.
Manual crontab example:
crontab -e
# CyberGuard — run acme_corp audit every Sunday at 1 AM
0 1 * * 0 bash /opt/cyberguard/cyberguard.sh --client acme_corp >> /opt/cyberguard/logs/cron_acme_corp.log 2>&1- Create a Google Cloud project and enable the Sheets API
- Create a Service Account and download JSON credentials
- Save as
credentials/google_service_account.json - Share your target spreadsheet with the service account email
- Set in
.env:GOOGLE_SHEETS_ENABLED=true GOOGLE_SHEETS_ID=your_spreadsheet_id
- Install:
pip install gspread google-auth
Each audit updates a row in the "Audit Dashboard" worksheet.
sudo apt-get install -y nmappip install python-nmap# Option A: WeasyPrint (recommended)
pip install weasyprint
# Option B: wkhtmltopdf
sudo apt-get install -y wkhtmltopdf
pip install pdfkit- For Gmail: use an App Password, not your regular password
- Enable 2FA on your Google account first
- Generate App Password: myaccount.google.com → Security → App Passwords
Reduce scope in config.json:
"nmap": {
"default_arguments": "-sV --open -T3 --top-ports 100",
"timeout": 120
}sudo chown -R $USER:$USER /opt/cyberguard/clients
chmod -R 755 /opt/cyberguard/clients# Global framework log
tail -f logs/cyberguard_$(date +%Y%m).log
# Per-client log
tail -f clients/acme_corp/logs/acme_corp_$(date +%Y%m).log- Never commit
.envto version control. It's in.gitignore. - The
credentials/folder haschmod 700permissions. - Client data contains potentially sensitive scan results — restrict server access.
- Reports are emailed as attachments — use TLS-enabled SMTP.
- Nmap scans generate network traffic that may trigger IDS/IPS on client networks — always obtain written authorization before scanning.
scanme.nmap.orgis the only public host authorized for nmap testing.
- Create
scripts/my_scanner.pywith arun_my_scan(target, scan_dir, timestamp, config) -> list[dict]function - Return findings using the
make_finding(...)factory - Call it from
menu.py'srun_audit()function
Edit templates/report_template.html — it uses {{variable}} placeholders populated by generate_report.py.
Edit config.json:
"scoring": {
"critical_weight": 30,
"high_weight": 20,
"medium_weight": 10,
"low_weight": 5
}This software is proprietary. All rights reserved.
Unauthorized redistribution or resale is prohibited.
CyberGuard Security Platform v1.0.0
Built for Ubuntu 22.04 LTS · Python 3.10+