Advertisement
parkdream1

color.py

May 1st, 2012
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.66 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. ###############################################################
  4. # By: skynet | skynet404@aol.com | twitter.com/tehskynet      #
  5. #-------------------------------------------------------------#
  6. # Social Engineer your victims into connecting to one of your #
  7. # traphap.py mock services to aquire their IP address         #
  8. ###############################################################
  9.  
  10. # Run as root for best results
  11.  
  12. import sys, time, string, socket
  13.  
  14. class colors:
  15.   BLUE = '\033[94m'
  16.   GREEN = '\033[92m'
  17.   YELLOW = '\033[93m'
  18.   RED = '\033[91m'
  19.   ENDC = '\033[0m'
  20.  
  21.   def disable(self):
  22.     self.BLUE = ''
  23.     self.GREEN = ''
  24.     self.RED = ''
  25.     self.YELLOW = ''
  26.     self.ENDC = ''
  27.  
  28. def title():
  29.   print colors.BLUE + """
  30.   ____  ____    __    ____  _   _    __    ____  ____  _  _
  31.  (_  _)(  _ \ /__\ (  _ \( )_( )  /__\ (  _ \(  _ \( \/ )
  32.    )(   )   / /(__)\ )___/ ) _ (  /(__)\ )___/ )___/ \ /
  33.   (__) (_)\_)(__)(__)(__)  (_) (_)(__)(__)(__)()(__)   (__) \n""" + colors.ENDC
  34.   print colors.GREEN + '    Welcome to traphapp.py (THPY).  Your trapping headquarters..\n' + colors.ENDC
  35.   print colors.YELLOW + '                   By: skynet\n\n' + colors.ENDC
  36.  
  37. class traphappy(object):
  38.   def __init__(self):
  39.     self.hst = "127.0.0.1"
  40.     self.header = colors.BLUE + "thpy> " + colors.ENDC
  41.     self.warning = colors.RED + "[+] " + colors.ENDC
  42.    
  43.   def mimic(self):
  44.     print"""
  45. Select the service you wish to mimic from the menu:
  46.  
  47. 1) SSH
  48. 2) Mail Server
  49. 3) MySQL
  50. 4) FTP
  51. 5) SFTP
  52. 6) Telnet
  53. 7) NetBios
  54. 8) VNC
  55. 9) SMB
  56. 10) X11
  57. 11) SOCKS Proxy\n"""
  58.  
  59.     servsel = raw_input("%s" % self.header)
  60.     print "\nCreate a login prompt/header for the service you wish to mimic:\n"
  61.     banner = raw_input("%s" % self.header)
  62.     services = {'1':22, '2':443, '3':3306, '4':21, '5':22, '6':23, '7':139, '8':5900, '9':445, '10':9000, '11':1080}
  63.     if servsel in services:
  64.       self.prt = services[servsel]
  65.       while 1:
  66.         try:
  67.           s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  68.           s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  69.           HOST = self.hst
  70.           PORT = self.prt
  71.           s.bind((HOST, PORT))
  72.           s.listen(1)
  73.           print self.warning + time.strftime("%a, %d %b %Y %H:%M:%S %Z") + ': Setting up service on port %s...' % (PORT)
  74.           (insock, address) = s.accept()
  75.           straddress = str(address) # Convert incoming address to a string
  76.           testlist = string.split(straddress, ",") # Split the tuple into lists
  77.           gethost = string.split(testlist[0], "'") # Split the host portion of the list
  78.           getaddr = string.split(testlist[1], ")") # Split the port portion of the list
  79.           host = gethost[1] # Remove just the address from the list
  80.           inport = int(getaddr[0]) # Remove just the port from the list
  81.           log = open("log.txt","a+") # Open log.txt to log information on victim
  82.           log.write(time.strftime("\n%a, %d %b %Y %H:%M:%S %Z") + ":. Connection attempt on port %s from %s:%s" % (PORT, host, inport))
  83.           insock.send(banner)
  84.           data = insock.recv(1024)
  85.           log.write('\nInput: %s\n-----------------' % data)
  86.           insock.close()
  87.           s.close()
  88.         except KeyboardInterrupt:
  89.           print ("\n%sReturning to main menu..." % self.warning)
  90.           self.mimic()
  91.         except socket.error, msg:
  92.           print ("%sError: %s" % (self.warning, msg))
  93.     else:
  94.       self.mimick()
  95.    
  96. if __name__=='__main__':
  97.   try:
  98.     title()
  99.     traphappy = traphappy()
  100.     traphappy.mimic()
  101.   except KeyboardInterrupt:
  102.     print('\n%sExiting...' % traphappy.warning)
  103.     sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement