views:

23

answers:

1

I am using an SQL query to extract web statistics from my website. This is done with the MySQL comand line tool and outputted as a HTML table.

The table is currently formatted like this:

<TABLE>
<TR><TH>Keyword</TH><TH>Date</TH><TH>IP/WHOIS</TH></TR>
<TR><TD>random phrase</TD><TD>2010-10-11</TD><TD>1.2.3.4</TD></TR>
</TABLE>

The table is then refined with a VBS script and mailed to specified recpients with another VBS script.

What I would like to do is include some sort of script that takes the IP address and makes a WHOIS lookup and returns the value contained in the "descr" field. The value could go into the same cell as the IP or a completely new column. The script should be able to execute via my "run.bat" file which is connected to the task scheduler. The script doesn't necessarily have to be VBS, but needs to be able to run via the batch file.

A: 

What descr field are you talking about? WHOIS does not contain a DESCR or desciption field (see e.g. http://whois.domaintools.com/microsoft.com). EDIT: See comments below, it does contain a DESCR field.

There are many examples of VBS scripts querying readily available WHOIS services. If you want to use one of these public WHOIS services check for compliance with business use of the said service. It will get a lot harder when you try to query domain registries themselves, because you need to query different registrars for different IPs (e.g. you will not find an Icelandic (.is) domain within the German (.de) domain registrar's database (www.denic.de).

Try this google search for examples of querying WHOIS servers via VBS.

moontear
There is a DESCR field when querying the RIPE database:
nctrnl
nctrnl
You are right, didn't see that before. However a few test queries show that RIPE does not have specific information for many IP addresses. Usually it displays "The whole IPv4 address space" and in some cases it seems to copy the org-name to descr - maybe it depends on the internet provider to set some kind of description for his IP range? Not very useful information in my eyes.
moontear
It is useful because about 50% of the visitors within my country have their company name in the "descr" field rather than their ISP.
nctrnl
I will look through your links. So far I have found only how to get all WHOIS info, not seperate lines.
nctrnl