Is there a tool anywhere that can perform an nslookup and resolve an IP to a domain name using a list of IP Addresses?

I have a list of IP addresses (websites users are surfing too). We want to know the domains that these IPs resolve too, however, performing an nslookup or whois on each and every single IP would be insane!

Is there a tool anywhere that can perform an nslookup and resolve an IP to a domain name using a list of IP Addresses?

Thanks
LVL 1
stzinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Just script it.  Assuming it's a pure list of IPs, like:

192.168.1.55
10.44.55.12
192.168.77.41

Then the script/command (under NT-XP) would look something like this:

for /f "tokens=1" %a in (ipaddresses.log) do @ nslookup %a >> lookups.log

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorCommented:
(If you made that a command in a script, then you'd need to add a % to the %a's - they would look like %%a)

You can then further parse the lookups.log file by using FIND and dumping that output to a file.  What information do you want?  just the domain name/system name?  If so then you would do something like this in a file.cmd:

for /f "tokens=1" %a in (ipaddresses.log) do @nslookup %a >> lookups.log
find /i "Name:" lookups.log > names.log

0
joopvCommented:
nmap can do this.

http://www.insecure.org/nmap/
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

stzinAuthor Commented:
leew where you wrtite "Name:" what should I actually be putting in there?
0
stzinAuthor Commented:
When I run the for script I keep getting "a was unexpected at this time".

I've tried different itterations of the script, like,
for /F "tokens=1" %a IN (ips.txt) DO nslookup %a

where ips.txt is a list with only 4 ips that looks like this:

100.100.100.100
101.101.10.1.101
102.1.1.1
103.1.1.1


Im trying to keep it as simple as possible just so I cant get some sort of output..what am I doing wrong?

0
joopvCommented:
Did you try nmap yet?  It does exactly what you need.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
If you run FOR /F... as a command, then you use %a.  If you run FOR /F as  a command in a batch file, then it must be referred to as %%a.  I screwed that up, my apologies.
0
Lee W, MVPTechnology and Business Process AdvisorCommented:
Where I write "Name:" you should be putting "Name:" - I didn't mean for this to be interpreted as a variable.  

What's going on is that when you run NSLOOKUP WWW.GOOGLE.COM, the output looks something like this:
Server:  myserver.mydomain.com
Address:  192.168.0.1

Non-authoritative answer:
Name:    www.google.akadns.net
Addresses:  64.233.161.99, 64.233.161.104
Aliases:  www.google.com

So I'm using Find "Name:" - which is in the 5th line of the output and contains the looked up domain.  Find would display that line, but I'm redirecting output from it to a file instead.  If you wanted to get rid of the Name: part of each line in the output file, then you could run this added line in the script (remember %a or %aa depending on whether it's a batch file or just run as a single command on the command line:

FOR /f "tokens=2" %a in (names.log) DO Echo %a >> namesonly.txt
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.