IP2Location with extra info by Hackoo - Hackoo - Aug 21, 2016
Hi 🤝
This an hybrid code Powershell and batch to catch your extrenal IP with more information, like your Country,ISP,LATITUDE,LONGITUDE,TIMEZONE etc...
IP2Location.bat ✌ 🤗 👍 🎉
Code @echo off
Title My External IP by Hackoo 2015
mode con cols=116 lines=14 & color 0A
Set OuputFile=%Temp%\myexternalip.txt
Set PSFile=%Temp%\tmp.ps1
Set DataFile=%Temp%\MyData.txt
(
echo $wc = new-object System.Net.WebClient
echo $wc.DownloadString("http://myexternalip.com/raw"^)
echo $wc.DownloadString("http://ip-api.com/csv/"^) ^> %OuputFile%
)>%PSFile%
cmd /c PowerShell.exe -ExecutionPolicy bypass -noprofile -file %PSFile%
Del %PSFile%
Timeout /T 1 /NoBreak>nul
cls
FOR /F "tokens=1-14 delims=," %%a in ('Type %OuputFile%') do (
echo %%a - %%b - %%c - %%d - %%e - %%f - %%g - %%h - %%i - %%j - %%k - %%l - %%m - %%n>nul
)
cls
for /f "delims=" %%A in ('Type %OuputFile%') do (
set "data=%%A"
setlocal enabledelayedexpansion
set data
set "data=!data:,,,,,=,#,#,#,#,!"
set "data=!data:,,,,=,#,#,#,!"
set "data=!data:,,,=,#,#,!"
set "data=!data:,,=,#,!"
for /f "tokens=1-14 delims=," %%a in ("!Data:#=NULL!") do (
endlocal
echo Status : %%a
echo Country : %%b
echo Code pays : %%c
echo Region : %%d
echo Code region : %%e
echo Ville : %%f
echo Code postale : %%g
echo Latitude : %%h
echo Longitude : %%i
echo Fuseau horaire : %%j
echo Provider-FAI-AS num/nom : %%k - %%l - %%m
echo IP Adress : %%n
(
echo Status : %%a
echo Country : %%b
echo Code pays : %%c
echo Region : %%d
echo Code region : %%e
echo Ville : %%f
echo Code postale : %%g
echo Latitude : %%h
echo Longitude : %%i
echo Fuseau horaire : %%j
echo Provider-FAI-AS num/nom : %%k - %%l - %%m
echo IP Adress : %%n
)>%DataFile%
)
)
pause
::Code from Sacha thanks to him (-_°)
call :make
for /f %%a in ('cscript.exe /nologo getcount.vbs "http://myexternalip.com/raw"') do (
set "IP=%%a"
)
for /f "tokens=1-20 delims=," %%a in ('cscript.exe /nologo getcount.vbs http://ip-api.com/csv/%IP%') do (
cls
echo IP PUBLIQUE : %IP%
echo STATUT : %%a
echo PAYS : %%b
echo PAYS MIN : %%c
echo REGION : %%e
echo VILLE : %%f
echo LATITUDE : %%g
echo LONGITUDE : %%h
echo TIMEZONE : %%i
echo ISP : %%j
echo FAI : %%k
echo AS NAME : %%l
set LA=%%g
set LO=%%h
set "VI=%%b-%%f"
)
pause
start https://www.google.fr/maps/place/%VI%
Start %DataFile%
if exist GetCount.vbs del GetCount.vbs
:make
If not exist Getcount.vbs ((
echo Dim o
echo Var1=Wscript.Arguments(0^)
echo Set o = CreateObject("MSXML2.XMLHTTP"^)
echo o.open "GET", var1, False
echo o.send
echo wscript.echo o.responseText
)>GetCount.vbs
)
goto :eof
* - adrielgolabek - Aug 22, 2016
You may want to check this out, and fix it according to this error??? Or maybe try run it on yours and see if you get the same errors.
2ND EDIT: I've fixed up the script for you. Hope this helps you. You can find it below...
I am encountering 2 problems when running your script. Other than this, everything seems to be working perfectly.
#1. Command Prompt doesn't delete GetCount.vbs at the end of the batch file.
#2. MyData.txt cannot be located when google maps is opened.
I run Windows 8.1 Pro on a Hewlett-Packard Laptop. PM me if you need more details.__________________________________________________________________________________
This is the response I receive when running your script. (As you can see, some stuff are jumbled around and in the wrong line):
IP PUBLIQUE : {REAL IP HERE}
STATUT : success
PAYS : Australia
PAYS MIN : AU
REGION : "New South Wales"
VILLE : {City Where I Reside}
LATITUDE : 2000
LONGITUDE : -33.8591
TIMEZONE : 151.2002 ( <<<<<< I have a feeling this is incorrect?)
ISP : Australia/{City where I Reside}
FAI : {My ISP}
AS NAME : "{ISP} Wireless"
Press any key to continue . . .______________________________________________________________
I suggest you change the code to this! (This is the fixed up edition).
Code @echo off
Title My External IP by Hackoo 2015
mode con cols=116 lines=14 & color 0A
Set OuputFile=%Temp%\myexternalip.txt
Set PSFile=%Temp%\tmp.ps1
Set DataFile=%Temp%\MyData.txt
(
echo $wc = new-object System.Net.WebClient
echo $wc.DownloadString("http://myexternalip.com/raw"^)
echo $wc.DownloadString("http://ip-api.com/csv/"^) ^> %OuputFile%
)>%PSFile%
cmd /c PowerShell.exe -ExecutionPolicy bypass -noprofile -file %PSFile%
Del %PSFile%
Timeout /T 1 /NoBreak>nul
cls
FOR /F "tokens=1-14 delims=," %%a in ('Type %OuputFile%') do (
echo %%a - %%b - %%c - %%d - %%e - %%f - %%g - %%h - %%i - %%j - %%k - %%l - %%m - %%n>nul
)
cls
for /f "delims=" %%A in ('Type %OuputFile%') do (
set "data=%%A"
setlocal enabledelayedexpansion
set data
set "data=!data:,,,,,=,#,#,#,#,!"
set "data=!data:,,,,=,#,#,#,!"
set "data=!data:,,,=,#,#,!"
set "data=!data:,,=,#,!"
for /f "tokens=1-14 delims=," %%a in ("!Data:#=NULL!") do (
endlocal
echo Status : %%a
echo Country : %%b
echo Code pays : %%c
echo Region : %%d
echo Code region : %%e
echo Ville : %%f
echo Code postale : %%g
echo Latitude : %%h
echo Longitude : %%i
echo Fuseau horaire : %%j
echo Provider-FAI-AS num/nom : %%k - %%l - %%m
echo IP Address : %%n
(
echo Status : %%a
echo Country : %%b
echo Code pays : %%c
echo Region : %%d
echo Code region : %%e
echo Ville : %%f
echo Code postale : %%g
echo Latitude : %%h
echo Longitude : %%i
echo Fuseau horaire : %%j
echo Provider-FAI-AS num/nom : %%k - %%l - %%m
echo IP Address : %%n
)>%DataFile%
)
)
pause
::Code from Sacha thanks to him (-_°)
call :make
for /f %%a in ('cscript.exe /nologo getcount.vbs "http://myexternalip.com/raw"') do (
set "IP=%%a"
)
for /f "tokens=1-20 delims=," %%a in ('cscript.exe /nologo getcount.vbs http://ip-api.com/csv/%IP%') do (
cls
echo PUBLIC IP : %IP%
echo STATUS : %%a
echo COUNTRY : %%b
echo COUNTRY CODE : %%c
echo REGION : %%e
echo CITY : %%f
echo LATITUDE : %%h
echo LONGITUDE : %%i
echo TIMEZONE : %%j
echo ISP : %%k
echo FAI : %%l
echo AS NAME : %%m
set LA=%%h
set LO=%%i
set "VI=%%b-%%f"
)
pause
start https://www.google.com/maps/place/%VI%
Start %DataFile%
if exist GetCount.vbs del GetCount.vbs
:make
If not exist Getcount.vbs ((
echo Dim o
echo Var1=Wscript.Arguments(0^)
echo Set o = CreateObject("MSXML2.XMLHTTP"^)
echo o.open "GET", var1, False
echo o.send
echo wscript.echo o.responseText
)>GetCount.vbs
)
goto :eof
* - Ventriloquism - Aug 22, 2016
^^For god sakes lol. Use code tags next time.
@Hackoo Very nice 😎 It worked great.
* - adrielgolabek - Aug 22, 2016
(Aug 22, 2016 04:46 AM)Ventriloquism Wrote: ^^For god sakes lol. Use code tags next time.
@Hackoo Very nice 😎 It worked great.
Sorry, my bad.
* - Hackoo - Aug 23, 2016
@adrielgolabek
Thank you for testing this script ✌
I will take a look for your fixed code and thank you again 👍
NB: I have a windows 7 french machine and it worked for me as i expected
* - adrielgolabek - Aug 23, 2016
(Aug 23, 2016 10:11 PM)Hackoo Wrote: @adrielgolabek
Thank you for testing this script ✌
I will take a look for your fixed code and thank you again 👍
NB: I have a windows 7 french machine and it worked for me as i expected
No problem at all. Happy to help other HF members when they need it. 👍
* - oeufrouge - Aug 29, 2016
thanks you man for this is good joob
* - Cute - Sep 12, 2016
Is there a way to Search another persons ip with this? Or is that not possible.
* - JoshuTee - Sep 13, 2016
Nice, but why write it in batch? Why not go for JScript, VBS or Powershell purely instead?
* - Hackoo - Sep 13, 2016
(Sep 12, 2016 08:14 PM)Bioneer Wrote: Is there a way to Search another persons ip with this? Or is that not possible.
Did you mean like this way ???
Code @echo off
Title Ping hosts tester with geolocation
:PingLoop
Color 0A & cls
echo Type the host IP to get info about its ping and its geolocation
set /p "IP=> "
Call :StringFormat "%IP%"
ping %IP%
Start "" "http://ip-api.com/#%IP%"
cls
echo.
echo Hit any key to continue for another IP ...
pause>nul
Goto :PingLoop
::*******************************************************************************
REM To replace "http://" or "https://" in IP typed by the user
:StringFormat <URL>
(
echo Function StringReplace(Str^)
echo Str = Replace(Str,"http://",""^)
echo Str = Replace(Str,"https://",""^)
echo StringReplace = str
echo End Function
echo wscript.echo StringReplace("%~1"^)
)>"%tmp%\%~n0.vbs"
for /f "delims=" %%a in ('Cscript /nologo "%tmp%\%~n0.vbs"') do ( set "IP=%%a" )
If Exist "%tmp%\%~n0.vbs" Del "%tmp%\%~n0.vbs"
exit /b
::*******************************************************************************
* - einstein1969 - Oct 24, 2016
nice script Hackoo!
einstein1969
RE: IP2Location with extra info by Hackoo - Hackoo - Jul 9, 2018
Hi ✌
New update for this script 👍
PHP Code
<?php @echo off Title Get IP - ISP - Country - City - TimeZone - Latitude - Longitude by Hackoo 2018 Mode 90,45 & color 0A set "VBS=%Temp%\ipinfodb.vbs"
( echo url = "https://www.ipinfodb.com/" echo Set ie = CreateObject("InternetExplorer.Application"^) echo ie.Navigate url echo While ie.ReadyState ^<^> 4 echo WScript.Sleep 100 echo Wend echo Set tbl = ie.document.getElementsByTagName("table"^).Item(0^) echo For i=0 to tbl.getElementsByTagName("td"^).length - 2 echo Info = Info ^& tbl.getElementsByTagName("td"^).Item(i^).innerText ^& vbCrlf ^& String(20,"-"^) ^& VBCRLF echo Next echo wscript.echo Info echo ie.Quit )>"%VBS%" cscript //nologo "%VBS%" | find /V "Report Incorrect Location" echo( echo Hit any key to show your position place in Google Maps pause>nul Set "Pattern=[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9] ,[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9]" for /f "delims=" %%a in ('cscript //nologo "%VBS%" ^|findstr /R "%Pattern%"') do set "Coord=%%a" set Coord=%Coord: =% Start "" https://www.google.fr/maps/place/%Coord% exit
😉
RE: IP2Location with extra info by Hackoo - Sau2 - Aug 18, 2018
Yikes that was simple but i like it keep it up man. <3
|