Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
788 B

4 years ago
  1. #!/bin/python
  2. import sys
  3. from base64 import b64decode
  4. from hashlib import sha256
  5. from urllib.parse import quote
  6. message = b64decode(sys.argv[1]).decode()
  7. userid = "1"
  8. key = "Rwb3pUUG8fQAZUs3Q3qwdHH25Fdq8dyJyzUQqERzrCfxavKExfSExQbr8dZXho57abGvTZGdBmSbyXdVM59jDVi4L5ien9xoVHskMdx4FxNXyq7uBPYaAeA62JXzMZT9"
  9. domain = "https://hermes.yigitcolakoglu.com/read"
  10. subject = "NIL"
  11. recipient = "NIL"
  12. for i in message.split("\n"):
  13. if i.split(" ")[0] == "Subject:":
  14. subject = i[9:]
  15. elif i.split(" ")[0] == "To:":
  16. recipient = i[4:]
  17. identifier = subject + recipient + userid + key
  18. identifier_hash = sha256(identifier.encode("utf-8")).hexdigest()
  19. url = "{}/{}/{}/{}/{}".format(domain,userid,quote(subject),quote(recipient),identifier_hash)
  20. print('![Hermes]({})'.format(url))