Write a simple python program to capture HTTP header packets
Demonstrate your HTTP packet sniffer by capturing a request tohttp://www.capella.edu
Test code by taking a screenshots
So far I have came across this code but not working forcapturing a request from http://www.capella.edu
from scapy.all import IP, sniff
from scapy.layers import http
def tcp_ayikla(paket):
if not paket.haslayer(http.HTTPRequest):
return
http_katmani = paket.getlayer(http.HTTPRequest)
ip_katmani = paket.getlayer(IP)
print ‘n{0[src]} IP adresinden {1[Method]} {1[Host]}{1[Path]}sitesine ziyaret’.format(ip_katmani.fields,http_katmani.fields)
sniff(filter=’tcp’, prn=tcp_ayikla)
Also this but getting error output
from scapy.all import *def http_header(packet): http_packet=str(packet) if http_packet.find(‘GET’):