{"id":50301914,"url":"https://github.com/circle-rd/hid-shell","last_synced_at":"2026-05-28T13:08:37.469Z","repository":{"id":359234826,"uuid":"1245129006","full_name":"circle-rd/hid-shell","owner":"circle-rd","description":"Vandal HID Shell","archived":false,"fork":false,"pushed_at":"2026-05-21T06:20:46.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-21T06:52:44.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/circle-rd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-21T00:06:16.000Z","updated_at":"2026-05-21T06:20:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/circle-rd/hid-shell","commit_stats":null,"previous_names":["circle-rd/hid-shell"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/circle-rd/hid-shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circle-rd%2Fhid-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circle-rd%2Fhid-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circle-rd%2Fhid-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circle-rd%2Fhid-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/circle-rd","download_url":"https://codeload.github.com/circle-rd/hid-shell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circle-rd%2Fhid-shell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33609429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-28T13:08:35.803Z","updated_at":"2026-05-28T13:08:37.462Z","avatar_url":"https://github.com/circle-rd.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HID-Shell\n\nCross-platform raw-HID shell payload for the [Vandal](../Vandal) ESP32 agent.\n\nOnce launched on a host that has a Vandal device plugged in over USB, this\nsingle binary:\n\n1. Enumerates HID devices matching Vandal's VID/PID and the vendor usage\n   page `0xFF00`.\n2. Opens the vendor interface (instance 1 of the composite USB device).\n3. Sends a `HELLO` and spawns a persistent OS shell (`cmd.exe` on Windows,\n   `/bin/sh -i` elsewhere).\n4. Pumps stdin/stdout bytes between the shell and the agent in 64-byte\n   raw HID reports until the agent sends `BYE`, the USB device is\n   unplugged, or the process is killed.\n\nThe wire protocol is documented in [docs/PROTOCOL.md](docs/PROTOCOL.md).\n\n## Download pre-built binaries\n\nEach tagged [GitHub Release](../../releases) ships the three\ncross-compiled payloads as assets, plus a `SHA256SUMS` manifest and a\ngenerated `RELEASE_NOTES.md` describing the deployment procedure:\n\n| Asset                              | Target              | Rename to (agent `/payloads/`) |\n| ---------------------------------- | ------------------- | ------------------------------ |\n| `hid_shell-linux-x86_64`           | Linux x86_64        | `sl`                           |\n| `hid_shell-macos-arm64`            | macOS arm64         | `sm`                           |\n| `hid_shell-windows-x86_64.exe`     | Windows x86_64      | `sw.exe`                       |\n\nVerify and rename in one go:\n\n```sh\nsha256sum -c SHA256SUMS\nmv hid_shell-linux-x86_64       sl\nmv hid_shell-macos-arm64        sm\nmv hid_shell-windows-x86_64.exe sw.exe\n```\n\nThen upload the three files to `/payloads/` on the Vandal agent via\nthe web UI (**BadUSB → File transfer**). One-time per agent — the\nbinaries persist on the FAT volume across reboots and the agent's\n*Shell* page handles the rest (Prepare → Start).\n\n## Build\n\n### Recommended: Docker cross-toolchain\n\nProduces all three release binaries from any machine with Docker\ninstalled — no need to set up Nim, Zig, mingw, or hidapi locally:\n\n```sh\n./scripts/docker-build.sh\n```\n\nThis builds the `hid-shell-builder` image (Debian + Nim 2.2.4 + Zig\n0.13.0 + mingw-w64 + statically-compiled hidapi for Linux and Windows),\nmounts the repo into the container, and runs `scripts/build_all.sh`.\nOutputs land in `dist/`:\n\n| Binary                          | Size  | Runtime dependencies on target |\n| ------------------------------- | ----- | -------------------------------- |\n| `hid_shell-linux-x86_64`        | ~96K  | `libudev` (systemd, universal), libc |\n| `hid_shell-windows-x86_64.exe`  | ~134K | `setupapi.dll`, `hid.dll` (Windows built-ins) |\n| `hid_shell-macos-arm64`         | ~135K | `libhidapi.dylib` — **requires `brew install hidapi` on the host** |\n\nFor an interactive shell inside the builder:\n\n```sh\n./scripts/docker-build.sh shell\n```\n\n### Local build\n\nRequires Nim ≥ 2.0 with `nimble`, and the system `hidapi` library:\n\n```sh\n# Debian/Ubuntu\nsudo apt install libhidapi-hidraw0\n# Fedora\nsudo dnf install hidapi\n# macOS\nbrew install hidapi\n# Windows: drop hidapi.dll next to the built .exe\n#   (https://github.com/libusb/hidapi/releases)\n```\n\nThen build the host-native binary only:\n\n```sh\nnimble buildRelease\n```\n\n## Fully autonomous macOS binary (no Homebrew)\n\nThe default Docker build leaves the macOS binary linked against\n`libhidapi.dylib` at runtime, because hidapi's macOS backend includes\n`\u003cIOKit/hid/IOHIDManager.h\u003e` — a header from Apple's Xcode SDK which is\n**not redistributable** and therefore cannot be baked into the public\nDocker image.\n\nIf you need a macOS binary that runs on a vanilla user host (no Homebrew,\nno hidapi package — the Starbucks-laptop scenario), build it on a\nmachine that already has the Apple SDK:\n\n### Option A — Build on a real macOS host\n\nOn any Mac with Xcode Command Line Tools:\n\n```sh\n# One-time: install Nim and hidapi sources (any Mac toolchain works)\nbrew install nim\ncurl -fsSL https://github.com/libusb/hidapi/archive/refs/tags/hidapi-0.14.0.tar.gz \\\n    | tar -xz -C /tmp\ncd /tmp/hidapi-hidapi-0.14.0\nclang -c -O2 -arch arm64 -I hidapi mac/hid.c -o /tmp/hid-mac.o\nar rcs /tmp/libhidapi.a /tmp/hid-mac.o\n\n# Build the static payload\ncd /path/to/HID-Shell\nnim c -d:release -d:strip -d:hidapiStatic \\\n    --opt:size --threads:on \\\n    --cpu:arm64 --os:macosx --cc:clang \\\n    --passL:\"/tmp/libhidapi.a -framework IOKit -framework CoreFoundation -framework AppKit\" \\\n    --out:dist/hid_shell-macos-arm64 src/hid_shell.nim\n```\n\nThe resulting binary depends only on macOS system frameworks (always\npresent) and runs on any macOS ≥ 11 arm64 host with nothing installed.\n\n### Option B — `osxcross` inside the Docker image\n\nFor fully reproducible CI, extend `Dockerfile` with\n[osxcross](https://github.com/tpoechtrager/osxcross) and a manually\ndownloaded Xcode `MacOSX*.sdk.tar.xz` (Apple license forbids us from\ndistributing it). Once `o64-clang` is in PATH, the static build line\nabove works inside the container too. This is left out of the default\nimage deliberately — each developer must accept Apple's SDK license\nthemselves.\n\nNative compilation per platform is otherwise preferred. Cross-compilation\nworks but each target needs the corresponding `hidapi` static library\navailable to the linker.\n\n## Run manually\n\n```sh\n./hid_shell                # auto-detect device, headless\n./hid_shell --debug        # log to stderr for development\n```\n\nIn the standard deployment the binary is **not** invoked by hand: the\nVandal universal launcher\n(`vandal-react/server/scripts/badusb/library/extensions/shell_launcher.txt`)\nis injected as HID keystrokes by the agent, which then exec's the\nmatching `/payloads/sl|sm|sw.exe` silently (no terminal window on any\nOS).\n\n## Headless contract\n\n- Windows: built with `--app:gui` so no console window is allocated.\n- POSIX: the launcher uses `nohup` + `setsid`, and the payload itself\n  does not write to stdout/stderr unless `--debug` is passed.\n- All shell I/O travels over HID; nothing is written to disk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircle-rd%2Fhid-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcircle-rd%2Fhid-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircle-rd%2Fhid-shell/lists"}