From 84c2a477908bb7699e43f680b2d03a0a926fe0c8 Mon Sep 17 00:00:00 2001 From: belodetek <2033996+ab77@users.noreply.github.com> Date: Sun, 19 May 2019 10:48:26 -0700 Subject: [PATCH] Python3 (WIP) --- auth/auth.py | 6 +++--- build.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/auth/auth.py b/auth/auth.py index 580e65ea..c86318da 100755 --- a/auth/auth.py +++ b/auth/auth.py @@ -131,7 +131,7 @@ def is_redirected(): def csrf_token(): - if not session.has_key('csrf_token'): + if not 'csrf_token' in session: from uuid import uuid4 session.csrf_token = uuid4().hex return session.csrf_token @@ -140,7 +140,7 @@ def csrf_token(): def csrf_protected(f): def decorated(*args, **kwargs): inp = web.input() - if not (inp.has_key('csrf_token') and inp.csrf_token == session.pop('csrf_token', None)): + if not ('csrf_token' in inp and inp.csrf_token == session.pop('csrf_token', None)): raise web.HTTPError( "400 Bad request", {'content-type':'text/html'}, @@ -555,7 +555,7 @@ class DDNSIndex: ddns_add_form = web.form.Form(web.form.Textbox('domain', web.form.notnull)) def GET(self): try: - if session.has_key('user'): + if 'user' in session: domains = db.query('SELECT * FROM DDNS WHERE user_id=$user_id', vars={'user_id': session.user['ID']}) return render.ddns(domains, DDNSIndex.ddns_add_form()) diff --git a/build.sh b/build.sh index 63aca73e..d7700508 100755 --- a/build.sh +++ b/build.sh @@ -294,12 +294,12 @@ sudo apt-get -y update &>> ${CWD}/netflix-proxy.log\ && sudo apt-get -y install python3.6 python3-venv python3-pip sqlite3 &>> ${CWD}/netflix-proxy.log\ && python3 -m venv venv &>> ${CWD}/netflix-proxy.log\ && source venv/bin/activate &>> ${CWD}/netflix-proxy.log\ - && pip3 install -r requirements.txt &>> ${CWD}/netflix-proxy.log + && pip3 install -r requirements.txt &>> ${CWD}/netflix-proxy.log\ + && pip3 install -r ${CWD}/auth/requirements.txt &>> ${CWD}/netflix-proxy.log log_action_end_msg $? log_action_begin_msg "configuring admin backend" -sudo pip3 install -r ${CWD}/auth/requirements.txt &>> ${CWD}/netflix-proxy.log\ - && PLAINTEXT=$(${CWD}/auth/pbkdf2_sha256_hash.py | awk '{print $1}')\ +PLAINTEXT=$(${CWD}/auth/pbkdf2_sha256_hash.py | awk '{print $1}')\ && HASH=$(${CWD}/auth/pbkdf2_sha256_hash.py ${PLAINTEXT} | awk '{print $2}')\ && sudo cp ${CWD}/auth/db/auth.default.db ${CWD}/auth/db/auth.db &>> ${CWD}/netflix-proxy.log\ && sudo $(which sqlite3) ${CWD}/auth/db/auth.db "UPDATE users SET password = '${HASH}' WHERE ID = 1;" &>> ${CWD}/netflix-proxy.log