There is a busybox library in general form called libbusybox(.so) , you just need to enable it when creating menuconfig. When you compile it will be available in the 0_lib folder. In this library, you have a small function called int lbb_main(char **argv) .
What you need to do in your code is something like this:
extern int lbb_main(char **argv); int main() { char* strarray[] = {"ifconfig",0}; lbb_main(strarray); return 1; }
You can import libb.h , but this did not work for me, because I got a lot of errors.
After that, you just need to compile using something like gcc -o code code.c -Lpath_to_0_lib_fodler -lbusybox and what it is!
In order to intercept the output, you will have to redefine printf and similar calls, but this can clearly be done using soemthing macros such as #define printf(...) code' in libb.h'.
You can even create a busybox wrapper that doesn't use fork or the system, but that doesn't work yet.
offlinehacker
source share