当前位置:   article > 正文

pyshark实时抓包输出二进制、十进制、十六进制数据_filecapture

filecapture

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)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

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)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/156833?site
推荐阅读
相关标签
  

闽ICP备14008679号