I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative nameserver with the following option:
dig @ns1.foo.example example.com axfr
But this never works. Has anyone a better idea/approach?
I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative nameserver with the following option:
dig @ns1.foo.example example.com axfr
But this never works. Has anyone a better idea/approach?
The hint (using axfr) only works if the NS you're querying (ns1.foo.example
in your example) is configured to allow AXFR requests from the IP you're using; this is unlikely, unless your IP is configured as a secondary for the domain in question.
Basically, there's no easy way to do it if you're not allowed to use axfr. This is intentional, so the only way around it would be via brute force (i.e. dig a.example.com
, dig b.example.com
, ...), which I can't recommend, as it could be viewed as a denial of service attack.
host -l mydomain.com
will fail with Transfer failed
if AXFR is not supported. On Windows (using nslookup -query=AXFR mydomain.com
), you'll get hit with Format error
or something similar. –
Lanceolate If you can't get this information from DNS (e.g. you aren't authorized) then one alternative is to use Wolfram Alpha.
Enter the domain into the search box and run the search. (E.g. stackexchange.com
):
In the 3rd section from the top (named "Web statistics for all of stackexchange.com
") click Subdomains:
In the Subdomains section, click More:
You will be able to see a list of subdomains there. However, I suspect it does not show all subdomains.
realtimerendering.com
, my google search looks like this: site:realtimerendering.com -"www.realtimerendering.com" -"kesen.realtimerendering.com" -"erich.realtimerendering.com" -"advances.realtimerendering.com"
–
Payroll You can use:
$ host -l example.com
Under the hood, this uses the AXFR
query mentioned above. You might not be allowed to do this though. In that case, you'll get a transfer failed
message.
nslookup domain.com
. (host
is not available on Windows) –
Piraeus dig example.com soa
dig @ns.SOA.example example.com axfr
You can only do this if you are connecting to a DNS server for the domain -and- AXFR is enabled for your IP address. This is the mechanism that secondary systems use to load a zone from the primary. In the old days, this was not restricted, but due to security concerns, most primary name servers have a whitelist of: secondary name servers + a couple special systems.
If the nameserver you are using allows this then you can use dig or nslookup.
For example:
#nslookup
>ls example.com
NOTE: because nslookup is being deprecated for dig and other newere tools, some versions of nslookup do not support "ls", most notably macOS X's bundled version.
robotex tools which are free will let you do this but they make you enter the ip of the domain first:
In Windows nslookup
the command is
ls -d example.com > outfile.txt
which stores the subdomain list in outfile.txt
few domains these days allow this
nslookup
on Windows 10 PowerShell as Admin and then ls -d somedomain.com > outfile.txt
and got "Unrecognized command". –
Gowen If the DNS server is configured properly, you won't be able to get the entire domain. If for some reason is allows zone transfers from any host, you'll have to send it the correct packet to make that request. I suspect that's what the dig statement you included does.
© 2022 - 2024 — McMap. All rights reserved.
pdnsutil list-zone example.com
. Of course this will work only if you are host these domains. – Karilla