grab ip
Moderator: DosItHelp
-
- Expert
- Posts: 1167
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: grab ip
Batch doesn't play nice with things that have GUIs, and especially not with websites.
Your best bet is to download the webpage with cURL or wget and then parse it with findstr.
Your best bet is to download the webpage with cURL or wget and then parse it with findstr.
Re: grab ip
Forget about IP Chicken. There are web services that are made for this kind of automation. E.g. http://myip.dnsomatic.com/. The site consists of the plain IP address only (without any HTML, CSS, JavaScript, ...).
You can easily read it using WSH. And if you want you could write a hybrid script in order to save it in a batch variable.
getIP.bat
Steffen
You can easily read it using WSH. And if you want you could write a hybrid script in order to save it in a batch variable.
getIP.bat
Code: Select all
@if (@a)==(@b) @end /* ~~~ Batch part: ~~~
@echo off &setlocal
for /f "delims=" %%i in ('cscript //nologo //e:jscript "%~fs0"') do set "ip_addr=%%i"
echo IP Address: %ip_addr%
pause
exit /b
~~~ JScript part: ~~~ */
try {
var objXMLHTTP = new ActiveXObject('Microsoft.XMLHTTP');
objXMLHTTP.Open('GET', 'http://myip.dnsomatic.com/', false);
objXMLHTTP.Send();
if (objXMLHTTP.readyState == 4 && objXMLHTTP.status == 200) {
WScript.Echo(objXMLHTTP.responseText);
} else {
WScript.Echo('Error');
}
}
catch(e) {
WScript.Echo('Error');
}
Steffen
Re: grab ip
thanks for your time master aGerman &
Master ShadowThief..
Actually my plan was to get the UltraSurf dns proxy ip address has been created just to have a record logs file thru text files... so i was thinking just to grab the ip address creating by ipchicken or other websites... other solution for this issues masters...
thanks and more power...

Master ShadowThief..
Actually my plan was to get the UltraSurf dns proxy ip address has been created just to have a record logs file thru text files... so i was thinking just to grab the ip address creating by ipchicken or other websites... other solution for this issues masters...
thanks and more power...



Re: grab ip
If the batch code displays the right IP address you can simply redirect it to a log file.
Instead of
you could write something like
or whatever you want to log in the file.
Steffen
Instead of
Code: Select all
echo IP Address: %ip_addr%
you could write something like
Code: Select all
>>"IP.log" echo %date% %time% %ip_addr%
or whatever you want to log in the file.
Steffen