когда я запускаю этот код:
#!/usr/bin/env python
import scapy.all as scapy
from scapy_http import http
def sniff(interface):
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet)
def process_sniffed_packet(packet):
if packet.haslayer(http.HTTPRequest):
print(packet)
sniff("eth0")
я получил:
Traceback (most recent call last): File "packet_sniffer.py", line 16, in <module>
sniff("eth0") File "packet_sniffer.py", line 8, in sniff
scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet) File "/usr/local/lib/python3.7/dist-packages/scapy/sendrecv.py", line 886, in sniff
r = prn(p) File "packet_sniffer.py", line 13, in process_sniffed_packet
print(packet) File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 438, in
__str__
return str(self.build()) File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 556, in build
p = self.do_build() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 541, in do_build
pay = self.do_build_payload() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 528, in do_build_payload
return self.payload.do_build() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 541, in do_build
pay = self.do_build_payload() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 528, in do_build_payload
return self.payload.do_build() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 541, in do_build
pay = self.do_build_payload() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 528, in do_build_payload
return self.payload.do_build() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 541, in do_build
pay = self.do_build_payload() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 528, in do_build_payload
return self.payload.do_build() File "/usr/local/lib/python3.7/dist-packages/scapy/packet.py", line 538, in do_build
pkt = self.self_build() File "/usr/local/lib/python3.7/dist-packages/scapy_http/http.py", line 179, in self_build
return _self_build(self, field_pos_list) File "/usr/local/lib/python3.7/dist-packages/scapy_http/http.py", line 101, in _self_build
val = _get_field_value(obj, f.name) File "/usr/local/lib/python3.7/dist-packages/scapy_http/http.py", line 74, in _get_field_value
headers = _parse_headers(val) File "/usr/local/lib/python3.7/dist-packages/scapy_http/http.py", line 18, in _parse_headers
headers = s.split("\r\n") TypeError: a bytes-like object is required, not 'str'
что мне делать?