Merge pull request #88 from Mister-Meeseeks/master

Allow user to override default DNS server
This commit is contained in:
Adam Hamsik 2020-01-10 13:39:06 +01:00 committed by GitHub
commit e7a2b9d79a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -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

View File

@ -2,8 +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
echo " usage:"
@ -12,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" </etc/hosts
if [[ "$?" -eq "0" ]]; then
if [ "$?" -eq "0" ]; then
exit
fi