AutoIt
;By Igor Ferreira Cemim ;igor.cemim at yahoo.com.br ;<a href='http://www.autoitscript.com/forum/index.php?showuser=46021' class='bbc_url' title=''>http://www.autoitscript.com/forum/index.php?showuser=46021</a> ;Search a valid IP address on a given URL. Func searchIP($URL = "<a href='http://www.ip-adress.com/' class='bbc_url' title='External link' rel='nofollow external'>http://www.ip-adress.com/"</a>) InetGet($URL, @TempDir & "\IP.dat", 1) ;Regular expression by: ;<a href='http://www.geekzilla.co.uk/view0CBFD9A7-621D-4B0C-9554-91FD48AADC77.htm' class='bbc_url' title='External link' rel='nofollow external'>http://www.geekzilla.co.uk/view0CBFD9A7-621D-4B0C-9554-91FD48AADC77.htm</a> $re = "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" $file = FileOpen(@TempDir & "\IP.dat", 0) While 1 $line = StringLower(FileReadLine($file)) If @error = -1 Then FileClose($file) FileDelete(@TempDir & "\IP.dat") ExitLoop EndIf $webIP = StringRegExpReplace($line, "[a-z]", "") $IP = StringRegExp($webIP, $re, 2) If (IsArray($IP)) Then FileClose($file) FileDelete(@TempDir & "\IP.dat") Return $IP[0] EndIf WEnd EndFunc ;Get external IP from What Is My IP Address automation page. Func getExternalIP() InetGet("<a href='http://www.whatismyip.com/automation/n09230945.asp' class='bbc_url' title='External link' rel='nofollow external'>http://www.whatismyip.com/automation/n09230945.asp"</a>, @TempDir & "\IP.dat", 1) $IP = FileReadLine(@TempDir & "\IP.dat", 1) FileDelete(@TempDir & "\IP.dat") Return $IP EndFunc
Need more comments?!





