tcpdump to only print urls

python, tcpdump

Solution

you can use scapy the sniff function and use regex or grep

import scapy
tcpdump = sniff(count=5,filter="host 64.233.167.99",prn=lambda x:x.summary())
print tcpdump

change the filter for your filter text :)

or maybe you want to save the traffic and see it in wireshark

wrpcap("temp.cap",pkts)

Problem

Is there a way to do ``` tcpdump -i lo -A ``` and have it print all urls, any connections made? I have done: ``` sudo tcpdump -i lo -A | grep Host: ``` which works great. But I was wondering if there are options to do the same in tcpdump Finally, is there a way to do this in python without using a sys command or Popen/subprocess

Original source