赞
踩
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)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。