Jump to content

Show external ip


Recommended Posts

I have been trying to make a .cmd file to retreive a (portable) computers external IP.

IDEA:

1. 'wget http://www.shoymyip.com'

2. grep for external IP in index.html file

3. send external IP, username, computername etc. via the tcpsend script o this site to a public available server for traceability of stolen portable PCs (we have about 500 portable PCs in a school environment...)

However the grep or find function doesn´t seem to like .html files.

Even tried to rename the .html to .txt but no difference.

QUESTION:

Someone have a autoit script that can search for textpatterns in .html files?

Edited by Fredrik
Link to comment
Share on other sites

The function is called StringRegeExp. Others like to use the basic String functions.

But then again the _GetIP udf included in the distribution should do what you want.

Link to comment
Share on other sites

My old program:

#region INCLUDES
#include <INet.au3> 
#include <GuiConstants.au3>
#endregion INCLUDES
#region GUI
inetget("http://www.watismijnip.nl/index.php","C:\index.php",1,0)
$file = FileOpen("c:\index.php", 0)
; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
$size = FileGetSize("c:\index.php")
$init = fileread($file,$size-1)
fileclose($file)
FileDelete("c:\index.php")

; Find the Hostname 
$start = stringinstr($init,"Hostname")
$end = StringInStr(stringmid($init,$start),"<")
$hostname = stringmid($init,$start+10,$end-1-10)
;Find the provider
$start = stringinstr($init,"Provider")
$end = StringInStr(stringmid($init,$start),"<")
$Provider = stringmid($init,$start+10,$end-1-10)
;Find the ip
$Temp = stringinstr($init,"Uw IP-Adres:")
$temp2 = stringmid($init,$temp)
$Start = stringinstr($temp2,">")
$temp3 = stringmid($temp2,$start+1)
$End = stringinstr($temp3,"<")
$ip = stringmid($temp2,$start+1,$end-1)


GuiCreate("JD Software - IP Checker", 400, 400,(@DesktopWidth-400)/2, (@DesktopHeight-400)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$Label1 =guictrlcreatelabel("Hostname : ",0,0)
$Label2 =guictrlcreatelabel("Provider: ",0,20)
$Label3 =guictrlcreatelabel("IpAddress: ",0,40)
$hostnameAddress = guictrlcreateinput($Hostname,100,0,200,20)
$ProviderAddress = guictrlcreateinput($Provider,100,20)
$ipGuiAddress = guictrlcreateinput($ip,100,40)
GUICtrlSetStyle($hostnameAddress,$es_readonly,0x00002)
GUICtrlSetStyle($ProviderAddress,$es_readonly,0x00002)
GUICtrlSetStyle($ipGuiAddress,$es_readonly,0x00002)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Exit
#endregion GUI
#region Functions
func _ip() 
   $a = _GetIp() 
   ;$b =stringinstr($a,"IP") 
   ;$c = StringMid($a,$b+6,stringlen($a)-$b-4) 
   return $a
EndFunc
;FuncSpace
Func _ipcheck()
    msgbox(64,"Your ip is:",_ip())
EndFunc 
#endregion Functions

-jaenster

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...