I created a simple python script to capture HTTP request. I captured HTTP Requests with my python script.
But I can't capture HTTPS requests. I just want to capture information about URLs.
I used scapy
to sniffing. For example:
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)
So, I have questions about sniffing.
1-) Why I can't get HTTPS requests?
If I use netstat
like this:
netstat -ap | grep http
I can see HTTPS Requests
2-) Is there any way in another programming languages?
Because I am trying to log HTTP requests.
What did I do?
- I tried parsing netstat output with python. I don't want to this. Because it's not pure Python.
- I tried with scapy. I couldn't catch HTTPS requests.
- I tried to read the URL informations from SQLite. I don't want to this. Because it's not about network.
What should I do?
Should I give up?