-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdsuhhdasdsauoskadjhjshdasdhukdsahdjhasydsajdkdahsdshaduisahduksadhaskud.bat
86 lines (85 loc) · 2.54 KB
/
dsuhhdasdsauoskadjhjshdasdhukdsahdjhasydsajdkdahsdshaduisahduksadhaskud.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
rem Ip Lookup
@echo off
title IP Lookup
color 5
mode con lines=13 cols=70
setlocal ENABLEDELAYEDEXPANSION
set webclient=webclient
if exist "%temp%\%webclient%.vbs" del "%temp%\%webclient%.vbs" /f /q /s >nul
if exist "%temp%\response.txt" del "%temp%\response.txt" /f /q /s >nul
:menu
cls
echo Ip lookup/
cls
echo.
echo Type an IP to lookup
echo.
set ip=127.0.0.1
set /p ip=IP:
echo sUrl = "http://ipinfo.io/%ip%/json" > %temp%\%webclient%.vbs
:localip
cls
echo set oHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0") >> %temp%\%webclient%.vbs
echo oHTTP.open "GET", sUrl,false >> %temp%\%webclient%.vbs
echo oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" >> %temp%\%webclient%.vbs
echo oHTTP.setRequestHeader "Content-Length", Len(sRequest) >> %temp%\%webclient%.vbs
echo oHTTP.send sRequest >> %temp%\%webclient%.vbs
echo HTTPGET = oHTTP.responseText >> %temp%\%webclient%.vbs
echo strDirectory = "%temp%\response.txt" >> %temp%\%webclient%.vbs
echo set objFSO = CreateObject("Scripting.FileSystemObject") >> %temp%\%webclient%.vbs
echo set objFile = objFSO.CreateTextFile(strDirectory) >> %temp%\%webclient%.vbs
echo objFile.Write(HTTPGET) >> %temp%\%webclient%.vbs
echo objFile.Close >> %temp%\%webclient%.vbs
echo Wscript.Quit >> %temp%\%webclient%.vbs
start %temp%\%webclient%.vbs
set /a requests=0
echo.
rem echo Waiting for API response. . .
echo Looking up IP Address. . .
:checkresponseexists
if %requests% gtr 7 goto failed
IF EXIST "%temp%\response.txt" (
goto response_exist
) ELSE (
ping 127.0.0.1 -n 2 -w 1000 >nul
goto checkresponseexists
)
color 5
:failed
taskkill /f /im wscript.exe >nul
del "%temp%\%webclient%.vbs" /f /q /s >nul
echo.
echo Did not receive a response from the API.
echo.
pause
goto menu
:response_exist
cls
echo.
echo IP Results Listed Below
set /a num=(%Random%%%9)+1
color %num%
for /f "delims= " %%i in ('findstr /i "," %temp%\response.txt') do (
set data=%%i
set data=!data:,=!
set data=!data:""=Not Listed!
set data=!data:"=!
set data=!data:ip:=IP: !
set data=!data:hostname:=Hostname: !
set data=!data:org:=ISP: !
set data=!data:city:=City: !
set data=!data:region:=State: !
set data=!data:country:=Country: !
set data=!data:postal:=Postal Code: !
set data=!data:loc:=Location: !
set data=!data:timezone:=Timezone: !
echo !data!
)
echo.
del "%temp%\%webclient%.vbs" /f /q /s >nul
del "%temp%\response.txt" /f /q /s >nul
pause
if '%ip%'=='' goto menu
goto iplookup
pause
goto menu