惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
Last Week in AI
Last Week in AI
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
The Cloudflare Blog
罗磊的独立博客
月光博客
月光博客
N
Netflix TechBlog - Medium
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
Jina AI
Jina AI
J
Java Code Geeks

Show HN

Show HN: AI agents for UK GDAD PCF roles and their skills The Two Pillars: Mixer Mode and Meta-Software in the Reorganization of Software Work After AI GitHub - JaiCode08/teleport-env What 1,000+ Harness Experiments Taught Me About Self-Improving Agents Show HN: Liiists, a Markdown-first, iOS and CLI list app SwiperTab – Get this Extension for 🦊 Firefox (en-US) GitHub - kouhxp/fftext: Summarize, explain, fact-check, or translate any text, URL, or file. No GPU. No cloud. One command GitHub - sweetpad-dev/sweetpad: Develop Swift/iOS projects using VSCode GitHub - dogmaticdev/IRON: IRON a.k.a. Intermediate Representation Object Notation is a Interpreter/Database that is used to create Programming Languages. GitHub - sjhalani7/vaen: Package your AI coding harness into a portable .agent file, and share it across repos, teams, & the community without ever having to copy-paste instructions, skills, MCP config, or secrets. Show HN: Gandalf the Grader Show HN: Citadeld – replay any CI failure locally from a single file GitHub - tdortman/cuSBF: High-Performance GPU Super Bloom Filter coral-ai/claude-code-token-xray at main · Coral-Bricks-AI/coral-ai GitHub - ulyssestenn/funes: Funes is a Git-based framework for LLM-managed knowledge work: an AI Librarian ingests raw sources, builds an interlinked Markdown knowledge base, and uses it to produce cited reports, analyses, and other outputs. GitHub - ThatXliner/gah: Git Add Hunk, built for agents to use GitHub - harmont-dev/harmont-cli: Command-line client for the Harmont CI platform GitHub - brooksmcmillin/mcp-authflow: OAuth 2.0 Authorization Server framework for MCP servers GitHub - javaid-codes/audit-supply-chain-agents GitHub - amorey/gochan: A small library of common channel architectures for Go, inspired by Rust GitHub - arifozgun/OpenGem: Free, Open-Source AI API Gateway with Gemini, OpenAI & Anthropic Compatibility in 1 file GitHub - Pranesh950/BioPetals: 🌸 Run BIOxAI models at home, BitTorrent-style. Fine-tuning and inference up to 10x faster than offloading GitHub - cnguyen14/bounty-doctor: Diagnose a GitHub bounty issue before you waste hours: detects honeypot scam repos, AI-bot attempt swarms, and stale contests. Show HN: CoreMCP – MCP Server for On-Prem DBs Show HN: KittyHTML – Render HTML/CSS as an inline image in your terminal GitHub - bingud/filemat: Web-based file manager Show HN: TruthLens – Free multi-signal deepfake image detector GitHub - apexlocal-jz/claude-usage-tray: Windows system-tray app showing your Claude Code rate-limit usage at a glance. Zero deps, ~300 lines of PowerShell. Cross-IDE (works regardless of VS Code, Cursor, plain terminal). Release v0.1.2.1 · kouhxp/yapsnap GitHub - noopolis/moltnet: Self-hostable chat network for AI agents. Pre-built bridges for Claude Code, Codex, and the Claws. Rooms, DMs, history. No Slack bots, no Matrix, no glue code.
GitHub - yeet-src/usbsnoop: Live, system-wide USB transfe...
r3tr0 · 2026-05-31 · via Show HN

usbsnoop demo

A real-time, colorized feed of USB traffic system-wide — built on the two universal URB chokepoints every host-controller driver funnels through, so it works on xHCI/EHCI/OHCI/dwc alike with no per-controller tracepoints and no usbmon. Fully CO-RE portable.

fentry hook what it tells us
usb_submit_urb a transfer was queued (device, endpoint, type, payload)
usb_hcd_giveback_urb it completed (status, bytes moved, latency, payload)

An lru_hash keyed by the URB pointer stitches the two together: submit stamps a start time, completion reads it back for the submit→complete latency, then deletes it. This mirrors httpbody's request/response pairing — SUBMIT is the "request" (what the host sends), COMPLETE the "response" (what the device returns).

Control transfers get their 8-byte SETUP packet decoded into the standard request name (GET_DESCRIPTOR, SET_CONFIGURATION, …); data stages render as text when they look textual and as a hexdump otherwise.

Output is one line per event (compact). The first time a device appears it gets a legend line (bus-dev, vid:pid, product, link speed); after that each row carries only the short DEV tag, so the left-hand columns stay aligned and scannable under heavy traffic. Each row shows time, kind (SUBMIT/CMPLT), transfer type, epNdir, the direction arrow ( device→host IN, host→device OUT), byte counts, status, latency, and the owning kernel driver, then a · and the most useful detail (decoded SETUP, SCSI command, or a short payload preview). Pass --hex for the full multi-line hexdump instead. Hex bytes are colored by value class (null blue, printable ASCII cyan, whitespace green, other control magenta, high/non-ASCII yellow) on a TTY; piped output is plain.

Use cases

  • Reverse-engineering peripherals — watch a device enumerate and exchange vendor control requests and HID reports live, no hardware sniffer or usbmon setup. SETUP packets and payloads are decoded as you poke at the device.
  • Driver / firmware debugging — see exactly which commands your driver or app sends a device and what comes back, with submit→complete latency on every transfer.
  • Mass-storage / SCSI inspection — Bulk-Only Transport wrappers decode to the SCSI command (READ(10) lba=… blocks=…, WRITE(10), CSW PASS/FAIL).
  • Catching errors--errors-only surfaces stalls (EPIPE), timeouts, babble, and CRC errors across every device at once.
  • Spotting rogue devices — a freshly plugged device shows what it does the instant it attaches; BadUSB-style HID injection surfaces as INT reports or SET_REPORT control writes you didn't trigger.
  • Capture for offline analysis--json emits NDJSON; pipe to jq or a file to diff payloads across runs.
  • Performance triage — on a timed exit you get a per-device rollup and a log2 latency histogram to find the slow or chatty devices.

Install

curl -fsSL https://yeet.cx | sh

Then run it straight from GitHub — yeet fetches the example and builds it for you, no clone needed:

yeet run github:yeet-src/usbsnoop

Build

To build from a local checkout instead:

Dumps the kernel's BTF to vmlinux.h (for struct urb, usb_device, and the device descriptor), then compiles. Requires clang, bpftool, and a kernel with BTF.

Run

yeet run .                              # all devices, runs until Ctrl-C
yeet run . -- --secs 30                 # stop after 30s (prints a summary)
yeet run . -- --vid 0x320f              # one vendor
yeet run . -- --vendor-id 0x046d --product-id 0xc52b # one device by id
yeet run . -- --bus 3 --dev 4           # one device by bus address
yeet run . -- --type control,int        # only these transfer types
yeet run . -- --no-data                 # metadata only, skip payload capture
yeet run . -- --max-data 64             # cap rendered payload at 64 bytes
yeet run . -- --errors-only             # only failed completions (stalls, timeouts)
yeet run . -- --hex                      # full multi-line hexdump per transfer
yeet run . -- --json | jq .             # NDJSON, one object per event

Flags

flag default meaning
--secs forever how long to run; omit to run until Ctrl-C (a number stops + prints a summary)
--vid, --vendor-id any filter by vendor id (hex 0x1d6b or decimal)
--pid, --product-id any filter by product id
--bus any filter by bus number
--dev any filter by device address
--type all csv of iso, int, control, bulk
--no-data off don't read transfer buffers (metadata only)
--max-data 4096 max bytes of payload rendered per event
--errors-only off show only non-OK completions (skips SUBMIT and OK)
--hex off full multi-line hexdump per transfer (compact inline preview otherwise)
--json off emit NDJSON (one object per event) instead of the TTY view
--page-offset-base off kernel page_offset_base address (hex) — enables SG payload capture (x86-64)
--vmemmap-base off kernel vmemmap_base address (hex) — paired with --page-offset-base

All filtering happens kernel-side, so filtered-out traffic never reaches userspace.

Each event line ends with the owning kernel driver in brackets ([hid_irq_in], [usb_api_blocking_completion]) — urb->complete symbolized in-kernel via bpf_snprintf("%ps"), so no /proc/kallsyms lookup is needed. Mass-storage bulk transfers decode their Bulk-Only Transport wrapper into the SCSI command (CBW READ(10) lba=… blocks=… / CSW PASS). On a timed exit (reaching --secs) a per-device summary and a log2 latency histogram print; a Ctrl-C exit skips it (there is no JS-visible signal hook).

Scatter-gather payloads

Bulk traffic (mass storage and friends) often hands the stack a struct scatterlist array (urb->sg) instead of a single linear transfer_buffer, so the payload lives scattered across pages. usbsnoop walks that array and copies each segment's bytes, but reaching them means translating a page to its kernel virtual address — the inverse of x86-64's page_to_virt, which needs the running kernel's page_offset_base and vmemmap_base (both KASLR-randomized).

The JS isolate can't read /proc/kallsyms and the loader has no ksym support, so you pass the two symbol addresses in and the BPF side dereferences them:

yeet run . -- \
  --page-offset-base 0x$(sudo awk '$3=="page_offset_base"{print $1}' /proc/kallsyms) \
  --vmemmap-base     0x$(sudo awk '$3=="vmemmap_base"{print $1}'     /proc/kallsyms)

Without those flags, SG transfers still show full metadata, just no payload bytes — the prior behavior. This path is x86-64 only: on other arches leave the flags off.

Limits

  • Only the first 16384 bytes of each transfer are captured (a power of two — the verifier read-clamp depends on it). Larger buffers are truncated; the header still reports the true actual/requested length. Each ring record carries a full data[16384], so the 8 MiB ring holds ~512 events.
  • Scatter-gather payloads need the --page-offset-base / --vmemmap-base flags above and an x86-64 host; each segment is captured up to a page, and only the first 64 segments of a transfer are walked.
  • A transfer submitted before usbsnoop attached has no start stamp, so its completion shows no latency.
  • USB descriptors are little-endian and read directly — correct on the little-endian hosts BPF runs on.