如何快速提取pcap內容

python-libpcap

Cython libpcap, read/write/merge/capture

Features

  • Read pcap file
  • Write pcap file
  • Merge pcap file
  • Multi-file quick merge
  • Get first iface
  • Get iface list
  • Send raw packet
  • Capture data

Usage

合併多文件:

# 根據BPF規則提取多文件內容,並輸出pcap文件
$ mpcap -i pcap/ -o pcap.pcap port 502

獲取第一個存活的網卡:

from pylibpcap import get_first_iface


print(get_first_iface())   # enp2s0

注:詳細使用請看:https://github.com/caizhengxin/python-libpcap

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章