Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2019-02-28 17:07:08 +0300
committerrofl0r <retnyg@gmx.net>2019-02-28 17:07:08 +0300
commitb8cdfe842ceb8a3f35d1f6e3c86cbda48b2f4d38 (patch)
tree997efca3e944ca03b054cd6f4dbf27ea9c351252 /src
parent9f17774b9917018ae70057137ff1fd37222278b8 (diff)
allow non-numeric proxy ips under certain circumstances
conditions that need to be met are: 1) chaintype strict 2) proxy_dns on 3) not the first proxy in the list if these conditions are met, the dns name can be passed to be receiving proxy and be resolved there. addressing https://github.com/rofl0r/proxychains-ng/issues/246#issuecomment-468222637
Diffstat (limited to 'src')
-rw-r--r--src/libproxychains.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/libproxychains.c b/src/libproxychains.c
index 94d343a..6b6467c 100644
--- a/src/libproxychains.c
+++ b/src/libproxychains.c
@@ -256,6 +256,10 @@ inv_string:
return 0;
}
+static const char* bool_str(int bool_val) {
+ if(bool_val) return "true";
+ return "false";
+}
/* get configuration from config file */
static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_type * ct) {
@@ -311,8 +315,20 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
pd[count].port = htons((unsigned short) port_n);
ip_type* host_ip = &pd[count].ip;
if(1 != inet_pton(host_ip->is_v6 ? AF_INET6 : AF_INET, host, host_ip->addr.v6)) {
- fprintf(stderr, "proxy %s has invalid value or is not numeric\n", host);
- exit(1);
+ if(*ct == STRICT_TYPE && proxychains_resolver && count > 0) {
+ /* we can allow dns hostnames for all but the first proxy in the list if chaintype is strict, as remote lookup can be done */
+ ip_type4 internal_ip = at_get_ip_for_host(host, strlen(host));
+ pd[count].ip.is_v6 = 0;
+ host_ip->addr.v4 = internal_ip;
+ if(internal_ip.as_int == ip_type_invalid.addr.v4.as_int)
+ goto inv_host;
+ } else {
+inv_host:
+ fprintf(stderr, "proxy %s has invalid value or is not numeric\n", host);
+ fprintf(stderr, "non-numeric ips are only allowed under the following circumstances:\n");
+ fprintf(stderr, "chaintype == strict (%s), proxy is not first in list (%s), proxy_dns active (%s)\n\n", bool_str(*ct == STRICT_TYPE), bool_str(count > 0), bool_str(proxychains_resolver));
+ exit(1);
+ }
}
if(!strcmp(type, "http")) {