Hackoo
-
Total Posts
:
105
- Scores: 4
-
Reward points
:
0
- Joined: 6/25/2010
-
Status: offline
|
Local and Public IP and your ISP
Saturday, June 26, 2010 9:41 PM
( permalink)
Hi This script show to you the Local IP and the Public IP and your ISP and in which country. Simply in VBscript ! - To show the local address we use the object Winsock and the ipconfig command - To show the Public address we use the object XMLDOM 'Main Program
ipconfig
Getip
'------------------------------GetTempFile(File)-----------------
Function GetTempFile(File)
Set WshShell=WScript.CreateObject("WScript.Shell")
GetTempFile=WshShell.ExpandEnvironmentStrings("%TEMP%") & "\" & File
End Function
'---------------------------------------------------------------
Function ipconfig
set wshshell=CreateObject("WScript.shell")
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
FileName=GetTempFile("ip.txt")
Command = "%COMSPEC% /C ipconfig > %TEMP%\ip.txt"
Result = WshShell.Run(Command,0,True)
Temp = fso.GetSpecialFolder(2).Path
Set File = fso.OpenTextFile(FileName)
Ping = file.ReadAll
file.Close
ipconfig = Ping
MsgBox ipconfig,64," Adresse IP !" '
end Function
'*******************Getip*************************
Function Getip
on error resume next
const URL = "http://xml.showmyip.com/"
Dim winsock
Dim message
Set winsock = CreateObject("MSWinsock.Winsock")
set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async=false
xmldoc.load(URL)
for each x in xmldoc.documentElement.childNodes
if x.NodeName = "ip" then
myip = x.text
end if
if x.NodeName = "isp" then
myhost = x.text
end if
if x.NodeName = "country" then
mycountry = x.text
end if
next
message = message & "Adresse IP Locale : "
message = message & winsock.localip & vbcrlf & vbcrlf
message = message &"Adresse IP Publique : "
message = message & myip & vbCRLF & vbCRLF
message = message & "Provider internet : " & myhost & vbCRLF & vbCRLF
message = message & "Pays,Ville : " & mycountry & vbCRLF & vbCRLF
Getip=message
msgbox message ,vbinformation ,"IP Locale et IP Publique"
end function
|
|
|
|