Finds a pointer to the stack via __environ, which is an exported symbol in libc, which points to the environment block.
(self)
| 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 |