Skip to content

Instantly share code, notes, and snippets.

@dotsh
Forked from lkraider/spam_decode.py
Created January 17, 2022 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotsh/ef73853208deb9a4b048cbcdd3b649ea to your computer and use it in GitHub Desktop.
Save dotsh/ef73853208deb9a4b048cbcdd3b649ea to your computer and use it in GitHub Desktop.
X-OVH-SPAMCAUSE decoder
def decode(msg):
text = []
for i in range(0, len(msg), 2):
text.append(unrot(msg[i: i + 2]))
return str.join('', text)
def unrot(pair, key=ord('x')):
offset = 0
for c in 'cdefgh':
if c in pair:
offset = (ord('g') - ord(c)) * 16
break
return chr(sum(ord(c) for c in pair) - key - offset)
if __name__ == '__main__':
import sys
print(decode(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment