Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

nslookup script required

Thread Tools
 
Search this Thread
 
Old 26 July 2002, 10:29 AM
  #1  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 26 July 2002, 10:56 AM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
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]
Old 26 July 2002, 11:10 AM
  #3  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

Go-on, you know its more interesting than your own work...
You Can Do It In A Line Of Perl.
Old 26 July 2002, 11:16 AM
  #4  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

Ta David - YHM
Old 26 July 2002, 11:19 AM
  #5  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

You see I know it *should* be a line of perl - but buggered if I can ever get my head round perl enough to even start...

Go on prove it anyway
Old 26 July 2002, 11:34 AM
  #6  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
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
Old 26 July 2002, 11:59 AM
  #7  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Post

You also have mail...

David
Old 26 July 2002, 12:01 PM
  #8  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Post

Doh.

Double...

David

[Edited by David_Wallis - 7/26/2002 12:01:53 PM]
Old 26 July 2002, 02:06 PM
  #9  
dsmith
Scooby Regular
Thread Starter
 
dsmith's Avatar
 
Join Date: Mar 1999
Posts: 4,518
Likes: 0
Received 0 Likes on 0 Posts
Post

Thanks David

Deano

p.s. chiark - you still havent proved your "one line" claim
Old 26 July 2002, 02:22 PM
  #10  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Post

he's too busy shopping in town...

Im not safe from scoobynet anywhere... nipped out for a walk (perv) around town..

David
Old 26 July 2002, 02:35 PM
  #11  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

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.
Old 26 July 2002, 02:48 PM
  #12  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

Hot weather, girls not wearing much and David's letching in town...

Cheers Steve, 10/10. Naturally, that was just what I was thinking. (ahem)
Old 26 July 2002, 03:00 PM
  #13  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Hmm, I love the City in the summer. All those short skirted, high heeled women walking around *yum yum*
Old 26 July 2002, 03:22 PM
  #14  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
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
Post



David
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Abx
Subaru
22
09 January 2016 05:42 PM
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
FuZzBoM
Wheels, Tyres & Brakes
16
04 October 2015 09:49 PM
buckerz69
Wanted
2
03 October 2015 09:54 PM
Pro-Line Motorsport
Car Parts For Sale
2
29 September 2015 07:36 PM



Quick Reply: nslookup script required



All times are GMT +1. The time now is 10:09 PM.