mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 04:08:47 +00:00
add some test/debug programs
This commit is contained in:
parent
2d58820635
commit
8ce1e51a60
24
tests/test_gethostent.c
Normal file
24
tests/test_gethostent.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include "../src/core.h"
|
||||
|
||||
void printhostent(struct hostent *hp) {
|
||||
char ipbuf[16];
|
||||
pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
|
||||
printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n",
|
||||
hp->h_aliases,
|
||||
hp->h_length,
|
||||
hp->h_name,
|
||||
hp->h_addr_list,
|
||||
hp->h_addrtype,
|
||||
ipbuf
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
struct hostent *hp;
|
||||
while((hp = gethostent())) {
|
||||
printhostent(hp);
|
||||
}
|
||||
return 0;
|
||||
}
|
23
tests/test_proxy_gethostbyname.c
Normal file
23
tests/test_proxy_gethostbyname.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include "../src/core.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void printhostent(struct hostent *hp) {
|
||||
char ipbuf[16];
|
||||
pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
|
||||
printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n",
|
||||
hp->h_aliases,
|
||||
hp->h_length,
|
||||
hp->h_name,
|
||||
hp->h_addr_list,
|
||||
hp->h_addrtype,
|
||||
ipbuf
|
||||
);
|
||||
}
|
||||
int main(int argc, char**argv) {
|
||||
struct hostent* ret;
|
||||
struct gethostbyname_data data;
|
||||
if(argc == 1) return 1;
|
||||
ret = proxy_gethostbyname(argv[1], &data);
|
||||
if(ret) printhostent(ret);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user