From 33d249dcc5df927db24c8c4a35097ab02bc697e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20=C3=87olako=C4=9Flu?= Date: Sat, 28 Nov 2020 12:44:20 +0300 Subject: [PATCH] Added url generator --- gen_tracking_url.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 gen_tracking_url.py diff --git a/gen_tracking_url.py b/gen_tracking_url.py new file mode 100755 index 0000000..5610e9c --- /dev/null +++ b/gen_tracking_url.py @@ -0,0 +1,37 @@ +#!/bin/python + +import sys +from base64 import b64decode +from hashlib import sha256 +from urllib.parse import quote + +# Change these variables depending on your setup. +userid = "" +key = "" +domain = "" + +if len(sys.argv) > 2: + subject = input("Please enter subject of email:") + recipient = input("Please enter recipient of email: ") +else: + message = b64decode(sys.argv[1]).decode() + + subject = "NIL" + recipient = "NIL" + + for i in message.split("\n"): + if i.split(" ")[0] == "Subject:": + subject = i[9:] + elif i.split(" ")[0] == "To:": + recipient = i[4:] + +identifier = subject + recipient + userid + key # Generate hash +identifier_hash = sha256(identifier.encode("utf-8")).hexdigest() + +url = "{}/read/{}/{}/{}/{}".format(domain, + userid, + quote(subject), + quote(recipient), + identifier_hash) #Generate tracking url + +print(url)