#include #include #include #include "fs.h" #include "inject.h" #include "proc.h" int main(int argc, char** argv) { if (argc < 3) { printf("inject_so [pid] [so files ...]\n"); return -1; } pid_t pid; char** so_files = argv+2; sscanf(argv[1], "%li", &pid); if (!process_exists(pid)) { printf("%li is not a running process\n", pid); return -1; } char so_path[PATH_MAX]; char** so_file = so_files; while (*so_file) { if (!isFile(*so_file)) { printf("[!] %s is not a file\n", *so_file); //++so_file; //continue; } realpath(*so_file, so_path); printf("[*] Injecting %s\n", so_path); int ret = load_library(pid, so_path); if (!ret) printf("[*] Success\n"); else if (ret == 1) printf("[!] library already loaded\n"); else printf("[!] could not load libary\n"); ++so_file; } }