Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. # module sniff sniff
  2. class PrimarySpoof:
  3.     """ Primary spoof class.
  4.    
  5.    This class shall be used to read tcpdump output from the system
  6.    it shall then pass this packet to a class variable called capturedPacket
  7.    to make it available to other methods for further manupulation
  8.    """
  9.     capturedPacket=None
  10.  
  11.     def __init__(self,port):
  12.         """ initialize the port.
  13.        
  14.        """
  15.         self.port = port
  16.        
  17.     def initializeTcpdump(self):
  18.         # you must have imported the os module
  19.         """ This method will initialize tcpdump for the port indicated in the init.
  20.        
  21.        """
  22.         import os
  23.         cmd = "tcpdump -nnvvXSs 1514 -i eth0 dst port %d"%self.port
  24.         # test if it returns some output
  25.         #cmd = "tcpdump -nnvvXSs 1514 -i eth0"
  26.         PrimarySpoof.capturedPacket = os.system(cmd)
  27.        
  28.     def displayCapturedPacket(self):
  29.         """ Display the raw packet.
  30.        
  31.        """
  32.         print PrimarySpoof.capturedPacket
  33.  
  34.  
  35. ################### end of part sample
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement