Advertisement
DSTAT

IP-Lookup

Jul 24th, 2017
15,548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.08 KB | None | 0 0
  1. @echo off
  2. rem Paste this code into notepad and save it as IP-Lookup.bat
  3. rem Coded by @DDoS_Filter on instagram.
  4. rem http://ddosfilter.net/
  5. title IP Lookup
  6. color 0A
  7. mode con lines=13 cols=70
  8. setlocal ENABLEDELAYEDEXPANSION
  9. set webclient=webclient
  10. if exist "%temp%\%webclient%.vbs" del "%temp%\%webclient%.vbs" /f /q /s >nul
  11. if exist "%temp%\response.txt" del "%temp%\response.txt" /f /q /s >nul
  12. :menu
  13. cls
  14. echo Coded by @DDoS_Filter
  15. echo.
  16. echo.
  17. echo                       What would you like to do?
  18. echo.
  19. echo                            View your IP: (1)
  20. echo.
  21. echo                            Lookup an IP: (2)
  22. echo.
  23. echo.
  24. echo.
  25. goto action
  26. :input
  27. echo.
  28. echo Please enter a valid input option.
  29. echo.
  30. :action
  31. echo.
  32. set /p action=Type your choice. 1,2:
  33. if '%action%'=='1' echo sUrl = "http://ipinfo.io/json" > %temp%\%webclient%.vbs & goto localip
  34. if '%action%'=='2' goto iplookup
  35. goto input
  36. :iplookup
  37. cls
  38. echo.
  39. echo                          Type an IP to lookup
  40. echo.
  41. set ip=127.0.0.1
  42. set /p ip=IP:
  43. echo sUrl = "http://ipinfo.io/%ip%/json" > %temp%\%webclient%.vbs
  44. :localip
  45. cls
  46. echo set oHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0") >> %temp%\%webclient%.vbs
  47. echo oHTTP.open "GET", sUrl,false >> %temp%\%webclient%.vbs
  48. echo oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" >> %temp%\%webclient%.vbs
  49. echo oHTTP.setRequestHeader "Content-Length", Len(sRequest) >> %temp%\%webclient%.vbs
  50. echo oHTTP.send sRequest >> %temp%\%webclient%.vbs
  51. echo HTTPGET = oHTTP.responseText >> %temp%\%webclient%.vbs
  52. echo strDirectory = "%temp%\response.txt" >> %temp%\%webclient%.vbs
  53. echo set objFSO = CreateObject("Scripting.FileSystemObject") >> %temp%\%webclient%.vbs
  54. echo set objFile = objFSO.CreateTextFile(strDirectory) >> %temp%\%webclient%.vbs
  55. echo objFile.Write(HTTPGET) >> %temp%\%webclient%.vbs
  56. echo objFile.Close >> %temp%\%webclient%.vbs
  57. echo Wscript.Quit >> %temp%\%webclient%.vbs
  58. start %temp%\%webclient%.vbs
  59. set /a requests=0
  60. echo.
  61. rem echo Waiting for API response. . .
  62. echo  Looking up IP Address. . .
  63. :checkresponseexists
  64. set /a requests=%requests% + 1
  65. if %requests% gtr 7 goto failed
  66. IF EXIST "%temp%\response.txt" (
  67. goto response_exist
  68. ) ELSE (
  69. ping 127.0.0.1 -n 2 -w 1000 >nul
  70. goto checkresponseexists
  71. )
  72. :failed
  73. taskkill /f /im wscript.exe >nul
  74. del "%temp%\%webclient%.vbs" /f /q /s >nul
  75. echo.
  76. echo Did not receive a response from the API.
  77. echo.
  78. pause
  79. goto menu
  80. :response_exist
  81. cls
  82. echo.
  83. for /f "delims=     " %%i in ('findstr /i "," %temp%\response.txt') do (
  84.     set data=%%i
  85.     set data=!data:,=!
  86.     set data=!data:""=Not Listed!
  87.     set data=!data:"=!
  88.     set data=!data:ip:=IP:      !
  89.     set data=!data:hostname:=Hostname:  !
  90.     set data=!data:org:=ISP:        !
  91.     set data=!data:city:=City:      !
  92.     set data=!data:region:=State:   !
  93.     set data=!data:country:=Country:    !
  94.     set data=!data:postal:=Postal:  !
  95.     set data=!data:loc:=Location:   !
  96.     set data=!data:timezone:=Timezone:  !
  97.     echo !data!
  98. )
  99. echo.
  100. del "%temp%\%webclient%.vbs" /f /q /s >nul
  101. del "%temp%\response.txt" /f /q /s >nul
  102. pause
  103. if '%ip%'=='' goto menu
  104. goto iplookup
  105. Rem Coded by DSTAT. Instagram: @DDoS_Filter
  106. Rem http://ddosfilter.net/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement