Skip to content

Instantly share code, notes, and snippets.

@dustyfresh
Last active March 26, 2020 17:25
Show Gist options
  • Save dustyfresh/f75940029d5b60214dd0aa8507d6ecab to your computer and use it in GitHub Desktop.
Save dustyfresh/f75940029d5b60214dd0aa8507d6ecab to your computer and use it in GitHub Desktop.
Sniff packets for secrets with python scapy
#!/usr/bin/env python3
from scapy.all import *
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
import re
def packet_callback(packet):
if packet[TCP].payload:
pkt = str(packet[TCP].payload)
if packet[IP].dport == 80:
print("\n{} ----HTTP----> {}:{}:\n{}".format(packet[IP].src, packet[IP].dst, packet[IP].dport, str(bytes(packet[TCP].payload))))
sniff(filter="tcp", prn=packet_callback, store=0)
@Brianzhengca
Copy link

Thank you so much for this tool! It is so useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment