Reputation: 5139
I use Wireshark to capture the traffic for browsing a certain website and use ip.src and ip.dst to get correct traffic.
I'd like to do this programmatically using Scapy. Anyone know how to achieve this?
Upvotes: 2
Views: 2376
Reputation: 16379
Using Scapy and its wonderful documentation, create a Python script. In the script, define a function that will act as a callback handler for received packets and in the main portion of the script make use of the sniff()
function:
def packetReceived(packet):
print("Packet received!")
sniff(filter="host xx.xx.xx.xx and host xx.xx.xx.xx and tcp port 80", prn=packetReceived)
Obviously, change the BPF filter to match the hosts you're targeting.
Upvotes: 4