Skip to content

Repository files navigation

Glamdring — Foe-hammer

Active defense for public / unsecured Wi-Fi. Glamdring is the sword that glowed blue when orcs drew near. This one watches an open network for the classic attacks, hardens your laptop so you can use that network with mitigated risk, and reacts to attackers — inside your own boundary, fast and disruptively, but without ever hacking back.

   ⚔  detect  ·  deceive  ·  tarpit  ·  contain  ·  harden

The one rule that shapes everything: no hack-back

Glamdring defends inside its own boundary only. It detects, deceives, tarpits, hardens, and blocks — on this host and this link. It never attacks, floods, damages, or exploits a remote machine, including an attacker's.

That is a deliberate design constraint, not a missing feature. "Hacking back" — launching a destructive or disruptive attack at whoever attacked you — is a crime under the U.S. Computer Fraud and Abuse Act, the UK Computer Misuse Act, and equivalents worldwide, even when you were the victim first. So the codebase makes offense unrepresentable: every response action is tagged SELF_HOST or NETWORK_EDGE, there is no REMOTE boundary, and the policy engine rejects anything else (glamdring/response/policy.py).

What you get instead is aggressive, legal disruption:

You might want to… Glamdring does this instead (legal, effective)
"shut the attacker down fast" Tarpit — hangs their scanner/automation on our own sockets
"cut them off" Local firewall blackhole of the attacker at your edge
"get me off this bad network" Auto-disconnect your Wi-Fi radio on a critical attack
"trap the AI scraping me" AI tarpit maze — an endless deception maze that burns their compute
"stop the MITM" ARP pinning — nail the real gateway MAC so forged replies are ignored

Tarpitting is the honest version of "highly disruptive and rapidly destructive": it destroys the attacker's throughput and worker threads by making them wait on you — all on hardware you own.


Threat model — open Wi-Fi

On an unsecured network, anyone else connected can attempt:

  • ARP spoofing / MITM — reroute your traffic through them
  • Evil twin / rogue AP — clone the SSID to lure you off the real AP
  • Rogue DHCP — hand you a poisoned gateway/DNS
  • DNS spoofing / hijack — send you to the wrong server
  • Deauth floods — kick you off (often to push you onto an evil twin)
  • LLMNR / mDNS / NBT-NS poisoning (Responder) — harvest your credentials
  • Port scanning / recon — find something on your laptop to exploit
  • AI/automated crawling & scraping of anything you expose

Glamdring has a sensor for each, a honeypot to catch what the sensors miss, and a hardening auditor to shrink the attack surface before any of it starts.


Install

macOS app (Apple Silicon) — via Homebrew:

brew install --cask cloud-dance/tap/glamdring

or grab Glamdring-macos-arm64.tar.gz from the latest release and drop Glamdring.app into /Applications. The app is not yet notarized — on first launch, right-click → Open. Requires Python 3.11+ on the machine.

From source (any OS):

# core (stdlib only — runs anywhere, in simulation mode)
pip install -e .

# with live layer-2 capture (needs root at runtime) and the nicer extras
pip install -e '.[full]'

Requires Python 3.11+. Live capture uses scapy; without it (or without root) Glamdring runs in simulation mode, replaying a realistic attack timeline through the exact same detection code — so you can see the whole thing work with no special privileges.


Quick start

glamdring doctor                 # what's available on this machine?
glamdring posture                # audit & score THIS laptop's hardening
glamdring watch --sim            # see the full defense against a simulated attacker
glamdring watch --dashboard      # live TUI (auto: live capture if root+scapy, else sim)

Commands

Command What it does
glamdring app Launch the desktop app — a local web dashboard with a Wi-Fi connect panel and live, native alerts on scans / intrusions / blocks. Same flags as watch (--sim, --live, --response, --apply) plus --port, --no-browser, --no-sound.
glamdring watch Run the full defense: sensors + honeypot + tarpit + responder. --sim forces simulation, --live forces capture (needs sudo), --response {observe,contain,aggressive}, --apply to enact (default is dry-run), --dashboard, --duration N.
glamdring posture (audit) Read-only hardening audit + score + "script-kiddie resistant?" verdict. --json for machine output.
glamdring harden Show the fixes that close your gaps. --apply executes the scriptable ones (asks first; --yes to skip).
glamdring honeypot Run only the decoy services + tarpit + AI maze.
glamdring report Summarize the recorded evidence log.
glamdring doctor Capability check (root, scapy, interface, gateway, SSID).
glamdring version Version + the legal-boundary statement.

The desktop app (GUI + app icon)

If you'd rather not live in a terminal, Glamdring ships a real laptop app:

glamdring app            # opens the dashboard in your browser (auto: sim if no root)
glamdring app --live     # live capture (sudo); --apply to actually enact blocks

It boots the same engine behind a small loopback-only web server (127.0.0.1, never routable off your machine) and opens a live dashboard:

  • a Wi-Fi panel that scans for networks in range, flags the open / unsecured ones, and lets you join one with a click (open networks only — the app never handles passwords; join a secured network from macOS settings);
  • three big live counters and a colour-coded feed for exactly the three things you asked to be told about — Wi-Fi scans, intrusion attempts, and Glamdring's own blocking actions;
  • interactive controls: stop / restart the simulated attacker, clear the feed, and scan / join open networks (the native app requests Location so it can enumerate nearby Wi-Fi);
  • native desktop notifications for each of those three categories, so you get pinged even when the window isn't focused;
  • posture score, honeypot activity, and locally-blocked attackers at a glance.

Build the native app (real Dock app, shipped as a binary tarball)

bash packaging/build_macos_app.sh

This produces a genuine native macOS app and packages it as a binary tarball:

  • renders the app icon (a glowing blue blade — the sword that lit up when foes drew near) with a pure-standard-library PNG generator → .icns via sips + iconutil;
  • compiles a small Objective-C / AppKit + WKWebView shell (clang) into a native arm64 Mach-O — this is the app: a foreground process with a real Dock tile, window, menu, and Cmd-Q;
  • embeds the stdlib-only engine, which the shell launches as a subprocess and shows in the WKWebView (reading the loopback URL + token from its stdout);
  • ad-hoc codesigns the bundle and writes dist/Glamdring.app + dist/Glamdring-macos-arm64.tar.gz.

Install it like any Mac app:

tar -xzf dist/Glamdring-macos-arm64.tar.gz
mv Glamdring.app /Applications/
open /Applications/Glamdring.app

Because it's a real foreground app, you can right-click its Dock icon → Options → Keep in Dock to pin it permanently. Runtime needs Python 3.11+ on the machine (the stdlib-only engine — no pip install). Logs go to ~/.glamdring/app.log.

Why a native shell instead of just opening a browser: a headless process that only serves a web page doesn't get a proper Dock tile. The AppKit binary is a first-class app, so the blade icon lives in the Dock and stays pinned.

Scanning on modern macOS (Sonoma/Sequoia) is gated behind Location Services, and the grant is tied to the process that holds it. The native app therefore scans in-process via CoreWLAN — the same process it requested Location for — and hands the full nearby-network list to the engine, so the Wi-Fi panel lists every network in range (open ones flagged) rather than just the one you're on. On first launch, click Allow on the Location prompt (or grant it later under System Settings → Privacy & Security → Location Services). Until then — and for the plain glamdring app CLI, which has no native shell — it degrades gracefully to showing your current network.


The core idea: use the open network with mitigated risk

You asked for the real goal — use public Wi-Fi without much risk of being hacked — accepting that risk is never zero, but mitigating it so that only a skilled, determined adversary (not a script kiddie) could get through.

glamdring posture is that tool. It audits your laptop read-only and scores it:

HOST & WI-FI POSTURE
============================================================
Score: 88/100   Grade: HARDENED
Script-kiddie resistant: YES

A casual attacker on this network has no easy way in — defeating this posture
would take a skilled, determined adversary. Residual risk is not zero, but it is
well mitigated.

It checks (and glamdring harden closes) the things that matter on an open network: the application firewall + stealth mode, exposed services (SSH, SMB/AFP, Screen Sharing), any other network-reachable listening ports, DNS privacy, VPN presence, Wi-Fi MAC randomization & auto-join, System Integrity Protection, and FileVault. Passing the baseline set is what moves you out of easy reach.

Hardening never changes a setting on its own: audit is read-only, and harden --apply shows the exact commands and asks before running them.


How the pieces fit

            ┌─────────── sensors ───────────┐
 wire ────► arp · dhcp · dns · deauth ·      │      ┌── honeypot ──┐
 (scapy or  evil_twin · llmnr · portscan     │      │ decoy ports  │
  sim) ────►         │  Frame                │      │  + tarpit    │
                     ▼                        │      │  + AI maze   │
                 ┌───────────┐   Event        │      └──────┬──────┘
                 │ EventBus  │◄───────────────┴─────────────┘
                 └─────┬─────┘
        ┌──────────────┼───────────────┬───────────────┐
        ▼              ▼               ▼                ▼
   Responder       Notifier         Recorder        Dashboard
 (policy →         (desktop +     (evidence log,     (live TUI)
  contained         console)       incident report)
  actions)
        │
        ▼  contained only: local firewall · ARP pin · tarpit · Wi-Fi off

Everything communicates through a thread-safe EventBus. Sensors emit Events; the Responder runs each through the ResponsePolicy and enacts only boundary-safe actions; Notifier, Recorder, and Dashboard observe.

Response modes

  • observe — detect and alert only; never touches the host.
  • contain (default) — observe + blackhole the attacker at your local firewall + pin the gateway ARP + flag them for the tarpit.
  • aggressive — contain + enables the auto Wi-Fi disconnect capability. The disconnect itself is a separate opt-in (response.auto_disconnect = true), off by default so a spoofed "critical" event can't be used to knock you off your own network; when enabled it fires on a CRITICAL attack.

All response actions are dry-run by default; pass --apply (and, for firewall/ARP changes, run as root) to actually enact them.

Two safety invariants are enforced in code and covered by tests:

  1. Only IPs proven real by a completed TCP handshake to us (honeypot / AI tarpit / canary hits) are ever auto-blocked. Packet-based detections (ARP/DNS/DHCP/LLMNR/port-scan) carry forgeable source IPs, so they alert, tarpit-flag, and (for ARP) pin the gateway — but never drive a by-IP block. This prevents both self-DoS and being weaponized to blackhole a third party.
  2. The gateway and your own host are never blocked, resolved independently of any sensor so the guard holds even if detection is misconfigured.

Live capture (real deployment)

sudo -E glamdring watch --live --dashboard --response contain

Live layer-2 detection (ARP/DHCP/DNS/deauth/evil-twin) needs scapy and root; 802.11 management-frame sensors (deauth, evil twin) additionally need the interface in monitor mode. To arm real firewall enforcement once, Glamdring prints the exact pf anchor setup on exit.


Development

pip install -e '.[dev]'
pytest -q

The test suite covers every sensor, the scoring logic, the honeypot fingerprinter, and — most importantly — the safety invariants: the gateway is never blocked, offensive actions are unrepresentable, and observe mode changes nothing.


What Glamdring deliberately does not do

  • It does not attack, DoS, exploit, or deploy anything to a remote host.
  • It does not require you to trust a cloud service — everything runs locally and the evidence log never leaves your machine.
  • It does not promise zero risk. It promises to raise the bar high enough that getting past it takes a real professional, and to tell you loudly when someone is trying.

License

AGPL-3.0-or-later. Free to use, study, modify, and share; if you run a modified Glamdring for others over a network, you must offer them the source. For commercial licensing outside AGPL terms, contact scotch@thot.ai.

About

⚔ Foe-hammer: active defense for public Wi-Fi — detect, deceive, tarpit, harden. No hack-back, by design.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages