Skip to content

Instantly share code, notes, and snippets.

@kkirsche
Last active February 9, 2018 22:09
Show Gist options
  • Select an option

  • Save kkirsche/b7e64622f00fa77f263dd31ddb6f082c to your computer and use it in GitHub Desktop.

Select an option

Save kkirsche/b7e64622f00fa77f263dd31ddb6f082c to your computer and use it in GitHub Desktop.
Normal hexidecimal to python formatted hex
#!/usr/bin/env python
#❯❯❯ python to_py_hex.py
#\x73\x72\x2e\x32\x73\x75\x6e\x2e\x72\x65\x66\x6c\x0a
to_py_hex = '73722e3273756e2e7265666c0a'
sets = []
for c in range(0, len(to_py_hex)):
if c % 2 == 1:
continue
sets.append(to_py_hex[c] + to_py_hex[c+1])
shellcode = '\\x' + '\\x'.join(sets)
print(shellcode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment