Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #377

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ How to use it
-------
First unload the tool.
```
git clone https://github.com/jofpin/trape.git
git clone https://github.com/rbrtjns90/trape.git
cd trape
python3 trape.py -h
```
Expand Down Expand Up @@ -149,10 +149,12 @@ Developer
-------
This development and others, the participants will be mentioned with name, Twitter and charge.

* **CREATOR**
**ORIGINAL CREATOR**

--- Jose Pino - [@jofpin](https://twitter.com/jofpin) - (**Security Researcher**)


**UPDATER FROM ABANDONWARE**
--- Robert Jones - [@queloquesocio](https://x.com/queloquesocio) -

Happy hacking!
-------
Expand All @@ -163,6 +165,6 @@ I invite you, if you use this tool helps to share, collaborate. Let's make the I

The content of this project itself is licensed under the [Creative Commons Attribution 3.0 license](http://creativecommons.org/licenses/by/3.0/us/deed.en_US), and the underlying source code used to format and display that content is licensed under the [MIT license](http://opensource.org/licenses/mit-license.php).

Copyright, 2018 by [Jose Pino](https://twitter.com/jofpin)
Copyright, 2023

-------------
5 changes: 4 additions & 1 deletion core/ngrok.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ def __init__(self, authtoken, port, nT, hash):
saved_file.write(download.read())
saved_file.close()

result = subprocess.check_output(["unzip", filename])
if "nt" in system_type and int(platform.release()) < 10:
result = subprocess.check_output(["unzip", filename])
else:
result = subprocess.check_output(['tar', '-xf', filename, str_ngrok])
os.remove(filename)

subprocess.check_output([str_ngrok, "authtoken", authtoken])
Expand Down
5 changes: 3 additions & 2 deletions core/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from core.dependence import urllib2
import sys
import os
from flask import Flask, render_template, session, request, json, redirect, url_for, send_from_directory
import simplejson as json
from flask import Flask, render_template, session, request, redirect, url_for, send_from_directory #json
from flask_cors import CORS
from trape import Trape
import urllib
Expand Down Expand Up @@ -152,7 +153,7 @@ def busted(JSFile):
mPath = sys._MEIPASS + '/'
for obj in trape.JSFiles:
if str(obj['src']) == str(JSFile):
s_code = open(mPath + "static/js/" + obj['path'],"r")
s_code = open(mPath + "static/js/" + obj['path'],"r", encoding = 'utf8')
code = s_code.read()
s_code.close()
break
Expand Down
12 changes: 10 additions & 2 deletions core/trape.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,30 @@ def header(self):
if ngrokUrlPos <= 0:
time.sleep(4)
ngrokStatus = str(opener.open('http://127.0.0.1:' + str(pLog) + '/api/tunnels').read()).replace('\n', '').replace(' ', '')
#get url by key from dictionary instead of hardcoding
parse_ngrokStatus = json.loads(str(ngrokStatus)[2:][:-3]) #conv str, rm b'/n', decode json type to dict
ngrok_url = parse_ngrokStatus['tunnels'][0]['public_url'] #{'tunnels': []}, dict as first item of list, public_url
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'
#ngrokStatus = ngrokStatus[ngrokUrlPos: ngrokUrlPos2] + '.io' #unnecessary
ngrokStatus = ngrok_url
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)
shortened_url = {}
shortened_url['id'] = json.loads(r)
self.nGrokUrl = ngrokStatus.replace('https', 'http')
shortened_url = str(shortened_url['id']['id']).replace('https', 'http')
utils.Go(utils.Color['white'] + "\t" + utils.Color['yellow'] + ">" + utils.Color['white'] + "-" + utils.Color['blue'] + "=" + utils.Color['white'] + "[" + utils.Color['white'] + " Short.io Shortened lure: " + utils.Color['blue'] + shortened_url + utils.Color['white'])
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['white'] + "[" + utils.Color['redBold'] + "x" + utils.Color['whiteBold'] + "]" + utils.Color['redBold'] + " " + "ERROR: " + " " + utils.Color['white'] + str(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)
Expand Down
64 changes: 62 additions & 2 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
import requests, json
from colorama import init , Style,Fore
import http.client
import string
import random
init()
def create_url():
N = 7
res = ''.join(random.choices(string.ascii_uppercase +
string.digits, k=N))
return str(res)

class utils:
# Functions 1to get is right
Expand Down Expand Up @@ -145,14 +152,67 @@ def checkUrl(url):
c.close()
return False

# Goo.gl shortener service
# Removed Goo.gl shortener service
@staticmethod
def gShortener(api_key, p_url):
def _gShortener(api_key, p_url):
url = "https://www.googleapis.com/urlshortener/v1/url?key=" + api_key
payload = '{"longUrl":"' + p_url + '"}'
headers = {'content-type': 'application/json'}
r = requests.post(url, data=payload, headers=headers)
return r

#Short.io shortener service
@staticmethod
def gShortener(api_key, p_url):

url = "https://api.short.io/links"
#add your short.io test domain here
short_io_domain = ""
payload = {
"domain": short_io_domain,
"originalURL": p_url,
"path": create_url(),
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"Authorization": api_key,
}

response = requests.post(url, json=payload, headers=headers)
'''Google Shortener Example API
response = {"kind": "urlshortener#url",
"id": "http://goo.gl/fbsS",
"longUrl": "https://www.rebrandly.com/",
"status": "OK"
}'''
'''Short Example API
originalURL': 'http://9e3a-205-204-27-195.ngrok.io/www.instagram.com/',
'DomainId': 652469,
'archived': False,
'lcpath': 'fvfbqtj',
'source': 'api',
'cloaking': False,
'createdAt': '2023-03-11T08:19:19.685Z',
'updatedAt': '2023-03-11T08:19:19.685Z',
'OwnerId': 806676,
'tags': [],
'path': 'FVFBQTJ',
'idString': 'lnk_2JJH_9dCPkor7AOX',
'shortURL': 'https://83t0.short.gy/FVFBQTJ',
'secureShortURL': 'https://83t0.short.gy/FVFBQTJ',
'duplicate': False}'''
# Convert the Short.io Response to match the Google Response
parse_response = json.loads(str(response.content)[2:][:-1])
fixed_response = {}
fixed_response['longUrl'] = parse_response['originalURL']
fixed_response['id'] = parse_response['shortURL']
fixed_response['kind'] = parse_response['shortURL']
fixed_response['status'] = 'OK'

return json.dumps(fixed_response)



# Autocompletion
@staticmethod
Expand Down
47 changes: 31 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
Flask
Flask-Login
Flask-Session
flask-socketio
flask_socketio
flask_cors
itsdangerous
Jinja2
MarkupSafe
python-engineio
python-socketio
six
Werkzeug
eventlet
requests
colorama
bidict==0.22.1
cachelib==0.10.2
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.6
dnspython==2.3.0
eventlet==0.33.3
Flask==2.2.3
Flask-Cors==3.0.10
Flask-Login==0.6.2
Flask-Session==0.4.0
Flask-SocketIO==5.3.2
greenlet==2.0.2
idna==3.4
importlib-metadata==6.0.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
python-engineio==4.3.4
python-socketio==5.7.2
requests==2.28.2
simplejson==3.18.3
six==1.16.0
style==1.1.0
typing_extensions==4.5.0
update==0.0.1
urllib3==1.26.14
Werkzeug==2.2.3
zipp==3.15.0
simple-websocket==0.9.0
19 changes: 10 additions & 9 deletions static/js/libs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion trape.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
utils.Go(utils.Color['whiteBold'] + " @@@@@@@@@@@@@@@@@@@@@@@@ ")
utils.Go(utils.Color['whiteBold'] + " @@@@@@@@@@@@@@@@@@@@@@ ")
utils.Go("\t" + utils.Color['white'] + "--" + " " + "v" + utils.Color['redBold'] + "2.0" + utils.Color['white'] + " " + "--" + "\n" + utils.Color['white'])
utils.Go(utils.Color['whiteBold'] + "WELCOME " + utils.Color['greenBold'] + os.uname()[1].upper() + utils.Color['whiteBold'] + " TO TRAPE" + utils.Color['white'])
utils.Go(utils.Color['whiteBold'] + "WELCOME " + utils.Color['greenBold'] + os.name()[1].upper() + utils.Color['whiteBold'] + " TO TRAPE" + utils.Color['white'])
utils.Go("------")
utils.Go("This is a exclusive version for researchers, or professionals \nwho are dedicated to research, we hope you enjoy." + "\n")
utils.Go(utils.Color['whiteBold'] + "DISCLAIMER" + utils.Color['white'])
Expand Down