开发者

header filtering using python

开发者 https://www.devze.com 2023-01-06 05:32 出处:网络
i want to filter some headers in a wiresharkcapture (converted to开发者_运维百科 text format) so i can analyse these set of headers.i need a python script to do this. any help would be appreciatedYou

i want to filter some headers in a wireshark capture (converted to开发者_运维百科 text format) so i can analyse these set of headers.i need a python script to do this. any help would be appreciated


You might want to look at dpkt. It's a Python library to simplify reading (or generating) network data. Just save your Wireshark data as a Pcap stream and it can easily be opened from within Python.

I don't know exactly which headers you want or how you need them filtered and formatted, but here's an example of what you could write: (taken from a contributor's blog post)

import dpkt
pcap = dpkt.pcap.Reader(open('test.pcap'))
for timestamp, buf in pcap:
    eth = dpkt.ethernet.Ethernet(buf)
    ip = eth.data
    tcp = ip.data
    print 'Got data from port ' + str(tcp.port)
0

精彩评论

暂无评论...
验证码 换一张
取 消