Retrieving WAN IP address directly from a Linksys WRT54G Broadband Router

This script queries the WRT54G device directly, retrieving the WAN IP from the administrative web page built into the device. You do not have to contact any remote internet site to retrieve your own WAN IP address.

This script's technique with many makes and models of broadband routers, but will likely require tweaking for anything other than the LinkSys WRT54G Broadband Router (a very popular model).

NOTE: If you cut and paste this content into your script, be sure that the lines have not wrapped and that no HTML code has found its way into the script because of its placement on a web page.

Enjoy. Comments welcome.

Dr. C. __________________________________________________ __________________ SCRIPT:

'================================================= =========== ' *Retrieve WAN IP* (c)2006 Dr. F.M. (Mike) Covington, LanCanyon Labs '================================================= =========== 'This script retrieves the WAN IP address directly from a Linksys WRT54G broadband router. 'Replace default internal router IP address and password as necessary. '================================================= =========== Set xml = CreateObject("Microsoft.XMLHTTP") xml.Open "GET", "",True,"UserName","admin"xml.Send wscript.sleep 1500 x=15 IP = mid(xml.responsetext,instr(xml.responsetext,"var wan_ip = ")

+14,x) do while instr(IP,"""") x=x-1 IP=mid(IP,1,x) loop wscript.echo "Current IP Address: "&vbcrlf& IP '================================================= ============
Reply to
Loading thread data ... Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.