Skip to content

Instantly share code, notes, and snippets.

@zPrototype
Created February 22, 2020 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zPrototype/f3ec06de876c9c7556dd6eba9a77935e to your computer and use it in GitHub Desktop.
Save zPrototype/f3ec06de876c9c7556dd6eba9a77935e to your computer and use it in GitHub Desktop.
Python packet sniffer with scapy
from scapy.all import *
setInterface = input("Enter your interface: ")
countOfPackets = int(input("Enter amount of packets to sniff (default = 100): ") or "100")
setTimeout = int(input("Enter seconds before timeout (default = 5s): ") or "5")
print("")
conf.iface = setInterface
packets = sniff(count=countOfPackets, timeout=setTimeout)
print(packets.rawhexdump())
print(packets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment