diff --git a/userdb/db.py b/userdb/db.py index 49a7196..08290d6 100644 --- a/userdb/db.py +++ b/userdb/db.py @@ -36,4 +36,4 @@ def track(): else: return 'hash missing' -app.run() \ No newline at end of file +app.run(port=8001) \ No newline at end of file diff --git a/web/nfc-theme/static/cgi/track.cgi b/web/nfc-theme/static/cgi/track.cgi deleted file mode 100644 index 787b375..0000000 --- a/web/nfc-theme/static/cgi/track.cgi +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python3 -print("Content-type:text/html\r\n\r\n") -import cgi -import json -import os - -args = cgi.FieldStorage() - -def track(): - if args['hash']: - hash = str(args['hash']) - ua = str(args['ua']) - url = str(args['url'] or os.getenv('HTTP_REFERER')) - if os.path.exists('db.json'): - with open('db.json', 'r') as db: - db = json.loads(db.read()) - else: - db = {} - if hash in db.keys(): - visits = db[hash]['visits'] - else: - visits = list() - - visits.append(url) - visits = list(set(visits)) - db.update({ - hash : { - 'visits' : visits, - 'agent' : ua - } - }) - with open('db.json', 'w+') as dbw: - dbw.write(json.dumps(db, indent=4)) - - print(str(len(db[hash]))) - else: - print('hash missing') \ No newline at end of file