-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.bat
168 lines (149 loc) · 7.68 KB
/
main.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
@echo off
cls
:START
cls
title gashIP - by elk
chcp 65001 >nul
:: Print the working directory
echo Current directory: %cd%
echo.
:: Enable delayed variable expansion
setlocal EnableDelayedExpansion
:INPUT
:: Prompt for the file containing IP addresses with more detailed instruction
cls
call :banner
echo.
echo ┌──────────────────────────┐
echo ┌─────────────────────────────────────────┘ Hello, welcome to [32mgashIP[0m.└───────────────────────────────────┐
echo │ Enter the name of the TXT file with the desired IPs with its extension in the directory. │
echo │ If said TXT is not in this directory, make sure to drag the .txt file in to [32mgashIP[0m. │
echo └───────────────────────────┐If assistance is needed, type in the command, "HELP"┌───────────────────────┘
echo └────────────────────────────────────────────────────┘
echo.
echo.
set /p ipFile= "Enter the name of the text file >> "
:: Handle HELP command
if /i "%ipFile%"=="HELP" (
cls
echo.
echo ┌───────────────────────────────────────────────────────────────────────────────────────┐
echo │ HELP - How to use [32mgashIP[0m: │
echo │ │
echo │1 - Type the name of the TXT file with the IPs. │
echo │2 - [32mgashIP[0m will gather the geolocation information for each IP entered. │
echo │3 - The information of the IPs when finished will be located in the following folders: │
echo │ - Raw JSON responses: output\json_results │
echo │ - Extracted geolocation information: output\geolocation_results │
echo │───────────────────────────────────────────────────────────────────────────────────────│
echo │ COMMANDS: │
echo │ │
echo │1 - Write the command "LOG" to see information on your previously scanned IPs. │
echo │2 - Type the command "HELP" to have a guide on how to use [32mgashIP[0m. │
echo │3 - Type the command "MEDIA" to see my social media profiles. │
echo │4 - Type the command "EXIT" to leave [32mgashIP[0m. │
echo └───────────────────────────────────────────────────────────────────────────────────────┘
pause
goto INPUT
)
:: Handle LOG command
if /i "%ipFile%"=="LOG" (
cls
echo Scanned IP Logs:
echo ______________________________
if not exist "output\geolocation_results" (
echo No logs found. Please scan some IPs first.
) else (
for /r "output\geolocation_results" %%f in (*_geo.txt) do (
echo Contents of %%~nxf:
type "%%f"
echo ______________________________
)
)
pause
goto INPUT
)
:: Handle EXIT command
if /i "%ipFile%"=="exit" (
echo Closing gashIP, Goodbye!
exit /b
)
:: Handle MEDIA command
if /i "%ipFile%"=="MEDIA" (
cls
echo.
echo.
echo ┌───────────────────────────────────────┐
echo │ Social-Media Profiles: │
echo │ │
echo │ Biolink: Guns.lol/_ │
echo │ Discord: @2elk │
echo │ GitHub: @3elk │
echo │ Roblox: @Onal │
echo │ rest of my stuff is in my guns.lol │
echo │ join /xzc and /diddy │
echo └───────────────────────────────────────┘
pause
goto INPUT
)
:: Check if the file exists
if not exist "%ipFile%" (
echo The file "%ipFile%" does not exist. Please provide a valid file. (WITH ITS EXTENSION)
echo.
pause
goto INPUT
)
:: Create output folder if it doesn't exist
if not exist "output\json_results" mkdir "output\json_results"
if not exist "output\geolocation_results" mkdir "output\geolocation_results"
:: Process each IP in the file
for /f "tokens=*" %%i in (%ipFile%) do (
set ip=%%i
echo Processing IP: !ip!
:: Fetch raw JSON response from ipinfo.io and save it directly to a file
curl -s "https://ipinfo.io/!ip!/json" -o "output\json_results\!ip!.json"
:: Check if the JSON file was created successfully
if not exist "output\json_results\!ip!.json" (
echo Failed to fetch data for the IP: !ip!
echo --------------------------
continue
)
:: Start writing the geolocation information
echo Geolocation Information for IP !ip! > "output\geolocation_results\!ip!_geo.txt"
echo -------------------------- >> "output\geolocation_results\!ip!_geo.txt"
:: Extract city if it exists
for /f "tokens=1,* delims=:" %%a in ('findstr /i "city" "output\json_results\!ip!.json"') do (
set city=%%b
echo City: !city! >> "output\geolocation_results\!ip!_geo.txt"
)
:: Extract other fields (region, country, etc.) similarly
for %%f in (region country loc org postal timezone) do (
for /f "tokens=1,* delims=:" %%a in ('findstr /i "%%f" "output\json_results\!ip!.json"') do (
set fieldValue=%%b
if "!fieldValue!"=="" (
echo %%f: Field not found >> "output\geolocation_results\!ip!_geo.txt"
) else (
echo %%f: !fieldValue! >> "output\geolocation_results\!ip!_geo.txt"
)
)
)
echo -------------------------- >> "output\geolocation_results\!ip!_geo.txt"
)
echo Processing complete. Thank you for using gashIP. The information is saved in the following folders:
echo - Raw JSON responses: output\json_results
echo - Extracted geolocation information: output\geolocation_results
pause
goto START
pause
:banner
echo.
echo.
echo [32m __ ________ [0m
echo [32m ____ _____ ______/ /_ / _/ __ \[0m
echo [32m / __ `/ __ `/ ___/ __ \ / // /_/ /[0m
echo [32m / /_/ / /_/ (__ ) / / // // ____/ [0m
echo [32m \__, /\__,_/____/_/ /_/___/_/ (_)[0m
echo [32m /____/ [0m
echo [32m b y e l k [0m
echo.
echo.