Skip to content

Instantly share code, notes, and snippets.

@RC1140
Created December 5, 2013 12:56
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save RC1140/7804728 to your computer and use it in GitHub Desktop.
Converts a memory address to little endian , useful for exploits and such , also prints the format used in an exploit.
import sys
if len(sys.argv) == 1:
sys.exit(-1)
memAddress = sys.argv[1]#'bffffe65'#
start = len(memAddress)
print(memAddress)
outAddress = ''
hexAddress = ''
for i in range(len(memAddress),0,-2):
start -= 2
outAddress += memAddress[start:i]
hexAddress += '\\x'+ memAddress[start:i]
print(outAddress)
print(hexAddress)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment