version 1.219, 2022/06/08 20:07:31 |
version 1.220, 2022/12/18 12:45:34 |
|
|
int socks_connect(const char *, const char *, struct addrinfo, |
int socks_connect(const char *, const char *, struct addrinfo, |
const char *, const char *, struct addrinfo, int, const char *); |
const char *, const char *, struct addrinfo, int, const char *); |
int udptest(int); |
int udptest(int); |
|
void connection_info(const char *, const char *, const char *); |
int unix_bind(char *, int); |
int unix_bind(char *, int); |
int unix_connect(char *); |
int unix_connect(char *); |
int unix_listen(char *); |
int unix_listen(char *); |
|
|
char *host, *uport; |
char *host, *uport; |
char ipaddr[NI_MAXHOST]; |
char ipaddr[NI_MAXHOST]; |
struct addrinfo hints; |
struct addrinfo hints; |
struct servent *sv; |
|
socklen_t len; |
socklen_t len; |
struct sockaddr_storage cliaddr; |
struct sockaddr_storage cliaddr; |
char *proxy = NULL, *proxyport = NULL; |
char *proxy = NULL, *proxyport = NULL; |
|
|
socksv = 5; |
socksv = 5; |
host = NULL; |
host = NULL; |
uport = NULL; |
uport = NULL; |
sv = NULL; |
|
Rflag = tls_default_ca_cert_file(); |
Rflag = tls_default_ca_cert_file(); |
|
|
signal(SIGPIPE, SIG_IGN); |
signal(SIGPIPE, SIG_IGN); |
|
|
} |
} |
} |
} |
|
|
/* Don't look up port if -n. */ |
connection_info(host, portlist[i], ipaddr); |
if (nflag) |
|
sv = NULL; |
|
else { |
|
sv = getservbyport( |
|
ntohs(atoi(portlist[i])), |
|
uflag ? "udp" : "tcp"); |
|
} |
|
|
|
fprintf(stderr, "Connection to %s", host); |
|
|
|
/* |
|
* if we aren't connecting thru a proxy and |
|
* there is something to report, print IP |
|
*/ |
|
if (!nflag && !xflag && |
|
strcmp(host, ipaddr) != 0) |
|
fprintf(stderr, " (%s)", ipaddr); |
|
|
|
fprintf(stderr, " %s port [%s/%s] succeeded!\n", |
|
portlist[i], uflag ? "udp" : "tcp", |
|
sv ? sv->s_name : "*"); |
|
} |
} |
if (Fflag) |
if (Fflag) |
fdpass(s); |
fdpass(s); |
|
|
ret = -1; |
ret = -1; |
} |
} |
return ret; |
return ret; |
|
} |
|
|
|
void |
|
connection_info(const char *host, const char *port, const char *ipaddr) |
|
{ |
|
struct servent *sv; |
|
|
|
/* Don't look up port if -n. */ |
|
if (nflag) |
|
sv = NULL; |
|
else { |
|
sv = getservbyport(ntohs(atoi(port)), uflag ? "udp" : "tcp"); |
|
} |
|
|
|
fprintf(stderr, "Connection to %s", host); |
|
|
|
/* |
|
* if we aren't connecting thru a proxy and |
|
* there is something to report, print IP |
|
*/ |
|
if (!nflag && !xflag && strcmp(host, ipaddr) != 0) |
|
fprintf(stderr, " (%s)", ipaddr); |
|
|
|
fprintf(stderr, " %s port [%s/%s] succeeded!\n", |
|
port, uflag ? "udp" : "tcp", sv ? sv->s_name : "*"); |
} |
} |
|
|
void |
void |