mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 12:18:47 +00:00
add possibility to search for DLL in exe's path
This commit is contained in:
parent
41e73ab58d
commit
6ac6abd3de
15
src/main.c
15
src/main.c
@ -41,8 +41,10 @@ int check_path(char* path) {
|
||||
|
||||
static const char* dll_name = "libproxychains4.so";
|
||||
|
||||
static char own_dir[256];
|
||||
static const char* dll_dirs[] = {
|
||||
".",
|
||||
own_dir,
|
||||
LIB_DIR,
|
||||
"/lib",
|
||||
"/usr/lib",
|
||||
@ -51,6 +53,17 @@ static const char* dll_dirs[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static void set_own_dir(const char* argv0) {
|
||||
size_t l = strlen(argv0);
|
||||
while(l && argv0[l - 1] != '/') l--;
|
||||
if(l == 0)
|
||||
memcpy(own_dir, ".", 2);
|
||||
else {
|
||||
memcpy(own_dir, argv0, l - 1);
|
||||
own_dir[l] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *path = NULL;
|
||||
char buf[256];
|
||||
@ -114,6 +127,8 @@ int main(int argc, char *argv[]) {
|
||||
size_t i = 0;
|
||||
const char* prefix = NULL;
|
||||
|
||||
set_own_dir(argv[0]);
|
||||
|
||||
while(dll_dirs[i]) {
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dll_dirs[i], dll_name);
|
||||
if(access(buf, R_OK) != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user