add OBP key gen page

This commit is contained in:
KF7EEL 2021-09-05 15:50:38 -07:00
parent 651ced5ebd
commit 61372e74d1
2 changed files with 35 additions and 0 deletions

View File

@ -47,6 +47,9 @@ from gen_script_template import gen_script
import os, ast
##import hb_config
from cryptography.fernet import Fernet
script_links = {}
active_tgs = {}
ping_list = {}
@ -5283,6 +5286,10 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
</table>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="/OBP_key_gen"><button class="btn btn-primary" type="button">Generate OpenBridge Encryption Key</button></a></p>
<p>&nbsp;</p>
''' + m_list
return render_template('flask_user_layout.html', markup_content = Markup(content))
@ -5722,6 +5729,32 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
return render_template('flask_user_layout.html', markup_content = Markup(content))
@login_required
@roles_required('Admin')
@app.route('/OBP_key_gen')
def obp_key_gen():
key = Fernet.generate_key()
## content = str(key)[2:-1]
content = '''
<h3 style="text-align: center;">Generate OpenBridge Encryption Key</h3>
<p>&nbsp;</p>
<p style="text-align: center;">Both ends of the OpenBridge connection must share this same key.</p>
<p>&nbsp;</p>
<table style="width: 500px; margin-left: auto; margin-right: auto;" border="1">
<tbody>
<tr>
<td style="text-align: center;">KEY: (Copy and Paste)</td>
</tr>
<tr>
<td style="text-align: center;"><strong>''' + str(key)[2:-1] + '''</strong></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
'''
return render_template('flask_user_layout.html', markup_content = Markup(content))
@app.route('/svr', methods=['POST'])
def auth():
hblink_req = request.json

View File

@ -8,3 +8,5 @@ pymysql
folium
requests
libscrc
dmr_utils3
cryptography