A modular, colour-coded security sweep script for Windows home machines.
pip install -r requirements.txt
python security_sweep.py
python security_sweep.py --output json
python security_sweep.py --output txt
python security_sweep.py --only ports,firewall,logins
python security_sweep.py --disable packages,writable
| Flag | What it does | Severity range |
|---|---|---|
ports |
Scans listening ports, flags known-risky ones | MEDIUM / HIGH |
processes |
Lists processes, flags malware names and resource hogs | LOW – HIGH |
packages |
Checks pip + winget for outdated packages | LOW |
tasks |
Inspects scheduled tasks for suspicious paths / recent adds | MEDIUM / HIGH |
writable |
Finds world-writable files and directories | MEDIUM / HIGH |
logins |
Summarises failed login events from the Security event log | MEDIUM / HIGH |
firewall |
Reports firewall profile status and broad inbound rules | MEDIUM / HIGH |
| Colour | Level | Meaning |
|---|---|---|
| 🔴 Red | HIGH | Act immediately |
| 🟡 Yellow | MEDIUM | Review soon |
| 🔵 Cyan | LOW | Informational / low risk |
| 🟢 Green | INFO | All clear / normal finding |
Open the file and fill in the $Config block at the top:
SmtpUser/SmtpPassword— your email credentials
(For Gmail, generate an App Password at myaccount.google.com/apppasswords)EmailFrom/EmailTo— sender and recipient addresses
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
.\run_sweep.ps1 -RegisterThis creates a task that runs every Sunday at 08:00.
Change TaskTriggerDay and TaskTriggerTime in $Config to adjust.
.\run_sweep.ps1Or trigger via Task Scheduler:
Start-ScheduledTask -TaskName "WeeklySecuritySweep"The wrapper only sends an email when the sweep exits with code 1,
which happens only when HIGH severity findings are present.
No HIGH findings = no email noise.
- Run as Administrator for full access to the Security event log, firewall rules, and all process details.
- The world-writable scan is capped at 500 files per run to keep it fast. Increase
MAX_FILESinsecurity_sweep.pyfor deeper scans. wingetmust be installed for system package update checks (comes with Windows 10 1809+ / Windows 11).- The script exits with code
0(clean) or1(HIGH findings), making it easy to chain with other tools.