WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

TCPIP and IP Address

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Extended IP Address Data


Question:

Is there a way to perform a lookup on an ip address in Winbatch? I would be interested more in information returned from an arin lookup, specifically country of origin, etc. This seems to be something i would derive from a publicly available version of a lookup registry's query service but i don't know. I looked at ipaddr2host and other functions in the WWIPG34I extender but these seem to be more involved with local ip address resolution like just local host name to ip.

For anyone not familiar with what i mean... info like this:

IP Address : 210.177.x.x [ 210.177.x.x ]
ISP : PCCW Business Internet Access
Organization : UNITED DAILY NEWS HK BUREAU LTD
Location : HK HK, Hong Kong
City : -, - -

Answer:

No built in function that does that kind of lookup. I found a website called ShowMyIp that can lookup the informtaion for an external IP address. http://www.showmyip.com/lookups/ It apparently allows up to 10000 Lookups per day for unregistered users on our showmyip.com web site. Looks like you have to be a subscripber inorder to get some of the information such as ISP.

Here is some WinBatch code that can lookup and external ipAddress and grab the country name.

ipaddr = '66.94.231.98'
site = 'http://www.showmyip.com/xml/?ip=' : ipaddr 
XMLHTTP  = CreateObject( 'Msxml2.XMLHTTP' ) 
XMLHTTP.Open("GET", site, @false) 
XMLHTTP.Send("") 
;Pause("Response", XMLHTTP.responseText) 
xmlDoc = CreateObject("Microsoft.XMLDOM") 
xmlDoc.async = @false 
xmlDoc.loadXML(XMLHTTP.responseText) 
root = xmlDoc.documentElement 
countryList = xmlDoc.getElementsByTagName("lookup_country") 
country = countryList.item(0).firstChild.nodeValue
Message( ipaddr, 'Country: ':country )
Exit

Article ID:   W17471
File Created: 2008:04:10:15:11:16
Last Updated: 2008:04:10:15:11:16