Skip to content

Instantly share code, notes, and snippets.

@kkirsche
Created October 25, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kkirsche/2dff0907a2774067493d6c92306630b3 to your computer and use it in GitHub Desktop.
Save kkirsche/2dff0907a2774067493d6c92306630b3 to your computer and use it in GitHub Desktop.
Decode base64 and convert to hex format, like shellcode
#!/usr/bin/env python
from base64 import b64decode
from urllib import unquote
base64_strs = ['xU5LNJhXeo9B6o4Ri%2FxFHodARXWqgtNufNrYzqG05nGOLNboDgJtkw%3D%3D',
'%2BjAd73J7RAZgLxAUkIG5l0cMPLQEBAtZRMP3WdXr1%2BMYdrg2cZKaow%3D%3D']
for bstr in base64_strs:
unquoted_bstr = unquote(bstr)
data = b64decode(unquoted_bstr)
bl = []
for char in data:
mm = int(char.encode('hex'), 16)
bl.append(hex(mm))
print(' '.join(bl))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment