Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - DNS Query with WSH

Reply
 
Old 05-21-2009   #1 (permalink)
IIJIMA Hiromitsu


 
 

DNS Query with WSH

Hi all,

I am trying to analyze web server's log and need to convert
IP addresses in the log into human-readable host name.

I need to write a script that accepts IP addresses from STDIN or
somewhere else, and prints correspobnding FQDN. For instance,
it should read an IP address '61.211.239.46' and write
'sodans.usata.org'.

I am now capturing NSLOOKUP's output, but it is not smart because
there are considerable overhead of calling NSLOOKUP.EXE for each
IP address.

So I have a question: is there any smart and fast method to do a
DNS query on WSH (JScript/VBScript)?

I am working on Windows XP Pro and Vista Business, both 32-bit
Japanese edition.

Thanks in advance.


--
--
========================================================================
(Mr.) IIJIMA Hiromitsu, Chairman of DENNOU GEDOU GAKKAI, N.D.D.
http://www.dennougedougakkai-ndd.org/~delmonta/
mailto:delmonta@xxxxxx

My System SpecsSystem Spec
Old 05-21-2009   #2 (permalink)
mayayana


 
 

Re: DNS Query with WSH

One possibility is here:

www.jsware.net/jsware/scripts.php5#jshttp

The download is a component that, among other things,
does IP -> Hostname conversion. There's also a pre-
written script included (IPInfo.vbs) for processing server
logs. It uses both hostname resolution and a free database
to convert something like:
100.100.100.100
to something like:
server123.somewhere.com - Akron-OH-US

The component must be registered on the system but has
no dependencies. It uses the Windows sockets API directly.

I have no experience with STDIN. I'm not sure how that
would fit with this component. The IP processing script is
just a drag-drop operation. You edit the script to accomodate
your server log format. Then drop a log onto the script. The
script then generates a duplicate log with the IP numbers
replaced by hostname-location.
Quote:

> Hi all,
>
> I am trying to analyze web server's log and need to convert
> IP addresses in the log into human-readable host name.
>
> I need to write a script that accepts IP addresses from STDIN or
> somewhere else, and prints correspobnding FQDN. For instance,
> it should read an IP address '61.211.239.46' and write
> 'sodans.usata.org'.
>
> I am now capturing NSLOOKUP's output, but it is not smart because
> there are considerable overhead of calling NSLOOKUP.EXE for each
> IP address.
>
> So I have a question: is there any smart and fast method to do a
> DNS query on WSH (JScript/VBScript)?
>
> I am working on Windows XP Pro and Vista Business, both 32-bit
> Japanese edition.
>
> Thanks in advance.
>
>
> --
> --
> ========================================================================
> (Mr.) IIJIMA Hiromitsu, Chairman of DENNOU GEDOU GAKKAI, N.D.D.
> http://www.dennougedougakkai-ndd.org/~delmonta/
> mailto:delmonta@xxxxxx

My System SpecsSystem Spec
Old 05-22-2009   #3 (permalink)
IIJIMA Hiromitsu


 
 

Re: DNS Query with WSH

Thanks, mayayana.

I have to tell one more restriction: the script file must be portable
and available to non-Admin users. Therefore, I must avoid registering
a new OCX component to the system.

If I am allowed to distribute a pair of large files, I would use
perl's built-in gethostbyaddr() function. It requires PERL.EXE and
PERL58.DLL be distributed together. If a DNS query can be done by
WSH, I will no longer need to distribute those large files....


"mayayana" <mayaXXyana@xxxxxx> wrote in message news:ObEbd%23o2JHA.1096@xxxxxx
Quote:

> One possibility is here:
>
> www.jsware.net/jsware/scripts.php5#jshttp
>
> The download is a component that, among other things,
> does IP -> Hostname conversion. There's also a pre-
> written script included (IPInfo.vbs) for processing server
> logs. It uses both hostname resolution and a free database
> to convert something like:
> 100.100.100.100
> to something like:
> server123.somewhere.com - Akron-OH-US
>
> The component must be registered on the system but has
> no dependencies. It uses the Windows sockets API directly.
Quote:
Quote:

>> I am trying to analyze web server's log and need to convert
>> IP addresses in the log into human-readable host name.
>>
>> I need to write a script that accepts IP addresses from STDIN or
>> somewhere else, and prints correspobnding FQDN. For instance,
>> it should read an IP address '61.211.239.46' and write
>> 'sodans.usata.org'.
My System SpecsSystem Spec
Old 05-25-2009   #4 (permalink)
IIJIMA Hiromitsu


 
 

Re: DNS Query with WSH

Thanks hth, it worked envn on Windows 98 which does not have nsloopup.exe.
Quote:

> you try can to use "ping -a 61.211.239.46" ... maybe this is faster then
> nslookup
>
> hth
Quote:
Quote:
Quote:

>>>> I am trying to analyze web server's log and need to convert
>>>> IP addresses in the log into human-readable host name.
>>>>
>>>> I need to write a script that accepts IP addresses from STDIN or
>>>> somewhere else, and prints correspobnding FQDN. For instance,
>>>> it should read an IP address '61.211.239.46' and write
>>>> 'sodans.usata.org'.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
SP2 query... Vista General
Tab key query Vista General
ram query Overclocking & Cooling
RAM query General Discussion


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46