mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-09 23:02:52 +08:00
Add more dumping debug functions.
This commit is contained in:
parent
c9b0edca9b
commit
cf5eff0b8a
51
src/debug.c
51
src/debug.c
@ -1,15 +1,17 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
# include <string.h>
|
||||
# include "core.h"
|
||||
# include "common.h"
|
||||
# include "debug.h"
|
||||
|
||||
|
||||
void DUMP_PROXY_DATA_LIST(proxy_data *plist, unsigned int count) {
|
||||
char ip_buf[16];
|
||||
void DUMP_PROXY_DATA_LIST_PREFIX(proxy_data *plist, unsigned int count, const char* prefix) {
|
||||
char ip_buf[16], buff[48] = {'\0'};
|
||||
strcat(strcat(buff, prefix), "PDATA:");
|
||||
for (; count; plist++, count--) {
|
||||
pc_stringfromipv4(&plist->ip.octet[0], ip_buf);
|
||||
PDEBUG("PDATA:[%s] %s %s:%d", proxy_state_strmap[plist->ps],
|
||||
PDEBUG("%s[%s] %s %s:%d", buff, proxy_state_strmap[plist->ps],
|
||||
proxy_type_strmap[plist->pt],
|
||||
ip_buf, htons(plist->port));
|
||||
if (*plist->user || *plist->pass) {
|
||||
@ -19,15 +21,42 @@ void DUMP_PROXY_DATA_LIST(proxy_data *plist, unsigned int count) {
|
||||
}
|
||||
}
|
||||
|
||||
void DUMP_PROXY_DATA_LIST(proxy_data *plist, unsigned int count) {
|
||||
DUMP_PROXY_DATA_LIST_PREFIX(plist, count, "PDATA:");
|
||||
}
|
||||
|
||||
void DUMP_PROXY_CHAIN_PREFIX(proxy_chain *pchain, const char* prefix) {
|
||||
char buff[32] = {'\0'};
|
||||
strcat(strcat(buff, prefix), "PCHAIN:");
|
||||
prefix = buff;
|
||||
PDEBUG("%s[name: \"%s\"]\n", prefix, pchain->name);
|
||||
PDEBUG("%schain type: %s\n", prefix, chain_type_strmap[pchain->ct]);
|
||||
PDEBUG("%stcp_read_time_out: %d\n", prefix, pchain->tcp_read_time_out);
|
||||
PDEBUG("%stcp_connect_time_out: %d\n", prefix, pchain->tcp_connect_time_out);
|
||||
PDEBUG("%smax_chain: %d\n", prefix, pchain->max_chain);
|
||||
PDEBUG("%soffset: %d\n", prefix, pchain->offset);
|
||||
PDEBUG("%scount: %d\n", prefix, pchain->count);
|
||||
DUMP_PROXY_DATA_LIST_PREFIX(pchain->pd, pchain->count, prefix);
|
||||
}
|
||||
|
||||
void DUMP_PROXY_CHAIN(proxy_chain *pchain) {
|
||||
PDEBUG("PCHAIN:[name: \"%s\"]\n", pchain->name);
|
||||
PDEBUG("PCHAIN:chain type: %s\n", chain_type_strmap[pchain->ct]);
|
||||
PDEBUG("PCHAIN:tcp_read_time_out: %d\n", pchain->tcp_read_time_out);
|
||||
PDEBUG("PCHAIN:tcp_connect_time_out: %d\n", pchain->tcp_connect_time_out);
|
||||
PDEBUG("PCHAIN:max_chain: %d\n", pchain->max_chain);
|
||||
PDEBUG("PCHAIN:offset: %d\n", pchain->offset);
|
||||
PDEBUG("PCHAIN:count: %d\n", pchain->count);
|
||||
DUMP_PROXY_DATA_LIST(pchain->pd, pchain->count);
|
||||
DUMP_PROXY_CHAIN_PREFIX(pchain, "");
|
||||
}
|
||||
|
||||
void DUMP_PROXY_CHAIN_LIST(proxy_chain_list *pc_list) {
|
||||
const char *prefix = "PCLIST:";
|
||||
int i = 0;
|
||||
PDEBUG("%schain type (default): %s\n", prefix, chain_type_strmap[pc_list->ct]);
|
||||
PDEBUG("%stcp_read_time_out: %d\n", prefix, pc_list->tcp_read_time_out);
|
||||
PDEBUG("%stcp_connect_time_out: %d\n", prefix, pc_list->tcp_connect_time_out);
|
||||
PDEBUG("%sremote_dns_subnet: %d\n", prefix, pc_list->remote_dns_subnet);
|
||||
PDEBUG("%sselected chain: %s\n", prefix, (pc_list->selected)?pc_list->selected->name:NULL);
|
||||
PDEBUG("%snum_localnet_addr: %u\n", prefix, (unsigned int)pc_list->num_localnet_addr);
|
||||
PDEBUG("%schain list count: %d\n", prefix, pc_list->count);
|
||||
for (; i < pc_list->count; i++) {
|
||||
//~ DUMP_PROXY_CHAIN(pc_list->pc[i]);
|
||||
DUMP_PROXY_CHAIN_PREFIX(pc_list->pc[i], prefix);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -9,11 +9,13 @@
|
||||
# include "core.h"
|
||||
void DUMP_PROXY_DATA_LIST(proxy_data *plist, unsigned int count);
|
||||
void DUMP_PROXY_CHAIN(proxy_chain *pchain);
|
||||
void DUMP_PROXY_CHAIN_LIST(proxy_chain_list *pc_list);
|
||||
|
||||
#else
|
||||
# define PDEBUG(fmt, args...) do {} while (0)
|
||||
# define DUMP_PROXY_CHAIN(args...) do {} while (0)
|
||||
# define DUMP_PROXY_DATA_LIST(args...) do {} while (0)
|
||||
# define DUMP_PROXY_CHAIN(args...) do {} while (0)
|
||||
# define DUMP_PROXY_CHAIN_LIST(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