From 98e9326534adcf8e20b67d0c979deef621736fff Mon Sep 17 00:00:00 2001 From: Douglas R Colkitt Date: Sat, 13 Apr 2019 15:41:07 +0000 Subject: [PATCH 1/2] Allow user to override default DNS server Implements support for an environmnet variable (PROXY_DNS_SERVER) whereby the user can specify a DNS server. If not set defaults to the hardcoded OpenDNS default. --- README.adoc | 10 ++++++++++ src/proxyresolv | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 07507cf..bee5f38 100644 --- a/README.adoc +++ b/README.adoc @@ -160,3 +160,13 @@ $ PROXYCHAINS_SOCKS5=4321 proxychains zsh in this example, it will run a shell with all traffic proxied through OpenSSH's "dynamic proxy" (SOCKS5 proxy) on localhost port 4321. + +=== Usage Example: + +---- +$ export PROXY_DNS_SERVER=8.8.8.8 +$ proxychains telnet targethost.com +---- + +in this example, it will telnet to targethost.com using the 8.8.8.8 +nameserver supplied by the user through the PROXY_DNS_SERVER diff --git a/src/proxyresolv b/src/proxyresolv index 1004c3d..eccf882 100755 --- a/src/proxyresolv +++ b/src/proxyresolv @@ -2,7 +2,12 @@ # This script is called by proxychains to resolve DNS names # DNS server used to resolve names -DNS_SERVER=208.67.222.222 + +if [[ -z "$PROXY_DNS_SERVER" ]] ; then + DNS_SERVER=208.67.222.222 # OpenDNS +else + DNS_SERVER=$PROXY_DNS_SERVER +fi if [ $# = 0 ] ; then From 0416c2b7eada21a61a8be54e5a17bf09da878ada Mon Sep 17 00:00:00 2001 From: Douglas R Colkitt Date: Sat, 13 Apr 2019 15:48:24 +0000 Subject: [PATCH 2/2] Fix issue with POSIX portability in proxyresolv script --- src/proxyresolv | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/proxyresolv b/src/proxyresolv index eccf882..e1674b4 100755 --- a/src/proxyresolv +++ b/src/proxyresolv @@ -3,13 +3,12 @@ # DNS server used to resolve names -if [[ -z "$PROXY_DNS_SERVER" ]] ; then +if [ -z "$PROXY_DNS_SERVER" ] ; then DNS_SERVER=208.67.222.222 # OpenDNS else DNS_SERVER=$PROXY_DNS_SERVER fi - if [ $# = 0 ] ; then echo " usage:" echo " proxyresolv " @@ -17,7 +16,7 @@ if [ $# = 0 ] ; then fi awk 'BEGIN{ARGC=0} {for(i=2;i<=NF;i++){if($i==ARGV[1] && $1!~":"){print $1;found=1}} } END{exit found?0:1}' "$1"