Skip to content

Instantly share code, notes, and snippets.

View z4yx's full-sized avatar
☢️

Yuxiang Zhang z4yx

☢️
View GitHub Profile
> fido2-token -d -D -i rrA4hJfIw9N1wVfucgaYrHh4vocK2PGqmTcvrF20W1Q= /dev/hidraw3
fido_tx: dev=0x557fa4b6d260, cmd=0x06
fido_tx: buf=0x557fa4b6d260, len=8
0000: 93 e2 5c 8c 88 03 96 3f
fido_rx: dev=0x557fa4b6d260, cmd=0x06, ms=-1
rx_preamble: buf=0x7fffc3bb0fd0, len=64
0000: ff ff ff ff 86 00 11 93 e2 5c 8c 88 03 96 3f 72
0016: f1 23 1b 02 01 00 00 04 00 00 00 00 00 00 00 00
0032: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
//libusb+ch340 data transfer demo
//gcc usb.c `pkg-config libusb-1.0 --libs --cflags` -o usb
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/select.h>
@z4yx
z4yx / u2f_fido2_dissector.lua
Last active November 18, 2023 05:44
Wireshark protocol decoder for FIDO(U2F) and FIDO2(WebAuthn) over USB HID
cbor = Dissector.get("cbor")
iso7816 = Dissector.get("iso7816")
ctap_proto = Proto("ctaphid","ctap hid")
-- Field Extractor
direction_fe = Field.new("usb.endpoint_address.direction")
udp_srcport_fe = Field.new("udp.srcport")
CTAPHID_COMMAND_CODE = {
[0x03]='CTAPHID_MSG',
[0x10]='CTAPHID_CBOR',