Initial release
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,7 +9,7 @@
|
||||
*~
|
||||
*.patch
|
||||
|
||||
# Autoconf stuff
|
||||
# Autoconf files
|
||||
libtool
|
||||
config.*
|
||||
stamp-h
|
||||
|
24
AUTHORS
24
AUTHORS
@@ -1,23 +1,11 @@
|
||||
original code up to version 3.1
|
||||
N3E7CR34TUR3.
|
||||
http://proxychains.sourceforge.net
|
||||
netcreature@users.sourceforge.net
|
||||
Proxybound v4.x: intika https://github.com/Intika-Linux-Proxy/Proxybound
|
||||
|
||||
main.c, remote-dns, thread safety, bugfixes, build system,
|
||||
cleanups, mac support
|
||||
rofl0r.
|
||||
https://github.com/rofl0r/proxychains
|
||||
Proxychains-ng v4.x: rofl0r https://github.com/rofl0r/proxychains
|
||||
|
||||
localnet, bugfixes
|
||||
jianing yang.
|
||||
https://github.com/jianingy/proxychains
|
||||
https://sourceforge.net/projects/proxychains/forums/forum/644747/topic/3498696
|
||||
Proxychains v4.x: jianingy https://github.com/jianingy/proxychains
|
||||
|
||||
poll_retry (fixes for signal handling)
|
||||
colin cross.
|
||||
https://sourceforge.net/projects/proxychains/forums/forum/644747/topic/2367923
|
||||
Proxychains v4.x: colin-cross https://sourceforge.net/projects/proxychains/forums/forum/644747/topic/2367923
|
||||
|
||||
collecting patches from px forum and putting it into a repo
|
||||
adam hamsik.
|
||||
https://github.com/haad/proxychains
|
||||
Proxychains v4.x: haad https://github.com/haad/proxychains
|
||||
|
||||
Proxychains v3.1: N3E7CR34TUR3 http://proxychains.sourceforge.net
|
||||
|
65
ChangeLog
65
ChangeLog
@@ -1,65 +0,0 @@
|
||||
ProxyChains version history (public releases)
|
||||
====================
|
||||
|
||||
ver 3.1
|
||||
|
||||
changed:
|
||||
* dns resolver script fix
|
||||
* prototypes in core.h
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
ver 3.0
|
||||
|
||||
added:
|
||||
* new feature - DNS from behind proxy
|
||||
* proxyresolv - stand alone command
|
||||
* proxychains.conf - new option to enable/disable DNS support
|
||||
|
||||
changed:
|
||||
* bugfixes in core lib
|
||||
* fixed strict chain
|
||||
* fixed random chain
|
||||
* output text
|
||||
* autotools fix
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
ver 2.1
|
||||
* bugfuxes
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
ver 2.0
|
||||
* major core rewrite
|
||||
* new config options
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
ver 1.8.2
|
||||
* minor bugfixes
|
||||
* improved compilation on FreeBSD & OpenBSD sysems.
|
||||
* improved compilation on Sun Solaris systems .
|
||||
* cross platform (UNIX) issues
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
ver 1.8.0
|
||||
|
||||
added:
|
||||
* Socks5 protocol
|
||||
* Socks4 protocol
|
||||
* HTTP proxy auth basic
|
||||
* Socks4 user auth
|
||||
* Socks5 user/pass auth
|
||||
* more chain options (random, strict, dynamic )
|
||||
* configurable timeout for TCP connect.
|
||||
* configurable timeout for TCP read.
|
||||
* INSTALL file (explains how to install properly)
|
||||
|
||||
changed:
|
||||
* configuration file entries (proxychains.conf)
|
||||
* configuration file lookup
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
ver 0.0.1
|
||||
* TCP calls interception
|
||||
* HTTP CONNECT proxy protocol.
|
10
Makefile
10
Makefile
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Makefile for proxychains (requires GNU make), stolen from musl
|
||||
# Makefile for proxybound
|
||||
#
|
||||
# Use config.mak to override any of the following variables.
|
||||
# Do not make changes here.
|
||||
@@ -15,7 +15,7 @@ sysconfdir=$(prefix)/etc
|
||||
|
||||
SRCS = $(sort $(wildcard src/*.c))
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LOBJS = src/core.o src/common.o src/libproxychains.o src/shm.o \
|
||||
LOBJS = src/core.o src/common.o src/libproxybound.o src/shm.o \
|
||||
src/allocator_thread.o src/ip_type.o src/stringdump.o \
|
||||
src/hostentdb.o src/hash.o
|
||||
|
||||
@@ -32,11 +32,11 @@ INSTALL_FLAGS = -D -m
|
||||
|
||||
-include config.mak
|
||||
|
||||
LDSO_PATHNAME = libproxychains4.$(LDSO_SUFFIX)
|
||||
LDSO_PATHNAME = libproxybound.$(LDSO_SUFFIX)
|
||||
|
||||
SHARED_LIBS = $(LDSO_PATHNAME)
|
||||
ALL_LIBS = $(SHARED_LIBS)
|
||||
PXCHAINS = proxychains4
|
||||
PXCHAINS = proxybound
|
||||
ALL_TOOLS = $(PXCHAINS)
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ all: $(ALL_LIBS) $(ALL_TOOLS)
|
||||
|
||||
install-config:
|
||||
install -d $(DESTDIR)/$(sysconfdir)
|
||||
install $(INSTALL_FLAGS) 644 src/proxychains.conf $(DESTDIR)/$(sysconfdir)/
|
||||
install $(INSTALL_FLAGS) 644 src/proxybound.conf $(DESTDIR)/$(sysconfdir)/
|
||||
|
||||
install:
|
||||
install -d $(DESTDIR)/$(bindir)/ $(DESTDIR)/$(libdir)/
|
||||
|
120
README
120
README
@@ -1,121 +1,67 @@
|
||||
ProxyChains ver 4.3 README
|
||||
==========================
|
||||
ProxyBound v4.5
|
||||
===============
|
||||
|
||||
ProxyChains is a UNIX program, that hooks network-related libc functions
|
||||
ProxyBound is a UNIX program, that hooks network-related libc functions
|
||||
in dynamically linked programs via a preloaded DLL and redirects the
|
||||
connections through SOCKS4a/5 or HTTP proxies.
|
||||
|
||||
*********** ATTENTION ***********
|
||||
It's based on proxychains-ng by rofl0r
|
||||
|
||||
How it works:
|
||||
=============
|
||||
|
||||
this program works only on dynamically linked programs.
|
||||
also both proxychains and the program to call must use
|
||||
also both proxybound and the program to call must use
|
||||
the same dynamic linker (i.e. same libc).
|
||||
why ? because in order to hook to libc functions like
|
||||
connect(), dynamic loader facilities are used, namely
|
||||
dl_sym() and LD_PRELOAD.
|
||||
|
||||
*********************************
|
||||
Install:
|
||||
========
|
||||
|
||||
*** Installation ***
|
||||
|
||||
# needs a working C compiler, preferably gcc
|
||||
./configure
|
||||
make
|
||||
[optional] sudo make install
|
||||
|
||||
if you dont install, you can use proxychains from the build directory
|
||||
like this: ./proxychains4 -f src/proxychains.conf telnet google.com 80
|
||||
if you dont install, you can use proxybound from the build directory
|
||||
like this: ./proxybound -f src/proxybound.conf telnet google.com 80
|
||||
|
||||
Changelog:
|
||||
----------
|
||||
==========
|
||||
|
||||
Version 4.3:
|
||||
- fixes programs that do dns-lookups in child processes (fork()ed),
|
||||
like irssi. to achieve this, support for compilation without pthreads
|
||||
was sacrified.
|
||||
- fixes thread safety for gethostent() calls.
|
||||
- improved DNS handling speed, since hostent db is cached.
|
||||
|
||||
Version 4.2:
|
||||
- fixes compilation issues with ubuntu 12.04 toolchain
|
||||
- fixes segfault in rare codepath
|
||||
|
||||
Version 4.1
|
||||
- support for mac os x (all archs)
|
||||
- all internal functions are threadsafe when compiled with -DTHREAD_SAFE
|
||||
(default).
|
||||
|
||||
Version 4.0
|
||||
- replaced dnsresolver script (which required a dynamically linked "dig"
|
||||
binary to be present) with remote DNS lookup.
|
||||
this speeds up any operation involving DNS, as the old script had to use TCP.
|
||||
additionally it allows to use .onion urls when used with TOR.
|
||||
- removed broken autoconf build system with a simple Makefile.
|
||||
there's a ./configure script though for convenience.
|
||||
it also adds support for a config file passed via command line switches/
|
||||
environment variables.
|
||||
|
||||
Version 3.0
|
||||
- support for DNS resolving through proxy
|
||||
supports SOCKS4, SOCKS5 and HTTP CONNECT proxy servers.
|
||||
Auth-types: socks - "user/pass" , http - "basic".
|
||||
|
||||
When to use it ?
|
||||
1) When the only way to get "outside" from your LAN is through proxy server.
|
||||
2) To get out from behind restrictive firewall which filters outgoing ports.
|
||||
3) To use two (or more) proxies in chain:
|
||||
like: your_host <--> proxy1 <--> proxy2 <--> target_host
|
||||
4) To "proxify" some program with no proxy support built-in (like telnet)
|
||||
5) Access intranet from outside via proxy.
|
||||
6) To use DNS behind proxy.
|
||||
7) To access hidden tor onion services.
|
||||
|
||||
Some cool features:
|
||||
|
||||
* This program can mix different proxy types in the same chain
|
||||
like: your_host <-->socks5 <--> http <--> socks4 <--> target_host
|
||||
* Different chaining options supported
|
||||
random order from the list ( user defined length of chain ).
|
||||
exact order (as they appear in the list )
|
||||
dynamic order (smart exclude dead proxies from chain)
|
||||
* You can use it with any TCP client application, even network scanners
|
||||
yes, yes - you can make portscan via proxy (or chained proxies)
|
||||
for example with Nmap scanner by fyodor (www.insecire.org/nmap).
|
||||
proxychains nmap -sT -PO -p 80 -iR (find some webservers through proxy)
|
||||
* You can use it with servers, like squid, sendmail, or whatever.
|
||||
* DNS resolving through proxy.
|
||||
Version 4.5:
|
||||
- Changing the name to ProxyBound
|
||||
|
||||
Version 4.4:
|
||||
- Import security issue fix CVE-2015-3887
|
||||
|
||||
Configuration:
|
||||
--------------
|
||||
==============
|
||||
|
||||
proxychains looks for config file in following order:
|
||||
1) file listed in environment variable ${PROXYCHAINS_CONF_FILE} or
|
||||
provided as a -f argument to proxychains script or binary.
|
||||
2) ./proxychains.conf
|
||||
3) $(HOME)/.proxychains/proxychains.conf
|
||||
4) /etc/proxychains.conf **
|
||||
Proxybound config file in following order:
|
||||
|
||||
**see more in /etc/proxychains.conf
|
||||
1) File listed in environment variable ${PROXYBOUND_CONF_FILE} or
|
||||
provided as a -f argument to proxybound script or binary.
|
||||
2) ./proxybound.conf
|
||||
3) $(HOME)/.proxybound/proxybound.conf
|
||||
4) /etc/proxybound.conf
|
||||
|
||||
Usage Example:
|
||||
==============
|
||||
|
||||
$ proxychains telnet targethost.com
|
||||
$ proxybound telnet targethost.com
|
||||
|
||||
in this example it will run telnet through proxy(or chained proxies)
|
||||
specified by proxychains.conf
|
||||
in this example it will run telnet through proxy(or chained proxies)
|
||||
specified by proxybound.conf
|
||||
|
||||
Usage Example:
|
||||
$ proxybound -f /etc/proxybound-other.conf targethost2.com
|
||||
|
||||
$ proxychains -f /etc/proxychains-other.conf targethost2.com
|
||||
|
||||
in this example it will use different configuration file then proxychains.conf
|
||||
to connect to targethost2.com host.
|
||||
|
||||
Usage Example:
|
||||
in this example it will use different configuration file then proxybound.conf
|
||||
to connect to targethost2.com host.
|
||||
|
||||
$ proxyresolv targethost.com
|
||||
|
||||
in this example it will resolve targethost.com through proxy(or chained proxies)
|
||||
specified by proxychains.conf
|
||||
in this example it will resolve targethost.com through proxy(or chained proxies)
|
||||
specified by proxybound.conf
|
||||
|
||||
|
7
TODO
7
TODO
@@ -1,7 +0,0 @@
|
||||
ProxyChains ver 4.0 TODO
|
||||
===================
|
||||
|
||||
|
||||
hooks for reentrant dns functions, i.e. gethostbyaddr_r
|
||||
|
||||
|
6
dist/config.mak
vendored
6
dist/config.mak
vendored
@@ -1,7 +1,7 @@
|
||||
### config.mak template for proxychains
|
||||
#######################################
|
||||
### config.mak template for proxybound
|
||||
######################################
|
||||
|
||||
# just copy into proxychains root dir and adapt to your needs.
|
||||
# just copy into proxybound root dir and adapt to your needs.
|
||||
|
||||
prefix = /usr/local/
|
||||
libdir = $(prefix)/lib
|
||||
|
20
src/common.c
20
src/common.c
@@ -40,32 +40,32 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) {
|
||||
if(check_path(path))
|
||||
goto have;
|
||||
|
||||
// priority 1: env var PROXYCHAINS_CONF_FILE
|
||||
path = getenv(PROXYCHAINS_CONF_FILE_ENV_VAR);
|
||||
// priority 1: env var PROXYBOUND_CONF_FILE
|
||||
path = getenv(PROXYBOUND_CONF_FILE_ENV_VAR);
|
||||
if(check_path(path))
|
||||
goto have;
|
||||
|
||||
// priority 2; proxychains conf in actual dir
|
||||
// priority 2; proxybound conf in actual dir
|
||||
path = getcwd(buf, sizeof(buf));
|
||||
snprintf(pbuf, bufsize, "%s/%s", path, PROXYCHAINS_CONF_FILE);
|
||||
snprintf(pbuf, bufsize, "%s/%s", path, PROXYBOUND_CONF_FILE);
|
||||
path = pbuf;
|
||||
if(check_path(path))
|
||||
goto have;
|
||||
|
||||
// priority 3; $HOME/.proxychains/proxychains.conf
|
||||
// priority 3; $HOME/.proxybound/proxybound.conf
|
||||
path = getenv("HOME");
|
||||
snprintf(pbuf, bufsize, "%s/.proxychains/%s", path, PROXYCHAINS_CONF_FILE);
|
||||
snprintf(pbuf, bufsize, "%s/.proxybound/%s", path, PROXYBOUND_CONF_FILE);
|
||||
path = pbuf;
|
||||
if(check_path(path))
|
||||
goto have;
|
||||
|
||||
// priority 4: $SYSCONFDIR/proxychains.conf
|
||||
path = SYSCONFDIR "/" PROXYCHAINS_CONF_FILE;
|
||||
// priority 4: $SYSCONFDIR/proxybound.conf
|
||||
path = SYSCONFDIR "/" PROXYBOUND_CONF_FILE;
|
||||
if(check_path(path))
|
||||
goto have;
|
||||
|
||||
// priority 5: /etc/proxychains.conf
|
||||
path = "/etc/" PROXYCHAINS_CONF_FILE;
|
||||
// priority 5: /etc/proxybound.conf
|
||||
path = "/etc/" PROXYBOUND_CONF_FILE;
|
||||
if(check_path(path))
|
||||
goto have;
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#define PROXYCHAINS_CONF_FILE_ENV_VAR "PROXYCHAINS_CONF_FILE"
|
||||
#define PROXYCHAINS_QUIET_MODE_ENV_VAR "PROXYCHAINS_QUIET_MODE"
|
||||
#define PROXYCHAINS_CONF_FILE "proxychains.conf"
|
||||
#define LOG_PREFIX "[proxychains] "
|
||||
#define PROXYBOUND_CONF_FILE_ENV_VAR "PROXYBOUND_CONF_FILE"
|
||||
#define PROXYBOUND_QUIET_MODE_ENV_VAR "PROXYBOUND_QUIET_MODE"
|
||||
#define PROXYBOUND_CONF_FILE "proxybound.conf"
|
||||
#define LOG_PREFIX "[proxybound] "
|
||||
#ifndef SYSCONFDIR
|
||||
#define SYSCONFDIR "/etc"
|
||||
#endif
|
||||
|
32
src/core.c
32
src/core.c
@@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
core.c - description
|
||||
-------------------
|
||||
core.c
|
||||
------
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
extern int tcp_read_time_out;
|
||||
extern int tcp_connect_time_out;
|
||||
extern int proxychains_quiet_mode;
|
||||
extern int proxybound_quiet_mode;
|
||||
extern unsigned int remote_dns_subnet;
|
||||
|
||||
static int poll_retry(struct pollfd *fds, nfds_t nfsd, int timeout) {
|
||||
@@ -105,10 +105,10 @@ static void encode_base_64(char *src, char *dest, int max_len) {
|
||||
*dest++ = 0;
|
||||
}
|
||||
|
||||
void proxychains_write_log(char *str, ...) {
|
||||
void proxybound_write_log(char *str, ...) {
|
||||
char buff[1024*20];
|
||||
va_list arglist;
|
||||
if(!proxychains_quiet_mode) {
|
||||
if(!proxybound_quiet_mode) {
|
||||
va_start(arglist, str);
|
||||
vsnprintf(buff, sizeof(buff), str, arglist);
|
||||
va_end(arglist);
|
||||
@@ -210,7 +210,7 @@ static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, c
|
||||
size_t passlen = strlen(pass);
|
||||
|
||||
if(ulen > 0xFF || passlen > 0xFF || dns_len > 0xFF) {
|
||||
proxychains_write_log(LOG_PREFIX "error: maximum size of 255 for user/pass or domain name!\n");
|
||||
proxybound_write_log(LOG_PREFIX "error: maximum size of 255 for user/pass or domain name!\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ static int start_chain(int *fd, proxy_data * pd, char *begin_mark) {
|
||||
goto error;
|
||||
|
||||
pc_stringfromipv4(&pd->ip.octet[0], ip_buf);
|
||||
proxychains_write_log(LOG_PREFIX "%s " TP " %s:%d ",
|
||||
proxybound_write_log(LOG_PREFIX "%s " TP " %s:%d ",
|
||||
begin_mark, ip_buf, htons(pd->port));
|
||||
pd->ps = PLAY_STATE;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
@@ -451,7 +451,7 @@ static int start_chain(int *fd, proxy_data * pd, char *begin_mark) {
|
||||
pd->ps = BUSY_STATE;
|
||||
return SUCCESS;
|
||||
error1:
|
||||
proxychains_write_log(TP " timeout\n");
|
||||
proxybound_write_log(TP " timeout\n");
|
||||
error:
|
||||
if(*fd != -1)
|
||||
close(*fd);
|
||||
@@ -528,7 +528,7 @@ static int chain_step(int ns, proxy_data * pfrom, proxy_data * pto) {
|
||||
hostname = ip_buf;
|
||||
}
|
||||
|
||||
proxychains_write_log(TP " %s:%d ", hostname, htons(pto->port));
|
||||
proxybound_write_log(TP " %s:%d ", hostname, htons(pto->port));
|
||||
retcode = tunnel_to(ns, pto->ip, pto->port, pfrom->pt, pfrom->user, pfrom->pass);
|
||||
switch (retcode) {
|
||||
case SUCCESS:
|
||||
@@ -536,12 +536,12 @@ static int chain_step(int ns, proxy_data * pfrom, proxy_data * pto) {
|
||||
break;
|
||||
case BLOCKED:
|
||||
pto->ps = BLOCKED_STATE;
|
||||
proxychains_write_log("<--denied\n");
|
||||
proxybound_write_log("<--denied\n");
|
||||
close(ns);
|
||||
break;
|
||||
case SOCKET_ERROR:
|
||||
pto->ps = DOWN_STATE;
|
||||
proxychains_write_log("<--socket error or timeout!\n");
|
||||
proxybound_write_log("<--socket error or timeout!\n");
|
||||
close(ns);
|
||||
break;
|
||||
}
|
||||
@@ -582,7 +582,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
}
|
||||
p1 = p2;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
//proxybound_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
if(SUCCESS != chain_step(ns, p1, p3))
|
||||
@@ -609,7 +609,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
}
|
||||
p1 = p2;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
//proxybound_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
if(SUCCESS != chain_step(ns, p1, p3))
|
||||
@@ -634,7 +634,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
}
|
||||
p1 = p2;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
//proxybound_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
if(SUCCESS != chain_step(ns, p1, p3))
|
||||
@@ -642,7 +642,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
|
||||
}
|
||||
|
||||
proxychains_write_log(TP " OK\n");
|
||||
proxybound_write_log(TP " OK\n");
|
||||
dup2(ns, sock);
|
||||
close(ns);
|
||||
return 0;
|
||||
@@ -653,7 +653,7 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
return -1;
|
||||
|
||||
error_more:
|
||||
proxychains_write_log("\n!!!need more proxies!!!\n");
|
||||
proxybound_write_log("\n!!!need more proxies!!!\n");
|
||||
error_strict:
|
||||
PDEBUG("error\n");
|
||||
|
||||
|
@@ -1,10 +1,11 @@
|
||||
/***************************************************************************
|
||||
core.h - description
|
||||
-------------------
|
||||
core.h
|
||||
------
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
***************************************************************************
|
||||
* GPL *
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -80,7 +81,7 @@ int connect_proxy_chain (int sock, ip_type target_ip, unsigned short target_port
|
||||
proxy_data * pd, unsigned int proxy_count, chain_type ct,
|
||||
unsigned int max_chain );
|
||||
|
||||
void proxychains_write_log(char *str, ...);
|
||||
void proxybound_write_log(char *str, ...);
|
||||
|
||||
typedef int (*connect_t)(int, const struct sockaddr *, socklen_t);
|
||||
typedef struct hostent* (*gethostbyname_t)(const char *);
|
||||
@@ -122,5 +123,5 @@ void core_unload(void);
|
||||
#endif
|
||||
|
||||
//RcB: DEP "core.c"
|
||||
//RcB: DEP "libproxychains.c"
|
||||
//RcB: DEP "libproxybound.c"
|
||||
//RcB: LINK "-Wl,--no-as-needed -ldl -lpthread"
|
@@ -1,12 +1,12 @@
|
||||
/***************************************************************************
|
||||
libproxychains.c - description
|
||||
-------------------
|
||||
libproxybound.c
|
||||
---------------
|
||||
begin : Tue May 14 2002
|
||||
copyright : netcreature (C) 2002
|
||||
email : netcreature@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
/* GPL */
|
||||
/***************************************************************************
|
||||
***************************************************************************
|
||||
* GPL *
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -54,13 +54,13 @@ gethostbyaddr_t true_gethostbyaddr;
|
||||
|
||||
int tcp_read_time_out;
|
||||
int tcp_connect_time_out;
|
||||
chain_type proxychains_ct;
|
||||
proxy_data proxychains_pd[MAX_CHAIN];
|
||||
unsigned int proxychains_proxy_count = 0;
|
||||
int proxychains_got_chain_data = 0;
|
||||
unsigned int proxychains_max_chain = 1;
|
||||
int proxychains_quiet_mode = 0;
|
||||
int proxychains_resolver = 0;
|
||||
chain_type proxybound_ct;
|
||||
proxy_data proxybound_pd[MAX_CHAIN];
|
||||
unsigned int proxybound_proxy_count = 0;
|
||||
int proxybound_got_chain_data = 0;
|
||||
unsigned int proxybound_max_chain = 1;
|
||||
int proxybound_quiet_mode = 0;
|
||||
int proxybound_resolver = 0;
|
||||
localaddr_arg localnet_addr[MAX_LOCALNET];
|
||||
size_t num_localnet_addr = 0;
|
||||
unsigned int remote_dns_subnet = 224;
|
||||
@@ -103,9 +103,9 @@ static void do_init(void) {
|
||||
at_init();
|
||||
|
||||
/* read the config file */
|
||||
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
|
||||
get_chain_data(proxybound_pd, &proxybound_proxy_count, &proxybound_ct);
|
||||
|
||||
proxychains_write_log(LOG_PREFIX "DLL init\n");
|
||||
proxybound_write_log(LOG_PREFIX "DLL init\n");
|
||||
|
||||
SETUP_SYM(connect);
|
||||
SETUP_SYM(gethostbyname);
|
||||
@@ -157,7 +157,7 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
|
||||
char local_in_addr[32], local_in_port[32], local_netmask[32];
|
||||
FILE *file = NULL;
|
||||
|
||||
if(proxychains_got_chain_data)
|
||||
if(proxybound_got_chain_data)
|
||||
return;
|
||||
|
||||
//Some defaults
|
||||
@@ -165,12 +165,12 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
|
||||
tcp_connect_time_out = 10 * 1000;
|
||||
*ct = DYNAMIC_TYPE;
|
||||
|
||||
env = get_config_path(getenv(PROXYCHAINS_CONF_FILE_ENV_VAR), buff, sizeof(buff));
|
||||
env = get_config_path(getenv(PROXYBOUND_CONF_FILE_ENV_VAR), buff, sizeof(buff));
|
||||
file = fopen(env, "r");
|
||||
|
||||
env = getenv(PROXYCHAINS_QUIET_MODE_ENV_VAR);
|
||||
env = getenv(PROXYBOUND_QUIET_MODE_ENV_VAR);
|
||||
if(env && *env == '1')
|
||||
proxychains_quiet_mode = 1;
|
||||
proxybound_quiet_mode = 1;
|
||||
|
||||
while(fgets(buff, sizeof(buff), file)) {
|
||||
if(buff[0] != '\n' && buff[strspn(buff, " ")] != '#') {
|
||||
@@ -266,18 +266,18 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
|
||||
int len;
|
||||
pc = strchr(buff, '=');
|
||||
len = atoi(++pc);
|
||||
proxychains_max_chain = (len ? len : 1);
|
||||
proxybound_max_chain = (len ? len : 1);
|
||||
} else if(strstr(buff, "quiet_mode")) {
|
||||
proxychains_quiet_mode = 1;
|
||||
proxybound_quiet_mode = 1;
|
||||
} else if(strstr(buff, "proxy_dns")) {
|
||||
proxychains_resolver = 1;
|
||||
proxybound_resolver = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
*proxy_count = count;
|
||||
proxychains_got_chain_data = 1;
|
||||
proxybound_got_chain_data = 1;
|
||||
}
|
||||
|
||||
/******* HOOK FUNCTIONS *******/
|
||||
@@ -332,7 +332,7 @@ int connect(int sock, const struct sockaddr *addr, unsigned int len) {
|
||||
ret = connect_proxy_chain(sock,
|
||||
dest_ip,
|
||||
SOCKPORT(*addr),
|
||||
proxychains_pd, proxychains_proxy_count, proxychains_ct, proxychains_max_chain);
|
||||
proxybound_pd, proxybound_proxy_count, proxybound_ct, proxybound_max_chain);
|
||||
|
||||
fcntl(sock, F_SETFL, flags);
|
||||
if(ret != SUCCESS)
|
||||
@@ -346,7 +346,7 @@ struct hostent *gethostbyname(const char *name) {
|
||||
|
||||
PDEBUG("gethostbyname: %s\n", name);
|
||||
|
||||
if(proxychains_resolver)
|
||||
if(proxybound_resolver)
|
||||
return proxy_gethostbyname(name, &ghbndata);
|
||||
else
|
||||
return true_gethostbyname(name);
|
||||
@@ -361,7 +361,7 @@ int getaddrinfo(const char *node, const char *service, const struct addrinfo *hi
|
||||
|
||||
PDEBUG("getaddrinfo: %s %s\n", node ? node : "null", service ? service : "null");
|
||||
|
||||
if(proxychains_resolver)
|
||||
if(proxybound_resolver)
|
||||
ret = proxy_getaddrinfo(node, service, hints, res);
|
||||
else
|
||||
ret = true_getaddrinfo(node, service, hints, res);
|
||||
@@ -374,7 +374,7 @@ void freeaddrinfo(struct addrinfo *res) {
|
||||
|
||||
PDEBUG("freeaddrinfo %p \n", res);
|
||||
|
||||
if(!proxychains_resolver)
|
||||
if(!proxybound_resolver)
|
||||
true_freeaddrinfo(res);
|
||||
else
|
||||
proxy_freeaddrinfo(res);
|
||||
@@ -398,7 +398,7 @@ int getnameinfo(const struct sockaddr *sa,
|
||||
|
||||
PDEBUG("getnameinfo: %s %s\n", host, serv);
|
||||
|
||||
if(!proxychains_resolver) {
|
||||
if(!proxybound_resolver) {
|
||||
ret = true_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
|
||||
} else {
|
||||
if(hostlen) {
|
||||
@@ -422,7 +422,7 @@ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
|
||||
|
||||
PDEBUG("TODO: proper gethostbyaddr hook\n");
|
||||
|
||||
if(!proxychains_resolver)
|
||||
if(!proxybound_resolver)
|
||||
return true_gethostbyaddr(addr, len, type);
|
||||
else {
|
||||
|
17
src/main.c
17
src/main.c
@@ -1,4 +1,7 @@
|
||||
/* (C) 2011, 2012 rofl0r
|
||||
/***************************************************************************
|
||||
* *
|
||||
* (C) 2019 intika *
|
||||
* (C) 2011, 2012 rofl0r *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -23,9 +26,9 @@
|
||||
|
||||
static int usage(char **argv) {
|
||||
printf("\nUsage:\t%s -q -f config_file program_name [arguments]\n"
|
||||
"\t-q makes proxychains quiet - this overrides the config setting\n"
|
||||
"\t-q makes proxybound quiet - this overrides the config setting\n"
|
||||
"\t-f allows to manually specify a configfile to use\n"
|
||||
"\tfor example : proxychains telnet somehost.com\n" "More help in README file\n\n", argv[0]);
|
||||
"\tfor example : proxybound telnet somehost.com\n" "More help in README file\n\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -94,11 +97,11 @@ int main(int argc, char *argv[]) {
|
||||
if(!quiet)
|
||||
fprintf(stderr, LOG_PREFIX "config file found: %s\n", path);
|
||||
|
||||
/* Set PROXYCHAINS_CONF_FILE to get proxychains lib to use new config file. */
|
||||
setenv(PROXYCHAINS_CONF_FILE_ENV_VAR, path, 1);
|
||||
/* Set PROXYBOUND_CONF_FILE to get proxybound lib to use new config file. */
|
||||
setenv(PROXYBOUND_CONF_FILE_ENV_VAR, path, 1);
|
||||
|
||||
if(quiet)
|
||||
setenv(PROXYCHAINS_QUIET_MODE_ENV_VAR, "1", 1);
|
||||
setenv(PROXYBOUND_QUIET_MODE_ENV_VAR, "1", 1);
|
||||
|
||||
|
||||
// search DLL
|
||||
@@ -132,7 +135,7 @@ int main(int argc, char *argv[]) {
|
||||
putenv("DYLD_FORCE_FLAT_NAMESPACE=1");
|
||||
#endif
|
||||
execvp(argv[start_argv], &argv[start_argv]);
|
||||
perror("proxychains can't load process....");
|
||||
perror("proxybound can't load process....");
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@@ -1,42 +1,52 @@
|
||||
# proxychains.conf VER 4.x
|
||||
#
|
||||
# HTTP, SOCKS4a, SOCKS5 tunneling proxifier with DNS.
|
||||
# proxybound.conf
|
||||
#
|
||||
# HTTP, SOCKS4a, SOCKS5, DNS.
|
||||
#
|
||||
|
||||
# ========================================================================================
|
||||
|
||||
# The option below identifies how the ProxyList is treated.
|
||||
# only one option should be uncommented at time,
|
||||
# otherwise the last appearing option will be accepted
|
||||
#
|
||||
#dynamic_chain
|
||||
#
|
||||
# Dynamic - Each connection will be done via chained proxies
|
||||
# all proxies chained in the order as they appear in the list
|
||||
# at least one proxy must be online to play in chain
|
||||
# (dead proxies are skipped)
|
||||
# otherwise EINTR is returned to the app
|
||||
#
|
||||
strict_chain
|
||||
#
|
||||
# Strict - Each connection will be done via chained proxies
|
||||
# all proxies chained in the order as they appear in the list
|
||||
# all proxies must be online to play in chain
|
||||
# otherwise EINTR is returned to the app
|
||||
#
|
||||
#random_chain
|
||||
#
|
||||
# Random - Each connection will be done via random proxy
|
||||
# (or proxy chain, see chain_len) from the list.
|
||||
# this option is good to test your IDS :)
|
||||
#
|
||||
# Only one chaining option should be uncommented at time,
|
||||
# otherwise the last appearing option will be accepted
|
||||
|
||||
#dynamic_chain
|
||||
strict_chain
|
||||
#random_chain
|
||||
|
||||
# ========================================================================================
|
||||
|
||||
# Make sense only if random_chain
|
||||
#chain_len = 2
|
||||
|
||||
# ========================================================================================
|
||||
|
||||
# Quiet mode (no output from library)
|
||||
#quiet_mode
|
||||
|
||||
# ========================================================================================
|
||||
|
||||
# Proxy DNS requests - no leak for DNS data
|
||||
proxy_dns
|
||||
|
||||
#remote_dns_subnet 127
|
||||
#remote_dns_subnet 10
|
||||
remote_dns_subnet 224
|
||||
|
||||
# set the class A subnet number to use for the internal remote DNS mapping
|
||||
# we use the reserved 224.x.x.x range by default,
|
||||
# if the proxified app does a DNS request, we will return an IP from that range.
|
||||
@@ -46,55 +56,58 @@ proxy_dns
|
||||
# of course you should make sure that the proxified app does not need
|
||||
# *real* access to this subnet.
|
||||
# i.e. dont use the same subnet then in the localnet section
|
||||
#remote_dns_subnet 127
|
||||
#remote_dns_subnet 10
|
||||
remote_dns_subnet 224
|
||||
|
||||
# ========================================================================================
|
||||
|
||||
# Some timeouts in milliseconds
|
||||
tcp_read_time_out 15000
|
||||
tcp_connect_time_out 8000
|
||||
|
||||
### Examples for localnet exclusion
|
||||
## localnet ranges will *not* use a proxy to connect.
|
||||
## Exclude connections to 192.168.1.0/24 with port 80
|
||||
# ========================================================================================
|
||||
|
||||
# Examples for localnet exclusion
|
||||
# localnet ranges will *not* use a proxy to connect.
|
||||
# Exclude connections to 192.168.1.0/24 with port 80
|
||||
# localnet 192.168.1.0:80/255.255.255.0
|
||||
|
||||
## Exclude connections to 192.168.100.0/24
|
||||
# Exclude connections to 192.168.100.0/24
|
||||
# localnet 192.168.100.0/255.255.255.0
|
||||
|
||||
## Exclude connections to ANYwhere with port 80
|
||||
# Exclude connections to ANYwhere with port 80
|
||||
# localnet 0.0.0.0:80/0.0.0.0
|
||||
|
||||
## RFC5735 Loopback address range
|
||||
## if you enable this, you have to make sure remote_dns_subnet is not 127
|
||||
## you'll need to enable it if you want to use an application that
|
||||
## connects to localhost.
|
||||
# RFC5735 Loopback address range
|
||||
# if you enable this, you have to make sure remote_dns_subnet is not 127
|
||||
# you'll need to enable it if you want to use an application that
|
||||
# connects to localhost.
|
||||
# localnet 127.0.0.0/255.0.0.0
|
||||
|
||||
## RFC1918 Private Address Ranges
|
||||
# RFC1918 Private Address Ranges
|
||||
# localnet 10.0.0.0/255.0.0.0
|
||||
# localnet 172.16.0.0/255.240.0.0
|
||||
# localnet 192.168.0.0/255.255.0.0
|
||||
|
||||
# ProxyList format
|
||||
# type host port [user pass]
|
||||
# (values separated by 'tab' or 'blank')
|
||||
#
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# socks5 192.168.67.78 1080 lamer secret
|
||||
# http 192.168.89.3 8080 justu hidden
|
||||
# socks4 192.168.1.49 1080
|
||||
# http 192.168.39.93 8080
|
||||
#
|
||||
#
|
||||
# proxy types: http, socks4, socks5
|
||||
# ( auth types supported: "basic"-http "user/pass"-socks )
|
||||
#
|
||||
# ========================================================================================
|
||||
|
||||
[ProxyList]
|
||||
# add proxy here ...
|
||||
# meanwile
|
||||
# defaults set to "tor"
|
||||
socks4 127.0.0.1 9050
|
||||
|
||||
# ========================================================================================
|
||||
|
||||
# ProxyList format
|
||||
# type host port [user pass]
|
||||
# (values separated by 'tab' or 'blank')
|
||||
#
|
||||
# Examples:
|
||||
# socks5 192.168.67.78 1080 lamer secret
|
||||
# http 1 92.168.89.3 8080 justu hidden
|
||||
# socks4 192.168.1.49 1080
|
||||
# http 192.168.39.93 8080
|
||||
#
|
||||
# proxy types: http, socks4, socks5
|
||||
# ( auth types supported: "basic"-http "user/pass"-socks )
|
||||
|
||||
# ========================================================================================
|
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo "ProxyChains-3.1 (http://proxychains.sf.net)"
|
||||
|
||||
usage() {
|
||||
|
||||
echo " usage:"
|
||||
echo " $0 [h] [f config-file] <prog> [args]"
|
||||
exit
|
||||
}
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ $1 = "-h" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "$1" = "-f" ]; then
|
||||
export PROXYCHAINS_CONF_FILE=$2;
|
||||
shift;
|
||||
shift;
|
||||
fi
|
||||
|
||||
export LD_PRELOAD=libproxychains.so.3
|
||||
exec "$@"
|
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
# This script is called by proxychains to resolve DNS names
|
||||
|
||||
# DNS server used to resolve names
|
||||
DNS_SERVER=4.2.2.2
|
||||
|
||||
|
||||
if [ $# = 0 ] ; then
|
||||
echo " usage:"
|
||||
echo " proxyresolv <hostname> "
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
export LD_PRELOAD=libproxychains.so
|
||||
dig $1 @$DNS_SERVER +tcp | awk '/A.+[0-9]+\.[0-9]+\.[0-9]/{print $5;}'
|
Reference in New Issue
Block a user