pretty

Monday, September 10, 2012

Scapy and HTTP

Found a HTTP dissector for scapy
A test that displays Requests and Responses

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
try:
import scapy.all as scapy
except ImportError:
import scapy

import HTTP

packets = scapy.rdpcap('example.pcap')
for p in packets:
if p.haslayer("HTTPRequest") :
#print p['TCP'].getfieldval('dport')
print p.getlayer('HTTP Request')
if p.haslayer("HTTPResponse"):
print p.getlayer('HTTP Response')

print "done"

No comments:

Post a Comment