⏰ Scheduled Scans
Automate network scanning with native cron (Linux) or launchd (macOS) integration.
New in v2.1.0: Scheduled scanning with email notifications, automatic report generation, and change detection.
Quick Start
Access scheduling from the interactive menu:
netscan
# Press 'j' for Scheduled Scans
Predefined Schedules
| Name | Cron Expression | Description |
|---|---|---|
hourly | 0 * * * * | Every hour on the hour |
daily | 0 9 * * * | Every day at 9:00 AM |
nightly | 0 2 * * * | Every night at 2:00 AM |
weekly | 0 9 * * 1 | Every Monday at 9:00 AM |
monthly | 0 9 1 * * | 1st of each month at 9:00 AM |
Create a Scheduled Job
# Basic daily scan
python3 helpers/scheduler.py --create daily_scan --schedule daily
# Hourly scan with email notifications
python3 helpers/scheduler.py --create hourly_check \
--schedule hourly \
--notify admin@company.com
# Weekly full scan with reports
python3 helpers/scheduler.py --create weekly_audit \
--schedule weekly \
--scan-type full \
--format html
# Custom cron expression (every 6 hours)
python3 helpers/scheduler.py --create custom_scan \
--schedule "0 */6 * * *"
Manage Jobs
# List all scheduled jobs
python3 helpers/scheduler.py --list
# Show job details
python3 helpers/scheduler.py --show daily_scan
# Run job immediately (manual trigger)
python3 helpers/scheduler.py --run daily_scan
# Enable/disable job
python3 helpers/scheduler.py --enable daily_scan
python3 helpers/scheduler.py --disable daily_scan
# Remove job
python3 helpers/scheduler.py --remove daily_scan
Job Options
| Option | Description | Values |
|---|---|---|
--schedule | When to run | hourly, daily, nightly, weekly, monthly, or cron expression |
--scan-type | Type of scan | quick (ARP), full (ports), arp |
--notify | Email for alerts | email@example.com |
--notify-on | When to notify | always, changes, new_devices, never |
--format | Report format | json, csv, html |
Notification Options
# Always send email after scan
python3 helpers/scheduler.py --create scan1 --schedule daily \
--notify admin@company.com --notify-on always
# Only notify when network changes detected
python3 helpers/scheduler.py --create scan2 --schedule hourly \
--notify security@company.com --notify-on changes
# Only notify on new devices
python3 helpers/scheduler.py --create scan3 --schedule daily \
--notify alerts@company.com --notify-on new_devices
Platform Integration
macOS (launchd)
Jobs are installed as LaunchAgents:
# Job plist location
~/Library/LaunchAgents/com.netscan.daily_scan.plist
# View installed jobs
launchctl list | grep netscan
# Manual control
launchctl load ~/Library/LaunchAgents/com.netscan.daily_scan.plist
launchctl unload ~/Library/LaunchAgents/com.netscan.daily_scan.plist
Linux (cron)
Jobs are added to user crontab:
# View scheduled jobs
crontab -l | grep netscan
# Manual edit
crontab -e
Scan Results
Scheduled scans save results to:
~/.netscan/scheduled_scans/
├── daily_scan_20260106_090000.json
├── daily_scan_20260107_090000.json
└── hourly_check_20260106_140000.json
Sample Job List
Name Schedule Type Status Last Run
--------------------------------------------------------------------------------
daily_scan daily quick Enabled 2026-01-06 09:00
hourly_check hourly quick Enabled 2026-01-06 14:00
weekly_audit weekly full Enabled 2026-01-05 09:00
security_scan 0 2 * * 0 full Disabled Never
Python API
from helpers.scheduler import ScheduleManager
# Create manager
mgr = ScheduleManager()
# Create job
job = mgr.create_job(
name="my_scan",
schedule="daily",
scan_type="quick",
notify_email="admin@company.com",
notify_on="changes"
)
# List jobs
for job in mgr.list_jobs():
print(f"{job.name}: {job.schedule} ({job.enabled})")
# Run job manually
mgr.run_job("my_scan")
# Remove job
mgr.remove_job("my_scan")
💡 Tip: For production environments, use
nightly schedule for comprehensive scans and hourly for quick change detection.