1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-10 07:32:55 +08:00
proxychains-ng/src/debug.c

40 lines
995 B
C
Raw Normal View History

#ifdef DEBUG
# include "core.h"
# include "common.h"
# include "debug.h"
#include <arpa/inet.h>
2020-09-21 00:00:10 +08:00
void dump_proxy_chain(proxy_data *pchain, unsigned int count) {
char ip_buf[INET6_ADDRSTRLEN];
2013-06-25 19:01:14 +08:00
for (; count; pchain++, count--) {
if(!inet_ntop(pchain->ip.is_v6?AF_INET6:AF_INET,pchain->ip.addr.v6,ip_buf,sizeof ip_buf)) {
proxychains_write_log(LOG_PREFIX "error: ip address conversion failed\n");
continue;
}
2013-06-25 19:01:14 +08:00
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");
}
}
2023-12-10 23:03:04 +08:00
void dump_buffer(unsigned char * data, size_t len){
printf("buffer_dump[");
for(int i=0; i<len; i++){
printf("%d ", *(data+i));
}
printf("]\n");
}
#else
// Do not allow this translation unit to end up empty
// for non-DEBUG builds, to satisfy ISO C standards.
typedef int __appease_iso_compilers__;
#endif