Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from scapy.all import *
- import sys, time
- header = '%15s|%15s|%5s|%5s|%5s|%15s|' % ('sip','dip','sport','dport',
- 'proto','bytes')
- tfn = sys.argv[1]
- pcap_data = rdpcap(tfn)
- for i in pcap_data:
- sip = i[IP].src
- dip = i[IP].src
- if i[IP].proto == 6:
- sport = i[TCP].sport
- dport = i[TCP].dport
- elif i[IP].proto == 17:
- sport = i[UDP].sport
- dport = i[UDP].dport
- else:
- sport = 0
- dport = 0
- bytes = i[IP].len
- print "%15s|%15s|%5d|%5d|%5d|%15d" % (sip, dip, sport, dport,
- i[IP].proto, bytes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement