chg: [Flask server] https support + create self signed certificate

pull/359/head
Terrtia 2019-06-24 13:43:16 +02:00
parent bb65179e50
commit be251289a7
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
3 changed files with 26 additions and 8 deletions

View File

@ -19,6 +19,19 @@ echo -e $GREEN"Shutting down AIL ..."$DEFAULT
bash ${AIL_BIN}/LAUNCH.sh -k bash ${AIL_BIN}/LAUNCH.sh -k
wait wait
echo ""
echo -e $GREEN"Create Self-Signed Certificate"$DEFAULT
echo ""
pushd ${AIL_BIN}/helper/gen_cert
bash gen_root.sh
wait
bash gen_cert.sh
wait
popd
cp ${AIL_BIN}/helper/gen_cert/server.crt ${AIL_FLASK}/server.crt
cp ${AIL_BIN}/helper/gen_cert/server.key ${AIL_FLASK}/server.key
echo "" echo ""
echo -e $GREEN"Update requirement"$DEFAULT echo -e $GREEN"Update requirement"$DEFAULT
echo "" echo ""
@ -30,7 +43,7 @@ wait
echo "" echo ""
echo "" echo ""
bash ${AIL_BIN}LAUNCH.sh -lav & bash ${AIL_BIN}/LAUNCH.sh -lav &
wait wait
echo "" echo ""

View File

@ -4,14 +4,13 @@
import os import os
import re import re
import sys import sys
import ssl
import time
import redis import redis
import configparser
import random import random
import json import configparser
import datetime
import time
import calendar
from flask import Flask, render_template, jsonify, request, Request, session, redirect, url_for from flask import Flask, render_template, jsonify, request, Request, session, redirect, url_for
from flask_login import LoginManager, current_user, login_user, logout_user, login_required from flask_login import LoginManager, current_user, login_user, logout_user, login_required
@ -57,6 +56,12 @@ r_serv_tags = redis.StrictRedis(
# ========= =========# # ========= =========#
# ========= TLS =========#
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
ssl_context.load_cert_chain(certfile='server.crt', keyfile='server.key')
#print(ssl_context.get_ciphers())
# ========= =========#
Flask_config.app = Flask(__name__, static_url_path=baseUrl+'/static/') Flask_config.app = Flask(__name__, static_url_path=baseUrl+'/static/')
app = Flask_config.app app = Flask_config.app
app.config['MAX_CONTENT_LENGTH'] = 900 * 1024 * 1024 app.config['MAX_CONTENT_LENGTH'] = 900 * 1024 * 1024
@ -258,4 +263,4 @@ r_serv_db.sadd('list_export_tags', 'infoleak:submission="manual"')
# ============ MAIN ============ # ============ MAIN ============
if __name__ == "__main__": if __name__ == "__main__":
app.run(host='0.0.0.0', port=7000, threaded=True) app.run(host='0.0.0.0', port=7000, threaded=True, ssl_context=ssl_context)

View File

@ -176,7 +176,7 @@ max_dashboard_logs = int(cfg.get("Flask", "max_dashboard_logs"))
crawler_enabled = cfg.getboolean("Crawler", "activate_crawler") crawler_enabled = cfg.getboolean("Crawler", "activate_crawler")
email_regex = r'[^@]+@[^@]+\.[^@]+' email_regex = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}'
email_regex = re.compile(email_regex) email_regex = re.compile(email_regex)
# VT # VT