nslookup script required
#1
Have a list (text file) of DNS names. I need to resolve each one and record the IP address(es). I dont have access to the DNS server so cant grab the zone files.
Anyone fancy knocking together a script (Win2K Batch or Linux Shell) to nslookup each one and write the results to a file ?
Go-on, you know its more interesting than your own work...
Deano
Anyone fancy knocking together a script (Win2K Batch or Linux Shell) to nslookup each one and write the results to a file ?
Go-on, you know its more interesting than your own work...
Deano
#2
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
Gimme 10 mins...
drop me a mail with the file to email add removed
David
[Edited by David_Wallis - 7/26/2002 8:21:25 PM]
drop me a mail with the file to email add removed
David
[Edited by David_Wallis - 7/26/2002 8:21:25 PM]
#6
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
I had to cheat... couldnt get just an ip from nslookup without a bit more work.. and I have a hangover...
Save first script as test.vbs or similar..
Const ForReading = 1
Dim fso, theFile, retstring
Set fso = CreateObject("Scripting.FileSystemObject")
Set HostsFile = fso.OpenTextFile("c:\hosts.txt", ForReading, False)
Set WshShell = WScript.CreateObject("WScript.Shell")
Do While HostsFile.AtEndOfStream <> True
hostname = HostsFile.ReadLine
strCmdLine = "cmd /c c:\nsl1.bat " & hostname
WshShell.Run (strCmdLine)
Loop
HostsFile.Close
Save the following as c:\nsl1.bat
@ECHO OFF
for /f "tokens=2 delims=[]" %%i in ('ping %1') do Echo %1 %%i >>c:\output.txt
Then run test.vbs by either clicking on it or typing cscript test.vbs or wscript test.vbs
You should then get a file called output.txt with hostname ip
David
Save first script as test.vbs or similar..
Const ForReading = 1
Dim fso, theFile, retstring
Set fso = CreateObject("Scripting.FileSystemObject")
Set HostsFile = fso.OpenTextFile("c:\hosts.txt", ForReading, False)
Set WshShell = WScript.CreateObject("WScript.Shell")
Do While HostsFile.AtEndOfStream <> True
hostname = HostsFile.ReadLine
strCmdLine = "cmd /c c:\nsl1.bat " & hostname
WshShell.Run (strCmdLine)
Loop
HostsFile.Close
Save the following as c:\nsl1.bat
@ECHO OFF
for /f "tokens=2 delims=[]" %%i in ('ping %1') do Echo %1 %%i >>c:\output.txt
Then run test.vbs by either clicking on it or typing cscript test.vbs or wscript test.vbs
You should then get a file called output.txt with hostname ip
David
Trending Topics
#10
Scooby Regular
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
he's too busy shopping in town...
Im not safe from scoobynet anywhere... nipped out for a walk (perv) around town..
David
Im not safe from scoobynet anywhere... nipped out for a walk (perv) around town..
David
#11
Scooby Regular
I wasn't gonna bother, but since nobody else has
the file hostnames contains a newline delimited list of hostnames you want to resolve. Wont work on Win32.
perl -ne 'system("host", $_)' hostnames > output
Steve.
the file hostnames contains a newline delimited list of hostnames you want to resolve. Wont work on Win32.
perl -ne 'system("host", $_)' hostnames > output
Steve.
Thread
Thread Starter
Forum
Replies
Last Post
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM