Way to do DNS lookup through SOCKS5 proxy server
SOCKS5 supports UDP and thus DNS lookups. I'm looking for an application, or a command using standard system utilities, to do a single DNS lookup through a SOCKS5 proxy, and not connect to this address. As an example, here's fake dig
command to demonstrate what I would want to do, if this switch existed:
dig --socks5 1.2.3.4:8080 @4.2.2.1 example.com
Answers that work on either Linux, Windows or OSX are accepted.
Solution 1:
Some time back I needed something similar. I used a package called DNS-TCP-SOCK-PROXY
, which you can find on this github page. It is described as follows:
A simple dns proxy to tunnel DNS requests over a socks proxy (for example, over ssh or Tor). This can come in handy when setting up transparent proxies.
Usage: ./dns-proxy [options]
and lastly:
The configuration file should contain any of the following options (and ignores lines that begin with '#'):
socks_addr -- socks listener address
socks_port -- socks listener port
listen_addr -- address for the dns proxy to listen on
listen_port -- port for the dns proxy to listen on (most cases 53)
set_user -- username to drop to after binding
set_group -- group to drop to after binding
resolv_conf -- location of resolv.conf file to read from
log_file -- location to log to (should be /dev/null unless debugging).