forked from x64x6a/PyBadUSB
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinux_checkinfo.py
More file actions
30 lines (25 loc) · 795 Bytes
/
Copy pathlinux_checkinfo.py
File metadata and controls
30 lines (25 loc) · 795 Bytes
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
'''
This script could be used to check a USB device's chipset on Linux.
It should work if the device is Phison.
It may not work if the device is BadUSB'd
'''
import sys
from pybadusb import badusb, phison
def print_info(device):
info = "Chip type: %04X\n" % device.chip_type
info += "Chip ID: %s\n" % device.chip_id
info += "Version: %d.%d.%d\n" % device.version
info += "Mode: %s\n" % device.run_mode
print info
if __name__ == '__main__':
# default path to scsi device is /dev/sg2
device_path = '/dev/sg2' if len(sys.argv) < 2 else sys.argv[1]
device = badusb.get_device(phison.Phison2303, device_path)
if not device:
print "Device not found"
elif not device.get_info():
print "Failed getting info"
device.close()
else:
print_info(device)
device.close()