MCPcopy
hub / github.com/Gallopsled/pwntools / stack

Method stack

pwnlib/dynelf.py:979–997  ·  view source on GitHub ↗

Finds a pointer to the stack via __environ, which is an exported symbol in libc, which points to the environment block.

(self)

Source from the content-addressed store, hash-verified

977 return if_ptr
978
979 def stack(self):
980 """Finds a pointer to the stack via __environ, which is an exported
981 symbol in libc, which points to the environment block.
982 """
983 symbols = ['environ', '_environ', '__environ']
984
985 for symbol in symbols:
986 environ = self.lookup(symbol, 'libc')
987
988 if environ:
989 break
990 else:
991 log.error("Could not find the stack")
992
993 stack = self.leak.p(environ)
994
995 self.success('*environ: %#x' % stack)
996
997 return stack
998
999 def heap(self):
1000 """Finds the beginning of the heap via __curbrk, which is an exported

Callers 1

exploitFunction · 0.95

Calls 4

lookupMethod · 0.95
successMethod · 0.95
errorMethod · 0.80
pMethod · 0.80

Tested by

no test coverage detected