c - Get address of system function manually? -
how obtain address gdb gives when "print system"?
supposedly, if start program , pause it, in /proc/$pid/maps , base address of library. need find offset of system() in libc.so.6 , add these 2 together. however, when try in practice, end address different 1 gdb gives.
what's best way obtain system() address?
please note i'm trying obtain address of program, not 1 compiled myself.
what's best way obtain system() address?
#include <stdio.h> // printf() #include <stdlib.h> // system() ... ... { int rcode=0; int (*system_ptr)(const char *command) = system; ... rcode=(*system_ptr)("echo \"hello\""); ... printf("address of system(): %p\n", system_ptr); ... } ...
Comments
Post a Comment