mardi 12 juillet 2016

Python print environment variable memory address

Is it possible to print my environment variable memory address ?

With gdb-peda i have a memory address looking like 0xbffffcd6 with searchmem and i know it's the right form. (0xbfff????) but gdb moved the stack with some other environment variable.

I would like with my python script to get this address and then do my trick and include my shellcode.

i tried (with Python):

print hex(id(os.environ["ENVVAR"]))
print memoryview(os.environ["ENVVAR"])

# output :
# 0xb7b205c0L
# <memory at 0xb7b4dd9c>

With Ruby :

puts (ENV['PATH'].object_id << 1).to_s(16)
# output :
# -4836c38c

If anyone have an idea, with python or ruby.

Aucun commentaire:

Enregistrer un commentaire