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 Jul 26, 2002 | 10:29 AM
  #1  
dsmith's Avatar
dsmith
Thread Starter
Scooby Regular
 
Joined: Mar 1999
Posts: 4,518
Likes: 0
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
Reply
Old Jul 26, 2002 | 10:56 AM
  #2  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
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]
Reply
Old Jul 26, 2002 | 11:10 AM
  #3  
chiark's Avatar
chiark
Scooby Regular
 
Joined: Jun 2000
Posts: 13,735
Likes: 0
Post

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

Ta David - YHM
Reply
Old Jul 26, 2002 | 11:19 AM
  #5  
dsmith's Avatar
dsmith
Thread Starter
Scooby Regular
 
Joined: Mar 1999
Posts: 4,518
Likes: 0
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
Reply
Old Jul 26, 2002 | 11:34 AM
  #6  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
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
Reply
Old Jul 26, 2002 | 11:59 AM
  #7  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

You also have mail...

David
Reply

Trending Topics

Old Jul 26, 2002 | 12:01 PM
  #8  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

Doh.

Double...

David

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

Thanks David

Deano

p.s. chiark - you still havent proved your "one line" claim
Reply
Old Jul 26, 2002 | 02:22 PM
  #10  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

he's too busy shopping in town...

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

David
Reply
Old Jul 26, 2002 | 02:35 PM
  #11  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
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.
Reply
Old Jul 26, 2002 | 02:48 PM
  #12  
chiark's Avatar
chiark
Scooby Regular
 
Joined: Jun 2000
Posts: 13,735
Likes: 0
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)
Reply
Old Jul 26, 2002 | 03:00 PM
  #13  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
Post

Hmm, I love the City in the summer. All those short skirted, high heeled women walking around *yum yum*
Reply
Old Jul 26, 2002 | 03:22 PM
  #14  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post



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




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