Advertisement
TVT618

WiFi-Pumpkin TCP-Proxy

Jan 30th, 2019
4,196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.60 KB | None | 0 0
  1. #!/usr/bin/env python2.7
  2. from scapy.all import *
  3. from scapy_http import http # for layer HTTP
  4. from default import PSniffer # base plugin class
  5.  
  6. class ExamplePlugin(PSniffer):
  7.     _activated     = False
  8.     _instance      = None
  9.     meta = {
  10.         'Name'      : 'Example',
  11.         'Version'   : '1.0',
  12.         'Description' : 'Brief description of the new plugin',
  13.         'Author'    : 'your name',
  14.     }
  15.     def __init__(self):
  16.         for key,value in self.meta.items():
  17.             self.__dict__[key] = value
  18.  
  19.     @staticmethod
  20.     def getInstance():
  21.         if ExamplePlugin._instance is None:
  22.             ExamplePlugin._instance = ExamplePlugin()
  23.         return ExamplePlugin._instance
  24.  
  25.     def filterPackets(self,pkt): # (pkt) object in order to modify the data on the fly
  26.         if pkt.haslayer(http.HTTPRequest): # filter only http request
  27.  
  28.             http_layer = pkt.getlayer(http.HTTPRequest) # get http fields as dict type
  29.             ip_layer = pkt.getlayer(IP)# get ip headers fields as dict type
  30.  
  31.             print http_layer.fields['Method'] # show method http request
  32.             # show all item in Header request http
  33.             for item in http_layer.fields['Headers']:
  34.                 print('{} : {}'.format(item,http_layer.fields['Headers'][item]))
  35.  
  36.             print ip_layer.fields['src'] # show source ip address
  37.             print ip_layer.fields['dst'] # show destiny ip address
  38.  
  39.             print http_layer # show item type dict
  40.             print ip_layer # show item type dict
  41.  
  42.             return self.output.emit({'name_module':'send output to tab TCP-Proxy'})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement