Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- ###############################################################
- # By: skynet | skynet404@aol.com | twitter.com/tehskynet #
- #-------------------------------------------------------------#
- # Social Engineer your victims into connecting to one of your #
- # traphap.py mock services to aquire their IP address #
- ###############################################################
- # Run as root for best results
- import sys, time, string, socket
- class colors:
- BLUE = '\033[94m'
- GREEN = '\033[92m'
- YELLOW = '\033[93m'
- RED = '\033[91m'
- ENDC = '\033[0m'
- def disable(self):
- self.BLUE = ''
- self.GREEN = ''
- self.RED = ''
- self.YELLOW = ''
- self.ENDC = ''
- def title():
- print colors.BLUE + """
- ____ ____ __ ____ _ _ __ ____ ____ _ _
- (_ _)( _ \ /__\ ( _ \( )_( ) /__\ ( _ \( _ \( \/ )
- )( ) / /(__)\ )___/ ) _ ( /(__)\ )___/ )___/ \ /
- (__) (_)\_)(__)(__)(__) (_) (_)(__)(__)(__)()(__) (__) \n""" + colors.ENDC
- print colors.GREEN + ' Welcome to traphapp.py (THPY). Your trapping headquarters..\n' + colors.ENDC
- print colors.YELLOW + ' By: skynet\n\n' + colors.ENDC
- class traphappy(object):
- def __init__(self):
- self.hst = "127.0.0.1"
- self.header = colors.BLUE + "thpy> " + colors.ENDC
- self.warning = colors.RED + "[+] " + colors.ENDC
- def mimic(self):
- print"""
- Select the service you wish to mimic from the menu:
- 1) SSH
- 2) Mail Server
- 3) MySQL
- 4) FTP
- 5) SFTP
- 6) Telnet
- 7) NetBios
- 8) VNC
- 9) SMB
- 10) X11
- 11) SOCKS Proxy\n"""
- servsel = raw_input("%s" % self.header)
- print "\nCreate a login prompt/header for the service you wish to mimic:\n"
- banner = raw_input("%s" % self.header)
- services = {'1':22, '2':443, '3':3306, '4':21, '5':22, '6':23, '7':139, '8':5900, '9':445, '10':9000, '11':1080}
- if servsel in services:
- self.prt = services[servsel]
- while 1:
- try:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- HOST = self.hst
- PORT = self.prt
- s.bind((HOST, PORT))
- s.listen(1)
- print self.warning + time.strftime("%a, %d %b %Y %H:%M:%S %Z") + ': Setting up service on port %s...' % (PORT)
- (insock, address) = s.accept()
- straddress = str(address) # Convert incoming address to a string
- testlist = string.split(straddress, ",") # Split the tuple into lists
- gethost = string.split(testlist[0], "'") # Split the host portion of the list
- getaddr = string.split(testlist[1], ")") # Split the port portion of the list
- host = gethost[1] # Remove just the address from the list
- inport = int(getaddr[0]) # Remove just the port from the list
- log = open("log.txt","a+") # Open log.txt to log information on victim
- log.write(time.strftime("\n%a, %d %b %Y %H:%M:%S %Z") + ":. Connection attempt on port %s from %s:%s" % (PORT, host, inport))
- insock.send(banner)
- data = insock.recv(1024)
- log.write('\nInput: %s\n-----------------' % data)
- insock.close()
- s.close()
- except KeyboardInterrupt:
- print ("\n%sReturning to main menu..." % self.warning)
- self.mimic()
- except socket.error, msg:
- print ("%sError: %s" % (self.warning, msg))
- else:
- self.mimick()
- if __name__=='__main__':
- try:
- title()
- traphappy = traphappy()
- traphappy.mimic()
- except KeyboardInterrupt:
- print('\n%sExiting...' % traphappy.warning)
- sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement