Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrass <crass@berlios.de>2013-06-23 09:12:25 +0400
committerrofl0r <retnyg@gmx.net>2013-06-25 14:56:41 +0400
commit5c4c166802b5fdaf5072518feb19a3c0a5c216c8 (patch)
tree65476ad0fdc1c85028db5d75facc19166ce8a25e
parentb9ca1cdefd46bddc342db469c35a987d7cfa6cde (diff)
Add DUMP_PROXY_CHAIN for debug builds and debug.c.
-rw-r--r--Makefile2
-rw-r--r--src/common.c20
-rw-r--r--src/common.h4
-rw-r--r--src/debug.c21
-rw-r--r--src/debug.h8
5 files changed, 53 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 7a3080f..b85d808 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ OBJS = $(SRCS:.c=.o)
LOBJS = src/nameinfo.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
diff --git a/src/common.c b/src/common.c
index 525310a..9cab4ff 100644
--- a/src/common.c
+++ b/src/common.c
@@ -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;
diff --git a/src/common.h b/src/common.h
index 2a3f017..5335bd1 100644
--- a/src/common.h
+++ b/src/common.h
@@ -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);
diff --git a/src/debug.c b/src/debug.c
new file mode 100644
index 000000000..d867569
--- /dev/null
+++ b/src/debug.c
@@ -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
diff --git a/src/debug.h b/src/debug.h
index 2c04cc5..8bcf2e9 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -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)