MCPcopy Index your code
hub / github.com/secdev/scapy / USBpcap

Class USBpcap

scapy/layers/usb.py:80–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79
80class USBpcap(Packet):
81 name = "USBpcap URB"
82 fields_desc = [ByteField("headerLen", None),
83 ByteField("res", 0),
84 XLELongField("irpId", 0),
85 LEIntEnumField("usbd_status", 0x0, _usbd_status_codes),
86 LEShortEnumField("function", 0, _urb_functions),
87 XByteField("info", 0),
88 LEShortField("bus", 0),
89 LEShortField("device", 0),
90 XByteField("endpoint", 0),
91 ByteEnumField("transfer", 0, _transfer_types),
92 LenField("dataLength", None, fmt="<I")]
93
94 def post_build(self, p, pay):
95 if self.headerLen is None:
96 headerLen = len(p)
97 if isinstance(self.payload, (USBpcapTransferIsochronous,
98 USBpcapTransferInterrupt,
99 USBpcapTransferControl)):
100 headerLen += len(self.payload) - len(self.payload.payload)
101 p = chb(headerLen) + p[1:]
102 return p + pay
103
104 def guess_payload_class(self, payload):
105 if self.headerLen == 27:
106 # No Transfer layer
107 return super(USBpcap, self).guess_payload_class(payload)
108 if self.transfer == 0:
109 return USBpcapTransferIsochronous
110 elif self.transfer == 1:
111 return USBpcapTransferInterrupt
112 elif self.transfer == 2:
113 return USBpcapTransferControl
114 return super(USBpcap, self).guess_payload_class(payload)
115
116
117class USBpcapTransferIsochronous(Packet):

Callers

nothing calls this directly

Calls 8

ByteFieldClass · 0.90
XLELongFieldClass · 0.90
LEIntEnumFieldClass · 0.90
LEShortEnumFieldClass · 0.90
XByteFieldClass · 0.90
LEShortFieldClass · 0.90
ByteEnumFieldClass · 0.90
LenFieldClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…