Skip to content

Commit e6b5f24

Browse files
author
Adam Hamsik
committed
Merge branch 'rofl0r-master'
Conflicts: Makefile proxychains.lsm src/core.h src/libproxychains.c src/main.c
2 parents 17dbc76 + efa5738 commit e6b5f24

File tree

12 files changed

+304
-243
lines changed

12 files changed

+304
-243
lines changed

AUTHORS

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
original code
12
N3E7CR34TUR3.
3+
http://proxychains.sourceforge.net
4+
netcreature@users.sourceforge.net
25

3-
web site: proxychains.sourceforge.net
4-
email: netcreature@users.sourceforge.net
6+
main.c, remote-dns, thread safety, bugfixes, build system, cleanups
7+
rofl0r.
8+
https://github.com/rofl0r/proxychains
59

10+
localnet, bugfixes
11+
adam hamsik.
12+
https://github.com/haad/proxychains
13+
14+
localnet-port, bugfixes
15+
jianing yang.
16+
https://github.com/jianingy/proxychains

INSTALL

Lines changed: 0 additions & 13 deletions
This file was deleted.

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ bindir = $(exec_prefix)/bin
1515

1616
SRCS = $(sort $(wildcard src/*.c))
1717
OBJS = $(SRCS:.c=.o)
18-
LOBJS = src/core.o src/libproxychains.o
18+
LOBJS = src/core.o src/common.o src/libproxychains.o
1919

2020
CCFLAGS = -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE -Werror
2121
LDFLAGS = -shared -fPIC -ldl -lpthread
@@ -43,15 +43,17 @@ LDFLAGS+=$(USER_LDFLAGS) $(MAC_LDFLAGS)
4343
CXXFLAGS+=$(CCFLAGS) $(USER_CFLAGS) $(MAC_CFLAGS)
4444
CFLAGS_MAIN=-DLIB_DIR=\"$(libdir)\" -DINSTALL_PREFIX=\"$(prefix)\" -DDLL_NAME=\"$(LDSO_PATHNAME)\"
4545

46-
4746
all: $(ALL_LIBS) $(ALL_TOOLS)
4847

4948
#install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(DESTDIR)$(LDSO_PATHNAME)
5049
install:
5150
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(libdir) $(DESTDIR)/$(confdir) $(DESTDIR)/$(includedir)
5251
install $(INSTALL_FLAGS) 755 $(ALL_TOOLS) $(DESTDIR)/$(bindir)/
5352
install $(INSTALL_FLAGS) 644 $(ALL_LIBS) $(DESTDIR)/$(libdir)/
54-
install $(INSTALL_FLAGS) 644 src/proxychains.conf $(DESTDIR)/$(confdir)
53+
54+
install-config:
55+
install -d $(DESTDIR)/$(confdir)
56+
install $(INSTALL_FLAGS) 644 src/proxychains.conf $(DESTDIR)/$(confdir)/
5557

5658
clean:
5759
rm -f $(ALL_LIBS)
@@ -65,6 +67,6 @@ $(LDSO_PATHNAME): $(LOBJS)
6567
$(CC) $(LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) -o $@ $(LOBJS)
6668

6769
$(ALL_TOOLS): $(OBJS)
68-
$(CC) src/main.o -o $(PXCHAINS)
70+
$(CC) src/main.o src/common.o -o $(PXCHAINS)
6971

70-
.PHONY: all clean install
72+
.PHONY: all clean install install-config

README

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
11
ProxyChains ver 4.0 README
22
==========================
33

4+
ProxyChains is a UNIX program, that hooks network-related libc functions
5+
in dynamically linked programs via a preloaded DLL and redirects the
6+
connections through SOCKS4a/5 or HTTP proxies.
7+
48
*********** ATTENTION ***********
59

6-
this program works only on dynamically linked programs.
7-
also both proxychains and the program to call must use
8-
the same dynamic linker (i.e. same libc)
10+
this program works only on dynamically linked programs.
11+
also both proxychains and the program to call must use
12+
the same dynamic linker (i.e. same libc)
913

1014
*********************************
1115

16+
*** Known limitations of the current version: ***
17+
18+
when a process forks, does a DNS lookup in the child, and then uses
19+
the ip in the parent, the corresponding ip mapping will not be found.
20+
this is because the fork can't write back into the parents mapping table.
21+
IRSSI shows this behaviour, so you have to pass the resolved ip address
22+
to it. (you can use the proxyresolv script (requires "dig") to do so)
23+
24+
this means that you can't currently use tor onion urls for irssi.
25+
to solve this issue, an external data store (file, pipe, ...) has to
26+
manage the dns <-> ip mapping. of course there has to be proper locking.
27+
shm_open, mkstemp, are possible candidates for a file based approach,
28+
the other option is to spawn some kind of server process that manages the
29+
map lookups. since connect() etc are hooked, this must not be a TCP server.
1230

13-
This is Unix version only.
31+
I am reluctant on doing this change, because the described behaviour
32+
seems pretty idiotic (doing a fork only for a DNS lookup), and irssi
33+
is currently the only known affected program.
1434

15-
How to mess with sources - How to Install : read INSTALL !!!!!!
35+
*** Installation ***
1636

17-
This program forces any tcp connection made by any given tcp client
18-
to follow through proxy (or proxy chain). It is a kind of proxifier.
19-
It acts like sockscap / permeo / eborder driver ( intercepts TCP calls )
20-
It is FREE.
37+
# needs a working C compiler, preferably gcc
38+
./configure
39+
make
40+
sudo make install
2141

2242
Changelog:
2343
----------
@@ -74,21 +94,21 @@ proxychains looks for config file in following order:
7494

7595
Usage Example:
7696

77-
bash$ proxychains telnet targethost.com
97+
$ proxychains telnet targethost.com
7898

7999
in this example it will run telnet through proxy(or chained proxies)
80100
specified by proxychains.conf
81101

82102
Usage Example:
83103

84-
bash$ proxychains -f /etc/proxychains-other.conf targethost2.com
104+
$ proxychains -f /etc/proxychains-other.conf targethost2.com
85105

86106
in this example it will use different configuration file then proxychains.conf
87107
to connect to targethost2.com host.
88108

89109
Usage Example:
90110

91-
bash$ proxyresolv targethost.com
111+
$ proxyresolv targethost.com
92112

93113
in this example it will resolve targethost.com through proxy(or chained proxies)
94114
specified by proxychains.conf

configure

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
prefix=/usr/local
44

5+
usage() {
6+
echo "supported arguments"
7+
echo "--prefix=/path default: $prefix"
8+
echo "--exec_prefix=/path default: $prefix/bin"
9+
echo "--bindir=/path default: $prefix/bin"
10+
echo "--libdir=/path default: $prefix/lib"
11+
echo "--includedir=/path default: $prefix/include"
12+
echo "--sysconfdir=/path default: $prefix/etc"
13+
echo "--help : show this text"
14+
exit 1
15+
}
16+
517
spliteq() {
618
arg=$1
719
echo "${arg#*=}"
@@ -17,6 +29,7 @@ parsearg() {
1729
--libdir=*) libdir=`spliteq $1`;;
1830
--includedir=*) includedir=`spliteq $1`;;
1931
--sysconfdir=*) sysconfdir=`spliteq $1`;;
32+
--help) usage;;
2033
esac
2134
}
2235

src/common.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include "common.h"
2+
#include <stdlib.h>
3+
#include <unistd.h>
4+
#include <stdio.h>
5+
6+
static int check_path(char *path) {
7+
if(!path)
8+
return 0;
9+
return access(path, R_OK) != -1;
10+
}
11+
12+
char *get_config_path(char* default_path, char* pbuf, size_t bufsize) {
13+
char buf[512];
14+
// top priority: user defined path
15+
char *path = default_path;
16+
if(check_path(path))
17+
return path;
18+
19+
// priority 1: env var PROXYCHAINS_CONF_FILE
20+
path = getenv(PROXYCHAINS_CONF_FILE_ENV_VAR);
21+
if(check_path(path))
22+
return path;
23+
24+
// priority 2; proxychains conf in actual dir
25+
path = getcwd(buf, sizeof(buf));
26+
snprintf(pbuf, bufsize, "%s/%s", path, PROXYCHAINS_CONF_FILE);
27+
path = pbuf;
28+
if(check_path(path))
29+
return path;
30+
31+
// priority 3; $HOME/.proxychains/proxychains.conf
32+
path = getenv("HOME");
33+
snprintf(pbuf, bufsize, "%s/.proxychains/%s", path, PROXYCHAINS_CONF_FILE);
34+
path = pbuf;
35+
if(check_path(path))
36+
return path;
37+
38+
// priority 4: $SYSCONFDIR/proxychains.conf
39+
path = SYSCONFDIR "/" PROXYCHAINS_CONF_FILE;
40+
if(check_path(path))
41+
return path;
42+
43+
// priority 5: /etc/proxychains.conf
44+
path = "/etc/" PROXYCHAINS_CONF_FILE;
45+
if(check_path(path))
46+
return path;
47+
48+
perror("couldnt find configuration file");
49+
exit(1);
50+
}

src/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
#define PROXYCHAINS_QUIET_MODE_ENV_VAR "PROXYCHAINS_QUIET_MODE"
33
#define PROXYCHAINS_CONF_FILE "proxychains.conf"
44
#define LOG_PREFIX "[proxychains] "
5+
6+
#include <stddef.h>
7+
8+
char *get_config_path(char* default_path, char* pbuf, size_t bufsize);

0 commit comments

Comments
 (0)