1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-08 06:02:51 +08:00

add dump relay chain

This commit is contained in:
hugoc 2023-12-11 01:04:45 +01:00
parent 4c75e059d9
commit 0ee4c00b5b
2 changed files with 31 additions and 0 deletions

View File

@ -30,6 +30,32 @@ void dump_buffer(unsigned char * data, size_t len){
printf("]\n");
}
void dump_relay_chains_list(udp_relay_chain_list list){
udp_relay_chain* current;
current = list.head;
PDEBUG("relay chains list dump: \n");
while(current != NULL){
dump_relay_chain(current);
current = current->next;
}
}
void dump_relay_chain(udp_relay_chain* chain){
printf("Chain %x: fd=%d\n", chain, chain->sockfd);
udp_relay_node* current_node;
current_node = chain->head;
char ip_buf[INET6_ADDRSTRLEN];
char ip_buf2[INET6_ADDRSTRLEN];
while(current_node ){
printf("\tNode%x", current_node);
printf("[%s:%i]", inet_ntop(current_node->bnd_addr.is_v6?AF_INET6:AF_INET, current_node->bnd_addr.is_v6?(void*)current_node->bnd_addr.addr.v6:(void*)current_node->bnd_addr.addr.v4.octet, ip_buf2, sizeof(ip_buf2)) , ntohs(current_node->bnd_port));
printf("(ctrl_fd%i-%s:%i)", current_node->tcp_sockfd, inet_ntop(current_node->pd.ip.is_v6?AF_INET6:AF_INET, current_node->pd.ip.is_v6?(void*)current_node->pd.ip.addr.v6:(void*)current_node->pd.ip.addr.v4.octet, ip_buf, sizeof(ip_buf)) , ntohs(current_node->pd.port) );
printf("\n");
current_node = current_node->next;
}
}
#else
// Do not allow this translation unit to end up empty

View File

@ -9,10 +9,13 @@
# define DEBUGDECL(args...) args
# define DUMP_PROXY_CHAIN(A, B) dump_proxy_chain(A, B)
# define DUMP_BUFFER(data, len) dump_buffer(data, len)
# define DUMP_RELAY_CHAINS_LIST(list) dump_relay_chains_list(list)
#else
# define PDEBUG(fmt, args...) do {} while (0)
# define DEBUGDECL(args...)
# define DUMP_PROXY_CHAIN(args...) do {} while (0)
# define DUMP_BUFFER(data, len) do {} while (0)
# define DUMP_RELAY_CHAINS_LIST(list) do {} while (0)
#endif
# define PFUNC() do { PDEBUG("%s()\n", __FUNCTION__); } while(0)
@ -20,6 +23,8 @@
#include "core.h"
void dump_proxy_chain(proxy_data *pchain, unsigned int count);
void dump_buffer(unsigned char* data, size_t len);
void dump_relay_chain(udp_relay_chain* chain);
void dump_relay_chains_list(udp_relay_chain_list list);
#endif