mirror of
https://github.com/rofl0r/proxychains-ng
synced 2026-05-13 17:03:07 +08:00
Compare commits
16 Commits
v4.6
..
musl-preload
@@ -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.
|
||||
@@ -15,10 +15,10 @@ sysconfdir=$(prefix)/etc
|
||||
|
||||
SRCS = $(sort $(wildcard src/*.c))
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LOBJS = src/nameinfo.o \
|
||||
LOBJS = src/nameinfo.o src/legacy.o \
|
||||
src/core.o src/common.o src/libproxychains.o src/shm.o \
|
||||
src/allocator_thread.o src/ip_type.o src/stringdump.o \
|
||||
src/hostentdb.o src/hash.o
|
||||
src/hostentdb.o src/hash.o src/debug.o
|
||||
|
||||
CFLAGS += -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe
|
||||
NO_AS_NEEDED = -Wl,--no-as-needed
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ProxyChains-NG ver 4.5 README
|
||||
ProxyChains-NG ver 4.8 README
|
||||
=============================
|
||||
|
||||
ProxyChains is a UNIX program, that hooks network-related libc functions
|
||||
@@ -52,7 +52,20 @@ ProxyChains-NG ver 4.5 README
|
||||
|
||||
Changelog:
|
||||
----------
|
||||
Version 4.8:
|
||||
- fix for odd cornercase where getaddrinfo was used with AI_NUMERICHOST
|
||||
to test for a numeric ip instead of resolving it (fixes nmap).
|
||||
|
||||
Version 4.7:
|
||||
- new round_robin chaintype by crazz.
|
||||
- fix bug with lazy allocation when GCC constructor was not used.
|
||||
- new configure flag --fat-binary to create a "fat" binary/library on OS X
|
||||
- return EBADF rather than EINTR in close hook.
|
||||
it's legal for a program to retry close() calls when they receive
|
||||
EINTR, which could cause an infinite loop, as seen in chromium.
|
||||
Version 4.6:
|
||||
- some cosmetic fixes to Makefile, fix a bug when non-numeric ip was
|
||||
user as proxy server address.
|
||||
Version 4.5:
|
||||
- hook close() to prevent OpenSSH from messing with internal infrastructure.
|
||||
this caused ssh client to segfault when proxified.
|
||||
@@ -154,3 +167,8 @@ Community:
|
||||
----------
|
||||
#proxychains on irc.freenode.net
|
||||
|
||||
Donations:
|
||||
----------
|
||||
bitcoins donations are welcome - please send to this address:
|
||||
1C9LBpuy56veBqw5N33sZMoZW8mwCw3tPh
|
||||
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
prefix=/usr/local
|
||||
|
||||
ismac() {
|
||||
uname -s | grep Darwin >/dev/null
|
||||
}
|
||||
|
||||
isx86_64() {
|
||||
uname -m | grep -i X86_64 >/dev/null
|
||||
}
|
||||
|
||||
isbsd() {
|
||||
uname -s | grep BSD >/dev/null
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "supported arguments"
|
||||
echo "--prefix=/path default: $prefix"
|
||||
@@ -10,6 +22,7 @@ usage() {
|
||||
echo "--libdir=/path default: $prefix/lib"
|
||||
echo "--includedir=/path default: $prefix/include"
|
||||
echo "--sysconfdir=/path default: $prefix/etc"
|
||||
ismac && isx86_64 && echo "--fat-binary : build for both i386 and x86_64 architectures on 64-bit Macs"
|
||||
echo "--help : show this text"
|
||||
exit 1
|
||||
}
|
||||
@@ -21,6 +34,8 @@ spliteq() {
|
||||
# or echo "$arg" | sed 's/[^=]*=//'
|
||||
}
|
||||
|
||||
fat_binary=
|
||||
|
||||
parsearg() {
|
||||
case "$1" in
|
||||
--prefix=*) prefix=`spliteq $1`;;
|
||||
@@ -29,18 +44,11 @@ parsearg() {
|
||||
--libdir=*) libdir=`spliteq $1`;;
|
||||
--includedir=*) includedir=`spliteq $1`;;
|
||||
--sysconfdir=*) sysconfdir=`spliteq $1`;;
|
||||
--fat-binary) fat_binary=1;;
|
||||
--help) usage;;
|
||||
esac
|
||||
}
|
||||
|
||||
ismac() {
|
||||
uname -s | grep Darwin >/dev/null
|
||||
}
|
||||
|
||||
isbsd() {
|
||||
uname -s | grep BSD >/dev/null
|
||||
}
|
||||
|
||||
while true ; do
|
||||
case $1 in
|
||||
-*) parsearg "$1"; shift;;
|
||||
@@ -85,6 +93,11 @@ if ismac ; then
|
||||
echo NO_AS_NEEDED=>>config.mak
|
||||
echo LDSO_SUFFIX=dylib>>config.mak
|
||||
echo MAC_CFLAGS+=-DIS_MAC=1>>config.mak
|
||||
if isx86_64 && [ "$fat_binary" = 1 ] ; then
|
||||
echo "Configuring a fat binary for i386 and x86_64"
|
||||
echo MAC_CFLAGS+=-arch i386 -arch x86_64>>config.mak
|
||||
echo LDFLAGS+=-arch i386 -arch x86_64>>config.mak
|
||||
fi
|
||||
echo LD_SET_SONAME=-Wl,-install_name,>>config.mak
|
||||
echo INSTALL_FLAGS=-m>>config.mak
|
||||
elif isbsd ; then
|
||||
@@ -93,5 +106,4 @@ elif isbsd ; then
|
||||
echo INSTALL_FLAGS=-m>>config.mak
|
||||
fi
|
||||
|
||||
echo done, now run make \&\& make install
|
||||
|
||||
echo "Done, now run make && make install"
|
||||
|
||||
@@ -3,6 +3,26 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
const char *proxy_type_strmap[] = {
|
||||
"http",
|
||||
"socks4",
|
||||
"socks5",
|
||||
};
|
||||
|
||||
const char *chain_type_strmap[] = {
|
||||
"dynamic_chain",
|
||||
"strict_chain",
|
||||
"random_chain",
|
||||
"round_robin_chain",
|
||||
};
|
||||
|
||||
const char *proxy_state_strmap[] = {
|
||||
"play",
|
||||
"down",
|
||||
"blocked",
|
||||
"busy",
|
||||
};
|
||||
|
||||
// stolen from libulz (C) rofl0r
|
||||
void pc_stringfromipv4(unsigned char *ip_buf_4_bytes, char *outbuf_16_bytes) {
|
||||
unsigned char *p;
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern const char *proxy_type_strmap[];
|
||||
extern const char *chain_type_strmap[];
|
||||
extern const char *proxy_state_strmap[];
|
||||
|
||||
char *get_config_path(char* default_path, char* pbuf, size_t bufsize);
|
||||
void pc_stringfromipv4(unsigned char *ip_buf_4_bytes, char *outbuf_16_bytes);
|
||||
|
||||
|
||||
+63
-5
@@ -27,7 +27,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/poll.h>
|
||||
#include <poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
@@ -43,6 +43,7 @@
|
||||
extern int tcp_read_time_out;
|
||||
extern int tcp_connect_time_out;
|
||||
extern int proxychains_quiet_mode;
|
||||
extern unsigned int proxychains_proxy_offset;
|
||||
extern unsigned int remote_dns_subnet;
|
||||
|
||||
static int poll_retry(struct pollfd *fds, nfds_t nfsd, int timeout) {
|
||||
@@ -267,8 +268,10 @@ static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, c
|
||||
}
|
||||
|
||||
// if not ok (200) or response greather than BUFF_SIZE return BLOCKED;
|
||||
if(len == BUFF_SIZE || !(buff[9] == '2' && buff[10] == '0' && buff[11] == '0'))
|
||||
if(len == BUFF_SIZE || !(buff[9] == '2' && buff[10] == '0' && buff[11] == '0')) {
|
||||
PDEBUG("HTTP proxy blocked: buff=\"%s\"\n", buff);
|
||||
return BLOCKED;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -427,6 +430,7 @@ static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, c
|
||||
#define DT "Dynamic chain"
|
||||
#define ST "Strict chain"
|
||||
#define RT "Random chain"
|
||||
#define RRT "Round Robin chain"
|
||||
|
||||
static int start_chain(int *fd, proxy_data * pd, char *begin_mark) {
|
||||
struct sockaddr_in addr;
|
||||
@@ -554,15 +558,20 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
proxy_data p4;
|
||||
proxy_data *p1, *p2, *p3;
|
||||
int ns = -1;
|
||||
int rc = -1;
|
||||
unsigned int offset = 0;
|
||||
unsigned int alive_count = 0;
|
||||
unsigned int curr_len = 0;
|
||||
unsigned int curr_pos = 0;
|
||||
unsigned int looped = 0; // went back to start of list in RR mode
|
||||
|
||||
p3 = &p4;
|
||||
|
||||
PFUNC();
|
||||
|
||||
again:
|
||||
rc = -1;
|
||||
DUMP_PROXY_CHAIN(pd, proxy_count);
|
||||
|
||||
switch (ct) {
|
||||
case DYNAMIC_TYPE:
|
||||
@@ -589,6 +598,52 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
goto error;
|
||||
break;
|
||||
|
||||
case ROUND_ROBIN_TYPE:
|
||||
alive_count = calc_alive(pd, proxy_count);
|
||||
curr_pos = offset = proxychains_proxy_offset;
|
||||
if(alive_count < max_chain)
|
||||
goto error_more;
|
||||
PDEBUG("1:rr_offset = %d, curr_pos = %d\n", offset, curr_pos);
|
||||
/* Check from current RR offset til end */
|
||||
for (;rc != SUCCESS;) {
|
||||
if (!(p1 = select_proxy(FIFOLY, pd, proxy_count, &offset))) {
|
||||
/* We've reached the end of the list, go to the start */
|
||||
offset = 0;
|
||||
looped++;
|
||||
continue;
|
||||
} else if (looped && rc > 0 && offset >= curr_pos) {
|
||||
PDEBUG("GOTO MORE PROXIES 0\n");
|
||||
/* We've gone back to the start and now past our starting position */
|
||||
proxychains_proxy_offset = 0;
|
||||
goto error_more;
|
||||
}
|
||||
PDEBUG("2:rr_offset = %d\n", offset);
|
||||
rc=start_chain(&ns, p1, RRT);
|
||||
}
|
||||
/* Create rest of chain using RR */
|
||||
for(curr_len = 1; curr_len < max_chain;) {
|
||||
PDEBUG("3:rr_offset = %d, curr_len = %d, max_chain = %d\n", offset, curr_len, max_chain);
|
||||
p2 = select_proxy(FIFOLY, pd, proxy_count, &offset);
|
||||
if(!p2) {
|
||||
/* Try from the beginning to where we started */
|
||||
offset = 0;
|
||||
continue;
|
||||
} else if(SUCCESS != chain_step(ns, p1, p2)) {
|
||||
PDEBUG("GOTO AGAIN 1\n");
|
||||
goto again;
|
||||
} else
|
||||
p1 = p2;
|
||||
curr_len++;
|
||||
}
|
||||
//proxychains_write_log(TP);
|
||||
p3->ip = target_ip;
|
||||
p3->port = target_port;
|
||||
proxychains_proxy_offset = offset+1;
|
||||
PDEBUG("pd_offset = %d, curr_len = %d\n", proxychains_proxy_offset, curr_len);
|
||||
if(SUCCESS != chain_step(ns, p1, p3))
|
||||
goto error;
|
||||
break;
|
||||
|
||||
case STRICT_TYPE:
|
||||
alive_count = calc_alive(pd, proxy_count);
|
||||
offset = 0;
|
||||
@@ -770,8 +825,11 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
|
||||
// printf("proxy_getaddrinfo node %s service %s\n",node,service);
|
||||
space = calloc(1, sizeof(struct addrinfo_data));
|
||||
if(!space) goto err1;
|
||||
|
||||
|
||||
if(node && !inet_aton(node, &((struct sockaddr_in *) &space->sockaddr_space)->sin_addr)) {
|
||||
/* some folks (nmap) use getaddrinfo() with AI_NUMERICHOST to check whether a string
|
||||
containing a numeric ip was passed. we must return failure in that case. */
|
||||
if(hints && (hints->ai_flags & AI_NUMERICHOST)) return EAI_NONAME;
|
||||
hp = proxy_gethostbyname(node, &ghdata);
|
||||
if(hp)
|
||||
memcpy(&((struct sockaddr_in *) &space->sockaddr_space)->sin_addr,
|
||||
@@ -786,7 +844,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
|
||||
|
||||
*res = p = &space->addrinfo_space;
|
||||
assert((size_t)p == (size_t) space);
|
||||
|
||||
|
||||
p->ai_addr = &space->sockaddr_space;
|
||||
if(node)
|
||||
strncpy(space->addr_name, node, sizeof(space->addr_name));
|
||||
@@ -802,7 +860,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
|
||||
} else {
|
||||
p->ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
|
||||
}
|
||||
|
||||
|
||||
goto out;
|
||||
err2:
|
||||
free(space);
|
||||
|
||||
+3
-2
@@ -47,8 +47,9 @@ typedef enum {
|
||||
typedef enum {
|
||||
DYNAMIC_TYPE,
|
||||
STRICT_TYPE,
|
||||
RANDOM_TYPE}
|
||||
chain_type;
|
||||
RANDOM_TYPE,
|
||||
ROUND_ROBIN_TYPE
|
||||
} chain_type;
|
||||
|
||||
typedef enum {
|
||||
PLAY_STATE,
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
# include "core.h"
|
||||
# include "common.h"
|
||||
# include "debug.h"
|
||||
|
||||
void DUMP_PROXY_CHAIN(proxy_data *pchain, unsigned int count) {
|
||||
char ip_buf[16];
|
||||
for (; count; pchain++, count--) {
|
||||
pc_stringfromipv4(&pchain->ip.octet[0], ip_buf);
|
||||
PDEBUG("[%s] %s %s:%d", proxy_state_strmap[pchain->ps],
|
||||
proxy_type_strmap[pchain->pt],
|
||||
ip_buf, htons(pchain->port));
|
||||
if (*pchain->user || *pchain->pass) {
|
||||
PSTDERR(" [u=%s,p=%s]", pchain->user, pchain->pass);
|
||||
}
|
||||
PSTDERR("\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+7
-1
@@ -3,9 +3,15 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
# define PDEBUG(fmt, args...) do { dprintf(2,"DEBUG:"fmt, ## args); } while(0)
|
||||
# define PSTDERR(fmt, args...) do { dprintf(2,fmt, ## args); } while(0)
|
||||
# define PDEBUG(fmt, args...) PSTDERR("DEBUG:"fmt, ## args)
|
||||
|
||||
# include "core.h"
|
||||
void DUMP_PROXY_CHAIN(proxy_data *pchain, unsigned int count);
|
||||
|
||||
#else
|
||||
# define PDEBUG(fmt, args...) do {} while (0)
|
||||
# define DUMP_PROXY_CHAIN(args...) do {} while (0)
|
||||
#endif
|
||||
|
||||
# define PFUNC() do { PDEBUG("pid[%d]:%s\n", getpid(), __FUNCTION__); } while(0)
|
||||
|
||||
+481
@@ -0,0 +1,481 @@
|
||||
int __res_ninit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __pthread_register_cancel(void* p) {
|
||||
|
||||
}
|
||||
|
||||
void __pthread_unregister_cancel(void *p) {
|
||||
|
||||
}
|
||||
|
||||
#include <setjmp.h>
|
||||
int __sigsetjmp(sigjmp_buf buf, int save) {
|
||||
return sigsetjmp(buf, save);
|
||||
}
|
||||
|
||||
static __thread void* thread_arg;
|
||||
static __thread int (*thread_compar)(const void*, const void*, void*);
|
||||
static int my_thread_compare_func(const void* a, const void* b) {
|
||||
return thread_compar(a, b, thread_arg);
|
||||
}
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void *arg) {
|
||||
thread_arg = arg;
|
||||
thread_compar = compar;
|
||||
return qsort(base, nmemb, size, my_thread_compare_func);
|
||||
}
|
||||
|
||||
int backtrace(void **buffer, int size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char **backtrace_symbols(void *const *buffer, int size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <pthread.h>
|
||||
int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle) {
|
||||
return pthread_atfork(prepare, parent, child);
|
||||
}
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <poll.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
|
||||
__attribute((noreturn)) void __chk_fail(void)
|
||||
{
|
||||
write(2, "buffer overflow detected\n", 25);
|
||||
abort();
|
||||
}
|
||||
|
||||
int __asprintf_chk(char **s, int flag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vasprintf(s, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
size_t __confstr_chk(int name, char *buf, size_t len, size_t size)
|
||||
{
|
||||
return confstr(name, buf, len);
|
||||
}
|
||||
|
||||
int __dprintf_chk(int fd, int flag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vdprintf(fd, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
char *__fgets_chk(char *s, size_t size, int n, FILE *f)
|
||||
{
|
||||
return fgets(s, n, f);
|
||||
}
|
||||
|
||||
char *__fgets_unlocked_chk(char *s, size_t size, int n, FILE *f)
|
||||
{
|
||||
return fgets_unlocked(s, n, f);
|
||||
}
|
||||
|
||||
wchar_t *__fgetws_chk(wchar_t *s, size_t size, int n, FILE *f)
|
||||
{
|
||||
return fgetws(s, n, f);
|
||||
}
|
||||
|
||||
wchar_t *fgetws_unlocked(wchar_t *, int, FILE *);
|
||||
|
||||
wchar_t *__fgetws_unlocked_chk(wchar_t *s, size_t size, int n, FILE *f)
|
||||
{
|
||||
return fgetws_unlocked(s, n, f);
|
||||
}
|
||||
|
||||
int __fprintf_chk(FILE *f, int flag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vfprintf(f, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
int __fwprintf_chk(FILE *f, int flag, const wchar_t *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vfwprintf(f, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
size_t __fread_chk(void *p, size_t size, size_t sz, size_t n, FILE *f)
|
||||
{
|
||||
return fread(p, sz, n, f);
|
||||
}
|
||||
|
||||
size_t __fread_unlocked_chk(void *p, size_t size, size_t sz, size_t n, FILE *f)
|
||||
{
|
||||
return fread_unlocked(p, sz, n, f);
|
||||
}
|
||||
|
||||
char *__getcwd_chk(char *buf, size_t len, size_t size)
|
||||
{
|
||||
return getcwd(buf, len);
|
||||
}
|
||||
|
||||
int __getdomainname_chk(char *buf, size_t len, size_t size)
|
||||
{
|
||||
return getdomainname(buf, len);
|
||||
}
|
||||
|
||||
int __getgroups_chk(int n, gid_t *list, size_t listlen)
|
||||
{
|
||||
return getgroups(n, list);
|
||||
}
|
||||
|
||||
int __gethostname_chk(char *buf, size_t len, size_t size)
|
||||
{
|
||||
return gethostname(buf, len);
|
||||
}
|
||||
|
||||
int __getlogin_r_chk(char *buf, size_t len, size_t size)
|
||||
{
|
||||
return getlogin_r(buf, len);
|
||||
}
|
||||
|
||||
char *__gets_chk(char *buf, size_t size)
|
||||
{
|
||||
return gets(buf);
|
||||
}
|
||||
|
||||
__attribute((noreturn)) void __longjmp_chk(jmp_buf buf, int v)
|
||||
{
|
||||
longjmp(buf, v);
|
||||
}
|
||||
|
||||
size_t __mbsnrtowcs_chk(wchar_t *dst, const char **src, size_t n, size_t len, mbstate_t *st, size_t dstsize)
|
||||
{
|
||||
return mbsnrtowcs(dst, src, n, len, st);
|
||||
}
|
||||
|
||||
size_t __mbsrtowcs_chk(wchar_t *dst, const char **src, size_t len, mbstate_t *st, size_t dstsize)
|
||||
{
|
||||
return mbsrtowcs(dst, src, len, st);
|
||||
}
|
||||
|
||||
size_t __mbstowcs_chk(wchar_t *dst, const char *src, size_t len, size_t dstsize)
|
||||
{
|
||||
return mbstowcs(dst, src, len);
|
||||
}
|
||||
|
||||
void *__memcpy_chk(void *dst, void *src, size_t len, size_t dstsize)
|
||||
{
|
||||
return memcpy(dst, src, len);
|
||||
}
|
||||
|
||||
void *__mempcpy_chk(void *dst, void *src, size_t len, size_t dstsize)
|
||||
{
|
||||
return mempcpy(dst, src, len);
|
||||
}
|
||||
|
||||
void *__memmove_chk(void *dst, void *src, size_t len, size_t dstsize)
|
||||
{
|
||||
return memmove(dst, src, len);
|
||||
}
|
||||
|
||||
void *__memset_chk(void *s, int c, size_t n, size_t size)
|
||||
{
|
||||
return memset(s, c, n);
|
||||
}
|
||||
|
||||
int __poll_chk(struct pollfd *fds, nfds_t n, int timeout, size_t fdslen)
|
||||
{
|
||||
return poll(fds, n, timeout);
|
||||
}
|
||||
|
||||
int __ppoll_chk(struct pollfd *fds, nfds_t n, const struct timespec *timeout, const sigset_t *mask, size_t fdslen)
|
||||
{
|
||||
return ppoll(fds, n, timeout, mask);
|
||||
}
|
||||
|
||||
ssize_t __pread_chk(int fd, void *buf, size_t n, off_t off, size_t bufsize)
|
||||
{
|
||||
return pread(fd, buf, n, off);
|
||||
}
|
||||
|
||||
#undef weak_alias
|
||||
#define weak_alias(old, new) \
|
||||
extern __typeof(old) new __attribute__((weak, alias(#old)))
|
||||
|
||||
weak_alias(__pread_chk, __pread64_chk);
|
||||
|
||||
int __printf_chk(int flag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
int __ptsname_r_chk(int fd, char *buf, size_t len, size_t size)
|
||||
{
|
||||
return ptsname_r(fd, buf, len);
|
||||
}
|
||||
|
||||
ssize_t __read_chk(int fd, void *buf, size_t n, size_t bufsize)
|
||||
{
|
||||
return read(fd, buf, n);
|
||||
}
|
||||
|
||||
ssize_t __readlinkat_chk(int fd, const char *path, void *buf, size_t n, size_t bufsize)
|
||||
{
|
||||
return readlinkat(fd, path, buf, n);
|
||||
}
|
||||
|
||||
ssize_t __readlink_chk(const char *path, void *buf, size_t n, size_t bufsize)
|
||||
{
|
||||
return readlink(path, buf, n);
|
||||
}
|
||||
|
||||
char *__realpath_chk(const char *name, char *resolved, size_t resolvedsize)
|
||||
{
|
||||
return realpath(name, resolved);
|
||||
}
|
||||
|
||||
ssize_t __recv_chk(int fd, void *buf, size_t n, size_t bufsize, int flags)
|
||||
{
|
||||
return recv(fd, buf, n, flags);
|
||||
}
|
||||
|
||||
ssize_t __recvfrom_chk(int fd, void *buf, size_t n, size_t bufsize, int flags, struct sockaddr *addr, socklen_t *addrlen)
|
||||
{
|
||||
return recvfrom(fd, buf, n, flags, addr, addrlen);
|
||||
}
|
||||
|
||||
int __sprintf_chk(char *s, int flag, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vsprintf(s, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
int __snprintf_chk(char *s, size_t n, int flag, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vsnprintf(s, n, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
char *__stpcpy_chk(char *dst, const char *src, size_t dstsize)
|
||||
{
|
||||
return stpcpy(dst, src);
|
||||
}
|
||||
char *__stpncpy_chk(char *dst, const char *src, size_t n, size_t dstsize)
|
||||
{
|
||||
return stpncpy(dst, src, n);
|
||||
}
|
||||
|
||||
char *__strcat_chk(char *dst, const char *src, size_t dstsize)
|
||||
{
|
||||
return strcat(dst, src);
|
||||
}
|
||||
|
||||
char *__strcpy_chk(char *dst, const char *src, size_t dstsize)
|
||||
{
|
||||
return strcpy(dst, src);
|
||||
}
|
||||
|
||||
char *__strncat_chk(char *dst, const char *src, size_t n, size_t dstsize)
|
||||
{
|
||||
return strncat(dst, src, n);
|
||||
}
|
||||
|
||||
char *__strncpy_chk(char *dst, const char *src, size_t n, size_t dstsize)
|
||||
{
|
||||
return strncpy(dst, src, n);
|
||||
}
|
||||
|
||||
int __swprintf_chk(wchar_t *s, size_t n, int flag, size_t size, const wchar_t *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vswprintf(s, n, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
void __syslog_chk(int pri, int flag, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsyslog(pri, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int __ttyname_r_chk(int fd, char *buf, size_t len, size_t size)
|
||||
{
|
||||
return ttyname_r(fd, buf, len);
|
||||
}
|
||||
|
||||
int __vasprintf_chk(char **s, int flag, const char *fmt, va_list ap)
|
||||
{
|
||||
return vasprintf(s, fmt, ap);
|
||||
}
|
||||
|
||||
int __vdprintf_chk(int fd, int flag, const char *fmt, va_list ap)
|
||||
{
|
||||
return vdprintf(fd, fmt, ap);
|
||||
}
|
||||
|
||||
int __vfprintf_chk(FILE *f, int flag, const char *fmt, va_list ap)
|
||||
{
|
||||
return vfprintf(f, fmt, ap);
|
||||
}
|
||||
|
||||
int __vfwprintf_chk(FILE *f, int flag, const wchar_t *fmt, va_list ap)
|
||||
{
|
||||
return vfwprintf(f, fmt, ap);
|
||||
}
|
||||
|
||||
int __vprintf_chk(int flag, const char *fmt, va_list ap)
|
||||
{
|
||||
return vprintf(fmt, ap);
|
||||
}
|
||||
|
||||
int __vsnprintf_chk(char *s, size_t n, int flag, size_t size, const char *fmt, va_list ap)
|
||||
{
|
||||
return vsnprintf(s, n, fmt, ap);
|
||||
}
|
||||
|
||||
int __vsprintf_chk(char *s, int flag, size_t size, const char *fmt, va_list ap)
|
||||
{
|
||||
return vsprintf(s, fmt, ap);
|
||||
}
|
||||
|
||||
int __vswprintf_chk(wchar_t *s, size_t n, int flag, size_t size, const wchar_t *fmt, va_list ap)
|
||||
{
|
||||
return vswprintf(s, n, fmt, ap);
|
||||
}
|
||||
|
||||
void __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
|
||||
{
|
||||
vsyslog(pri, fmt, ap);
|
||||
}
|
||||
|
||||
int __vwprintf_chk(int flag, const wchar_t *fmt, va_list ap)
|
||||
{
|
||||
return vwprintf(fmt, ap);
|
||||
}
|
||||
|
||||
wchar_t *__wcpcpy_chk(wchar_t *dst, const wchar_t *src, size_t dstsize)
|
||||
{
|
||||
return wcpcpy(dst, src);
|
||||
}
|
||||
|
||||
wchar_t *__wcpncpy_chk(wchar_t *dst, const wchar_t *src, size_t n, size_t dstsize)
|
||||
{
|
||||
return wcpncpy(dst, src, n);
|
||||
}
|
||||
|
||||
size_t __wcrtomb_chk(char *s, wchar_t c, mbstate_t *st, size_t size)
|
||||
{
|
||||
return wcrtomb(s, c, st);
|
||||
}
|
||||
|
||||
wchar_t *__wcscat_chk(wchar_t *dst, const wchar_t *src, size_t dstlen)
|
||||
{
|
||||
return wcscat(dst, src);
|
||||
}
|
||||
|
||||
wchar_t *__wcscpy_chk(wchar_t *dst, const wchar_t *src, size_t dstlen)
|
||||
{
|
||||
return wcscpy(dst, src);
|
||||
}
|
||||
|
||||
wchar_t *__wcsncat_chk(wchar_t *dst, const wchar_t *src, size_t n, size_t dstlen)
|
||||
{
|
||||
return wcsncat(dst, src, n);
|
||||
}
|
||||
|
||||
wchar_t *__wcsncpy_chk(wchar_t *dst, const wchar_t *src, size_t n, size_t dstlen)
|
||||
{
|
||||
return wcsncpy(dst, src, n);
|
||||
}
|
||||
|
||||
size_t __wcsnrtombs_chk(char *dst, const wchar_t **src, size_t n, size_t len, mbstate_t *st, size_t dstsize)
|
||||
{
|
||||
return wcsnrtombs(dst, src, n, len, st);
|
||||
}
|
||||
|
||||
size_t __wcsrtombs_chk(char *dst, const wchar_t **src, size_t len, mbstate_t *st, size_t dstsize)
|
||||
{
|
||||
return wcsrtombs(dst, src, len, st);
|
||||
}
|
||||
|
||||
size_t __wcstombs_chk(char *dst, const wchar_t *src, size_t len, size_t dstsize)
|
||||
{
|
||||
return wcstombs(dst, src, len);
|
||||
}
|
||||
|
||||
int __wctomb_chk(char *s, wchar_t c, size_t size)
|
||||
{
|
||||
return wctomb(s, c);
|
||||
}
|
||||
|
||||
wchar_t *__wmemcpy_chk(wchar_t *dst, const wchar_t *src, size_t n, size_t dstlen)
|
||||
{
|
||||
return wmemcpy(dst, src, n);
|
||||
}
|
||||
|
||||
wchar_t *__wmemmove_chk(wchar_t *dst, const wchar_t *src, size_t n, size_t dstlen)
|
||||
{
|
||||
return wmemmove(dst, src, n);
|
||||
}
|
||||
|
||||
wchar_t *__wmempcpy_chk(wchar_t *dst, const wchar_t *src, size_t n, size_t dstlen)
|
||||
{
|
||||
return mempcpy(dst, src, n*sizeof*src);
|
||||
}
|
||||
|
||||
wchar_t *__wmemset_chk(wchar_t *s, wchar_t c, size_t n, size_t slen)
|
||||
{
|
||||
return wmemset(s, c, n);
|
||||
}
|
||||
|
||||
int __wprintf_chk(int flag, const wchar_t *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int r;
|
||||
va_start(ap,fmt);
|
||||
r = vwprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ int tcp_connect_time_out;
|
||||
chain_type proxychains_ct;
|
||||
proxy_data proxychains_pd[MAX_CHAIN];
|
||||
unsigned int proxychains_proxy_count = 0;
|
||||
unsigned int proxychains_proxy_offset = 0;
|
||||
int proxychains_got_chain_data = 0;
|
||||
unsigned int proxychains_max_chain = 1;
|
||||
int proxychains_quiet_mode = 0;
|
||||
@@ -105,6 +106,7 @@ static void do_init(void) {
|
||||
|
||||
/* read the config file */
|
||||
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
|
||||
DUMP_PROXY_CHAIN(proxychains_pd, proxychains_proxy_count);
|
||||
|
||||
proxychains_write_log(LOG_PREFIX "DLL init\n");
|
||||
|
||||
@@ -220,6 +222,8 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
|
||||
*ct = STRICT_TYPE;
|
||||
} else if(strstr(buff, "dynamic_chain")) {
|
||||
*ct = DYNAMIC_TYPE;
|
||||
} else if(strstr(buff, "round_robin_chain")) {
|
||||
*ct = ROUND_ROBIN_TYPE;
|
||||
} else if(strstr(buff, "tcp_read_time_out")) {
|
||||
sscanf(buff, "%s %d", user, &tcp_read_time_out);
|
||||
} else if(strstr(buff, "tcp_connect_time_out")) {
|
||||
@@ -294,12 +298,13 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
|
||||
/******* HOOK FUNCTIONS *******/
|
||||
|
||||
int close(int fd) {
|
||||
INIT();
|
||||
/* prevent rude programs (like ssh) from closing our pipes */
|
||||
if(fd != req_pipefd[0] && fd != req_pipefd[1] &&
|
||||
fd != resp_pipefd[0] && fd != resp_pipefd[1]) {
|
||||
return true_close(fd);
|
||||
}
|
||||
errno = EINTR;
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+15
-1
@@ -22,13 +22,27 @@ strict_chain
|
||||
# all proxies must be online to play in chain
|
||||
# otherwise EINTR is returned to the app
|
||||
#
|
||||
#round_robin_chain
|
||||
#
|
||||
# Round Robin - Each connection will be done via chained proxies
|
||||
# of chain_len length
|
||||
# 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).
|
||||
# the start of the current proxy chain is the proxy after the last
|
||||
# proxy in the previously invoked proxy chain.
|
||||
# if the end of the proxy chain is reached while looking for proxies
|
||||
# start at the beginning again.
|
||||
# otherwise EINTR is returned to the app
|
||||
# These semantics are not guaranteed in a multithreaded environment.
|
||||
#
|
||||
#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 :)
|
||||
|
||||
# Make sense only if random_chain
|
||||
# Make sense only if random_chain or round_robin_chain
|
||||
#chain_len = 2
|
||||
|
||||
# Quiet mode (no output from library)
|
||||
|
||||
Reference in New Issue
Block a user