1、在FileCapture下
packets
= pyshark.FileCapture
( input_file
=pcap_file, use_json
=True,include_raw
=True
)._packets_from_tshark_sync
()
hex_packet
= packets.__next__
().frame_raw.value
print
(hex_packet
)
binary_packet
= bytearray.fromhex
(hex_packet
)
print
(binary_packet
)
int_packet
= list
(binary_packet
)
print
(int_packet
)
2.LiveCapture
packets
= pyshark.LiveCapture
( interface
=iface, use_json
=True,include_raw
=True
)._packets_from_tshark_sync
()
hex_packet
= packets.__next__
().frame_raw.value
print
(hex_packet
)
binary_packet
= bytearray.fromhex
(hex_packet
)
print
(binary_packet
)
int_packet
= list
(binary_packet
)
print
(int_packet
)
转载请注明原文地址:https://ipadbbs.8miu.com/read-61641.html