Skip to content

Instantly share code, notes, and snippets.

@johnjohnsp1
Forked from guelfoweb/athena_http_decode.py
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save johnjohnsp1/1e983fa9dce1a2a00f05 to your computer and use it in GitHub Desktop.

Select an option

Save johnjohnsp1/1e983fa9dce1a2a00f05 to your computer and use it in GitHub Desktop.
A little code to decode Athena HTTP POST request
'''
Athena HTTP - Decode HTTP POST request
Gianni 'guelfoweb' Amato
'''
import urllib
import base64
import itertools
from string import maketrans
a = "%64%6D%5A%74%64%32%4E%6B%62%6E%68%6C%62%33%56%77%5A%32%68%69%61%33%4A%70%63%32%70%30%65%6D%46%73%65%58%45%36%64%32%64%75%65%47%68%76%65%57%6C%77%5A%6E%70%78%63%6D%4A%73%64%6E%4E%6A%62%58%52%6B%64%57%74%6C%61%6D%45%3D"
b = "gHR5hGU6l25gZXbeY3i1kWQ6MDrjNtE1NuA4ODYiYTEiMWUxZGFtZGFvODA2ZDYiNuI2OTZngHBjkXY6YWRdkW58YXJtkDq4ODZ8Z2VzZDqvZXNsoG9xgGNwhnVuOtF8l3M6V19YUHi2ZXI6otEzMC44gG5eoDf0LtB8lnV3OtF8"
c = "%78%68%6F%79%69%6F%79%69%70%7A%66%70%7A%67%71%61%67%71%61%68%72%78%68%72"
# [a] decoding...
'''
a: hex -> b64 -> text -> split(:) => a1, a2
key = {'a2[x]': 'a1[x]'}
'''
a_hex_b64 = urllib.unquote(a).decode('utf8')
a_b64_text = base64.b64decode(a_hex_b64)
a_string_1 = a_b64_text.split(':')[0]
a_string_2 = a_b64_text.split(':')[1]
key = maketrans(a_string_2, a_string_1)
# [b] decoding...
'''
b: b(key) -> b64 -> text
'''
b_key_b64 = b.translate(key)
b_b64_text = base64.b64decode(b_key_b64)
# [c] decoding...
c_hex_b64 = urllib.unquote(c).decode('utf8')
print b_b64_text
'''
OUTPUT: |type:on_exec|uid:082615708861a111e0dacdad806d6172696f|priv:admin|arch:x86|gend:desktop|cores:1|os:W_XP|ver:v1.0.8|net:4.0|new:1|
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment