summaryrefslogtreecommitdiffstats
path: root/hacking.py
blob: 4a04ac0c76f04bdfe1ef14f5310e7757865a70f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
#
# Template script to probe lowlevel accesses on hardware.
# Might be useful for reverse engineering.
#

import sys
import usb


# XXX: Set the USB ID of your device here
vendor = 0x1532
product = 0x0007


def doStuff(dev):
	h = dev.open()
	h.claimInterface(dev.configurations[0].interfaces[0][0].interfaceNumber)

	try:
		# XXX: Add the operations here
		pass
	except usb.USBError, e:
		print e

	h.releaseInterface()

for bus in usb.busses():
	for dev in bus.devices:
		if dev.idProduct == product and dev.idVendor == vendor:
			doStuff(dev)
			break
bues.ch cgit interface