How to do NSLOOKUP or DNS-resolution using HTTP-PROXY?

10,337

Using normal DNS this wouldn't be possible, but there is a recent standard for DNS over HTTPS that could nearly work for this.

I say nearly because the DNS resolution wouldn't actually happen on the proxy server, but you could use the proxy server to access one of the public DNS over HTTPS servers (e.g. 8.8.8.8 [https://dns.google.com/experimental] for Google or 1.1.1.1 [https://cloudflare-dns.com/dns-query] for Cloudflare, or you could run your own using my code https://www.hardill.me.uk/wordpress/2018/04/14/dns-over-https/)

e.g.

curl -H "Content-Type: application/dns-json" "https://dns.google.com/resolve?name=www.google.com&type=A"

gives an answer like:

{
  "Status": 0,
  "TC": false,
  "RD": true,
  "RA": true,
  "AD": false,
  "CD": false,
  "Question":[ 
    {
      "name": "www.google.com.",
      "type": 1
    }
  ],
  "Answer":[ 
    {
      "name": "www.google.com.",
      "type": 1,
      "TTL": 134,
      "data": "216.58.210.36"
    }
  ]
}

You would then configure curl (or what ever user agent) to use the proxy to make the request e.g.

export HTTPS_PROXY=http://proxy.server.com:8080
curl -H "Content-Type: application/dns-json" "https://dns.google.com/resolve?name=www.google.com&type=A"

Both Chrome and Firefox can be configured to do DNS resolution use DNS over HTTPS in the latest versions

Share:
10,337

Related videos on Youtube

Point Networks
Author by

Point Networks

Love coding. Use code to concoct my dream and loves making stuff to solve problems

Updated on September 18, 2022

Comments

  • Point Networks
    Point Networks almost 2 years

    I have an HTTP proxy URL which is working perfectly, now I wanna resolve some domain name's IP address using that particular proxy server. I'm not sure if that is even possible. Could somebody please point me in the right direction?

    Use case: Actually, I know a domain which is giving output with that particular HTTP-PROXY but that domain is not even resolving when I try to open it on my computer directly. So I wanna to know to which particular IP that domain is resolving when queried through the HTTP-PROXY server

  • Point Networks
    Point Networks over 5 years
    Thank you for your reply. But I guess in my case it wouldn't work because that particular domain is accessible only thought that proxy address and the domain in nowhere is available on public DNS. So I believe the response from the public DNS would always be same irrespective of I use a proxy or not. Anyways thank you for the reply. I have upvoted the answer but I wanted to know to which partucular IP address domain is pointing to when open through http-proxy
  • hardillb
    hardillb over 5 years
    Then look at the foxyproxy plugin, that allows DNS resolution on the proxy (might only be in socks proxy mode)