mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-06 21:02:55 +08:00
Add DUMP_PROXY_CHAIN for debug builds and debug.c.
This commit is contained in:
parent
b9ca1cdefd
commit
5c4c166802
2
Makefile
2
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
|
||||
|
20
src/common.c
20
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;
|
||||
|
@ -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);
|
||||
|
||||
|
21
src/debug.c
Normal file
21
src/debug.c
Normal file
@ -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
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user