-
Notifications
You must be signed in to change notification settings - Fork 0
Shared Library and Testing
Sourced by every script in this toolkit - never executed directly.
. "$(dirname "$0")/lib/common.sh"
What it provides:
-
say/err/die- consistent console output and fatal-error exit. -
cfg_get/cfg_set/cfg_del- a config store wrapping the officialPAYLOAD_*_CONFIGDuckyScript commands. -
confirm/ask- interactive yes/no and free-text prompts. -
need_arg-set -u-safe "this flag needs a value" argument parsing. -
print_help- reads the calling script's own leading comment header and prints it as--helpoutput. This is why every script's--helptext in this wiki is guaranteed accurate: it's not hand-maintained documentation that can drift, it's literally what the script prints on the real device when you run it with-h. -
pid_running(PIDFILE, NAME_PATTERN)- the shared PID-reuse-safe process-liveness check used by every script that tracks a background job. Checks/proc/$PID/cmdlineagainstNAME_PATTERNbefore trusting a PID file's contents, so a reused PID can't be mistaken for the process that originally wrote the file. -
canonicalize_lan_topology(DESIRED, BRIDGE_NAME)- the shared reconciler that keepseth0correctly placed inbr-lan(or correctly handed off to a bridge), used by bothsniff.shandreset.sh. -
filter_yes_args,is_valid_mac,sql_escape,resolve_python3, and several other small helpers - see the file itself for the full list, each documented at its own definition.
The vendored deadnet core tool
(trimmed to just the ~30KB engine, not its own CLI wrapper) that
deadnet.sh drives directly.
The optional local web Control Panel - server.py is a thin HTTP backend
that shells out to the same scripts documented in this wiki (nothing it
does bypasses the official commands underneath), gated by an
ALLOWED_SCRIPTS allowlist and a token set during python setup.py.
Binds only to br-lan, never the internet-facing uplink. Start/stop it
with webui.sh. Not the main focus of
this project - most work happens over SSH and payloads.
Standalone, offline regression checks - no real device, no real network hardware needed. Each extracts the actual pure-logic functions straight out of the live source (not a hand-copied duplicate) and feeds them synthetic input.
| Suite | Covers | Passing |
|---|---|---|
test_sniff_logic.sh |
sniff.sh's argument validation, block-boundary parsing, protocol classification, the credential/HTTP detection regexes, and the shared PID-reuse-guard helpers |
56 |
test_payload_logic.sh |
lan_sniffer/payload.sh's progress-bar rendering and duration-picker parsing |
12 |
test_common_logic.sh |
lib/common.sh's canonicalize_lan_topology() and eth0_in_br_lan()
|
7 |
Run any of them directly:
bash scripts/tests/test_sniff_logic.sh
Each suite was spot-verified at least once by deliberately breaking the behavior it covers, confirming the test fails, then restoring the fix - so they're not just checking that the code runs, they're checking that breaking the real bug they were written for actually gets caught.