Skip to content

Instantly share code, notes, and snippets.

View darthcloud's full-sized avatar
🎮

Jacques Gagnon darthcloud

🎮
View GitHub Profile
#!/usr/bin/env python
import sys
from scapy.utils import rdpcap
from scapy.packet import Raw
from scapy.layers.bluetooth import L2CAP_Hdr
from statistics import mean, stdev
def get_hid_pkt_intervals(packets):
prev = 0
@darthcloud
darthcloud / xb1_adaptive_hid_descriptor
Created June 21, 2020 19:09
Xbox One adaptive controller HID descriptor
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x05, // Usage (Game Pad)
0xA1, 0x01, // Collection (Application)
0x85, 0x01, // Report ID (1)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x15, 0x00, // Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00, // Logical Maximum (65534)
@darthcloud
darthcloud / blueretro_log_wiiupro_page.txt
Created May 30, 2020 14:16
BlueRetro log with H4 packet dump WiiU Pro controller
# bt_hci_cmd_reset
O 000000 01 03 0C 00
I 000000 04 0E 04 05 03 0C 00
# BT_HCI_EVT_CMD_COMPLETE
# bt_hci_cmd_read_local_features
O 000000 01 03 10 00
I 000000 04 0E 0C 05 03 10 00 BF EE CD FE DB FF 7B 87
# BT_HCI_EVT_CMD_COMPLETE
# bt_hci_cmd_read_local_version_info
O 000000 01 01 10 00
@darthcloud
darthcloud / h4bin2txt.py
Created May 29, 2020 12:21
Bluetooth H4 raw binary trace to Wireshark's text2pcap
#!/usr/bin/env python3
import sys
with open(sys.argv[1], "rb") as f:
byte = f.read(1)
while byte:
if int(byte[0]) == 0x01:
byte += f.read(3)
byte += f.read(int(byte[3]))