Skip to content

Commands

m4bwav edited this page Nov 21, 2026 · 2 revisions

sw.py is read-only and never prints a secret in full. Exit code 1 means findings for repo, device (a FIX line) and pwned (the password was found) and, from 0.1.2, gh (any line marked <- WARN; before 0.1.2 gh always exited 0). Exit code 2 means a bad argument (argparse, or an unknown incident name). Outputs below are from v0.1.0 unless a section says otherwise.

repo

sw.py repo PATH [--json]

Scans every added line in the whole history (git log -p --all) and the repository's .github/workflows files. A test repository with one commit adding TOKEN = "ghp_..." to config.py:

engine: builtin  findings: 2
  github-token           a4953b46a670 config.py ghp_******e5
  generic-assignment     a4953b46a670 config.py ghp_******e5
note: built-in rules are a floor; install gitleaks (winget install gitleaks) for full coverage

Exit code 1. With --json:

{
 "engine": "builtin",
 "findings": [
  {
   "rule": "github-token",
   "commit": "a4953b46a670",
   "file": "config.py",
   "match": "ghp_******e5"
  },
  {
   "rule": "generic-assignment",
   "commit": "a4953b46a670",
   "file": "config.py",
   "match": "ghp_******e5"
  }
 ]
}

A path that is not a git repository exits with not a git repo: PATH. Rules, masking and the gitleaks route: Secret scanning.

gh

sw.py gh OWNER/REPO [--json]
sw.py gh OWNER [--json]

Calls gh api for each repository (an owner name lists its non-archived repositories through gh repo list). It reports vulnerability alerts, Dependabot alerts, secret scanning, branch protection, rulesets, the default workflow token permission and whether Actions requires SHA-pinned actions. The run against this repository on 2026-11-21, after secret scanning, push protection and Dependabot alerts were switched on (v0.1.2, exit code 0):

m4bwav/shieldwright
  vulnerability_alerts   on
  dependabot_alerts      on (0 open)
  secret_scanning        on (0 open)
  branch_protection      unknown
  rulesets               none
  workflow_token         read
  sha_pinning_required   False
unavailable = needs a paid plan or a public repo; off = can be switched on in Settings

A setting marked <- WARN needs attention: vulnerability alerts, Dependabot alerts or secret scanning off, open alerts, or workflow_token write. From 0.1.2 any WARN makes gh exit 1 (0.1.0 and 0.1.1 exited 0 whatever they found and did not mark these settings). Without the gh CLI it stops with gh CLI not found.

device

sw.py device [--json]

Windows only, no admin needed. Checks Defender real-time protection, signature age and tamper protection, the firewall profiles, the last Windows update, drive encryption (BitLocker), UAC, the SMB1 server and Remote Desktop. ok passes, FIX fails, ?? could not be read. One run on Windows 11 Home:

Microsoft Windows 11 Home
  ok  defender realtime        True
  ok  defender signatures age  0 days
  ok  tamper protection        True
  ok  firewall                 all profiles on
  ok  last Windows update      2026-11-21
  ??  drive encryption         not available
  ok  UAC                      on
  ok  SMB1 server              off
  ok  remote desktop           off

Windows Home has no BitLocker management, hence ?? there.

pwned

sw.py pwned

Reads the password from a hidden prompt (never an argument, so it stays out of shell history), hashes it with SHA-1 and sends only the first 5 hex characters to the Pwned Passwords range API. The request asks for padding, so the response size does not hint at the prefix. The match is made on your machine. It prints seen N times in breaches - change it everywhere it is used (exit 1) or not found in Pwned Passwords (exit 0). Not run for this page: it needs a typed password.

incident

sw.py incident [NAME]

With no name it lists the playbooks; an unknown name prints the same list and exits 2.

incidents: token-in-commit, clicked-link, account-taken-over, lost-phone, ransom-note, sextortion-email

Every playbook: Incident playbooks.

Clone this wiki locally