Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get address of stack, heap, binary in memory of process #2369

Open
k4lizen opened this issue Mar 18, 2024 · 3 comments · May be fixed by #2371
Open

Get address of stack, heap, binary in memory of process #2369

k4lizen opened this issue Mar 18, 2024 · 3 comments · May be fixed by #2371
Labels

Comments

@k4lizen
Copy link

k4lizen commented Mar 18, 2024

The same way there is a way to get the address of shared libraries: process.libs(), which is currently implemented by inspecting /proc/<pid>/maps as linked in the docs, it should be possible to find the base address of the binary, stack and heap, even when ASLR is on.

This would be quite handy in some cases (like easily calculating offsets locally, which can then be used on remote processes).

@k4lizen
Copy link
Author

k4lizen commented Mar 20, 2024

Along with this, a process.maps() (which would returned a parsed /proc/<pid>/maps) could be implemented, and .libc/libs/stack/heap/whatever would just use that.
Also returning the size along with the address would be useful.

@k4lizen
Copy link
Author

k4lizen commented Mar 20, 2024

I would be willing to work on this PR if the feature is approved.

@peace-maker
Copy link
Member

Sure, this sounds useful! Next to the hardcoded properties, having a shortcut to receive the base address of any mapping without having to filter the .libs() result manually would be great too.

@k4lizen k4lizen linked a pull request Mar 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants