Create a gist now

Instantly share code, notes, and snippets.

@Svenito /egg0x0e.py Secret
Created Apr 25, 2014

What would you like to do?
Egg 0x0e
#!/usr/bin/env python
import base64
import re
import urllib
import codecs
import binascii
def decode(text):
m = re.match("^\[(\d+):(\w+)\](.+)", text)
if not m:
return text
level = m.group(1)
enc = m.group(2)
payload = m.group(3)
print level, enc
if enc == "b64":
result = base64.b64decode(payload)
elif enc == 'b32':
result = base64.b32decode(payload)
elif enc == 'inv':
result = payload.swapcase()
elif enc == 'url':
result = urllib.unquote(payload)
elif enc == 'nop':
result = payload
elif enc == 'r13':
result = codecs.decode(payload, 'rot_13')
elif enc == 'xxx':
result = re.match('xxx(.+)xxx', payload).group(1)
elif enc == 'rev':
result = payload[::-1]
elif enc == 'hex':
result = binascii.unhexlify(payload)
else:
return payload
return decode(result)
if __name__ == "__main__":
fh = open("source.txt")
source = fh.read()
fh.close()
a = decode(source)
print a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment