Skip to content

Commit

Permalink
Added ngrok integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
drakylar committed Dec 29, 2021
1 parent 070a174 commit ffe0fb2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
**/__pychache__/
/backups/db/*.sqlite3
/venv/
*.log
*.log
ngrok_url.txt
21 changes: 18 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import glob
import secure
from functools import wraps
from pyngrok import ngrok

from system.db import Database

Expand Down Expand Up @@ -57,11 +58,9 @@
app.config['SECRET_KEY'] = config['main']['secret']
app.config['WTF_CSRF_TIME_LIMIT'] = 60 * 60 * int(config['security']['csrf_lifetime'])


# enable jsonify pretty output
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True


app.register_blueprint(api_bp)

app.register_blueprint(main_routes)
Expand Down Expand Up @@ -287,6 +286,22 @@ def inject_stage_and_region():


if __name__ == '__main__':
if config['network']['ngrok'] == '1':
if not config['network']['ngrok_token']:
print('Need NGROK token to use it!')
ngrok_ip = config['network']['host'] if config['network']['host'] != '0.0.0.0' else '127.0.0.1'
ngrok_tunnel = ngrok.connect(ngrok_ip + ':' + config['network']['port'],
proto="http")
ngrok.set_auth_token(config['network']['ngrok_token'])
ngrok_url = ngrok_tunnel.public_url
print('#' * (len(ngrok_url) + 11))
print('# Ngrok: {} #'.format(ngrok_url))
print('#' * (len(ngrok_url) + 11))
print('All data duplicated')
f = open(config['network']['ngrok_url_file'], 'w')
f.write(ngrok_url)
f.close()

if config['ssl']['ssl'] == '1':
import ssl

Expand All @@ -306,4 +321,4 @@ def inject_stage_and_region():
debug=(config['main']['debug'] == '1'),
threaded=True)
else:
application = app
application = app
3 changes: 3 additions & 0 deletions configuration/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ cert = ./configuration/server.crt
[network]
host = 0.0.0.0
port = 5000
ngrok = 0
ngrok_token =
ngrok_url_file = ngrok_url.txt

[bruteforce]
top10k = ./static/files/wordlists/10-million-password-list-top-10000.txt
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ git+https://gitlab.com/invuls/pentest-projects/pcf_tools/qmarkpg_fork
Flask-Caching==1.10.1
secure==0.3.0
markdownify==0.10.1
pyngrok==5.1.0

#tools
python-libnmap==0.7.2
Expand Down
1 change: 1 addition & 0 deletions requirements_unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ git+https://gitlab.com/invuls/pentest-projects/pcf_tools/qmarkpg_fork
Flask-Caching==1.10.1
secure==0.3.0
markdownify==0.10.1
pyngrok==5.1.0

#tools
python-libnmap==0.7.2
Expand Down
1 change: 1 addition & 0 deletions requirements_windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ qmarkpg==0.2
Flask-Caching==1.10.1
secure==0.3.0
markdownify==0.10.1
pyngrok==5.1.0

#tools
python-libnmap==0.7.2
Expand Down

0 comments on commit ffe0fb2

Please sign in to comment.