-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshadowmap.py
More file actions
321 lines (274 loc) Β· 15.4 KB
/
shadowmap.py
File metadata and controls
321 lines (274 loc) Β· 15.4 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
#!/usr/bin/env python3
import requests
import json
import os
import sys
import time
import shutil
from datetime import datetime
from colorama import init, Fore, Style, Back
# Initialize colorama for colored output
init(autoreset=True)
# Color constants
class Colors:
GREEN = Fore.GREEN
RED = Fore.RED
YELLOW = Fore.YELLOW
BLUE = Fore.BLUE
CYAN = Fore.CYAN
WHITE = Fore.WHITE
MAGENTA = Fore.MAGENTA
RESET = Style.RESET_ALL
class ShadowMap:
def __init__(self):
self.ip = None
self.data = {}
self.results_dir = "results"
self.author = "EvilmaxSec"
self.terminal_width = self.get_terminal_width()
if not os.path.exists(self.results_dir):
os.makedirs(self.results_dir)
def get_terminal_width(self):
"""Get terminal width for responsive display"""
try:
width = shutil.get_terminal_size().columns
return min(width, 80)
except:
return 60
def clear_screen(self):
"""Clear terminal screen"""
os.system('clear' if os.name == 'posix' else 'cls')
def print_banner(self):
"""Display matrix-style banner without borders"""
banner = f"""
{Colors.GREEN} βββββββββββ βββ ββββββ βββββββ βββββββ βββ βββββββ ββββ ββββββ βββββββ
βββββββββββ βββββββββββββββββββββββββββββββ ββββββββ βββββββββββββββββββββ
βββββββββββββββββββββββββββ ββββββ ββββββ ββ ββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββ ββββββ βββββββββββββββββββββββββββββββββββββββ
βββββββββββ ββββββ βββββββββββββββββββββββββββββββββ βββ ββββββ ββββββ
βββββββββββ ββββββ ββββββββββ βββββββ ββββββββ βββ ββββββ ββββββ
{Colors.RESET}
{Colors.RED}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ{Colors.RESET}
{Colors.YELLOW} ADVANCED IP GEOLOCATION INTELLIGENCE | SECURITY RESEARCH{Colors.RESET}
{Colors.CYAN}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ{Colors.RESET}
{Colors.WHITE} π Author: {Colors.GREEN}EvilmaxSec{Colors.WHITE} | Cyber Ninja{Colors.WHITE}
{Colors.WHITE} π GitHub: {Colors.BLUE}https://github.com/EvilmaxSec/ShadowMap{Colors.WHITE}
{Colors.WHITE} β οΈ DISCLAIMER: {Colors.RED}For Educational & Authorized Testing Only{Colors.WHITE}
{Colors.CYAN}βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ{Colors.RESET}
"""
print(banner)
def get_ip(self):
"""Get IP address from user"""
while True:
print(f"\n{Colors.GREEN}[{Colors.RED}βΆ{Colors.GREEN}] {Colors.YELLOW}Enter target IP:{Colors.RESET} ", end="")
self.ip = input().strip()
parts = self.ip.split('.')
if len(parts) == 4 and all(part.isdigit() and 0 <= int(part) <= 255 for part in parts):
return True
else:
print(f"\n{Colors.RED}[!] Invalid IP format. Example: 8.8.8.8{Colors.RESET}")
time.sleep(1)
def fetch_location(self):
"""Fetch geolocation data from multiple APIs for accuracy"""
print(f"\n{Colors.YELLOW}[*] Tracking IP: {self.ip}{Colors.RESET}")
print(f"{Colors.YELLOW}[*] Querying intelligence databases...{Colors.RESET}")
apis = [
f'http://ip-api.com/json/{self.ip}?fields=status,country,countryCode,region,regionName,city,lat,lon,zip,timezone,isp,org,as,mobile,proxy,hosting',
f'https://ipapi.co/{self.ip}/json/',
f'http://ipwho.is/{self.ip}'
]
for api_url in apis:
try:
response = requests.get(api_url, timeout=10)
data = response.json()
if 'status' in data and data.get('status') == 'success':
self.data = {
'ip': self.ip,
'country': data.get('country', 'N/A'),
'country_code': data.get('countryCode', 'N/A'),
'region': data.get('regionName', 'N/A'),
'city': data.get('city', 'N/A'),
'latitude': data.get('lat', 'N/A'),
'longitude': data.get('lon', 'N/A'),
'postal': data.get('zip', 'N/A'),
'timezone': data.get('timezone', 'N/A'),
'isp': data.get('isp', 'N/A'),
'org': data.get('org', 'N/A'),
'asn': data.get('as', 'N/A'),
'mobile': data.get('mobile', False),
'proxy': data.get('proxy', False),
'hosting': data.get('hosting', False)
}
print(f"{Colors.GREEN}[β] Location acquired successfully!{Colors.RESET}")
return True
elif 'country' in data and data.get('country_name'):
self.data = {
'ip': self.ip,
'country': data.get('country_name', 'N/A'),
'country_code': data.get('country_code', 'N/A'),
'region': data.get('region', 'N/A'),
'city': data.get('city', 'N/A'),
'latitude': data.get('latitude', 'N/A'),
'longitude': data.get('longitude', 'N/A'),
'postal': data.get('postal', 'N/A'),
'timezone': data.get('timezone', 'N/A'),
'isp': data.get('org', 'N/A'),
'org': data.get('org', 'N/A'),
'asn': data.get('asn', 'N/A'),
'mobile': data.get('mobile', False),
'proxy': data.get('proxy', False),
'hosting': data.get('hosting', False)
}
print(f"{Colors.GREEN}[β] Location acquired successfully!{Colors.RESET}")
return True
elif 'success' in data and data.get('success'):
self.data = {
'ip': self.ip,
'country': data.get('country', 'N/A'),
'country_code': data.get('country_code', 'N/A'),
'region': data.get('region', 'N/A'),
'city': data.get('city', 'N/A'),
'latitude': data.get('latitude', 'N/A'),
'longitude': data.get('longitude', 'N/A'),
'postal': data.get('postal', 'N/A'),
'timezone': data.get('timezone', {}).get('id', 'N/A'),
'isp': data.get('connection', {}).get('isp', 'N/A'),
'org': data.get('connection', {}).get('org', 'N/A'),
'asn': data.get('connection', {}).get('asn', 'N/A'),
'mobile': False,
'proxy': data.get('security', {}).get('proxy', False),
'hosting': data.get('connection', {}).get('type') == 'hosting'
}
print(f"{Colors.GREEN}[β] Location acquired successfully!{Colors.RESET}")
return True
except requests.exceptions.RequestException:
continue
except Exception:
continue
print(f"{Colors.RED}[β] Failed to fetch location data{Colors.RESET}")
return False
def generate_google_maps_url(self):
"""Generate Google Maps URL for coordinates"""
lat = self.data.get('latitude')
lon = self.data.get('longitude')
if lat != 'N/A' and lon != 'N/A':
return f"https://www.google.com/maps?q={lat},{lon}"
return None
def print_output(self):
"""Display formatted results without borders for small terminals"""
print(f"\n{Colors.CYAN}βββββββββββ IP GEOLOCATION REPORT βββββββββββ{Colors.RESET}")
print(f"\n{Colors.GREEN}[+] TARGET IP: {Colors.WHITE}{self.data.get('ip', 'N/A')}{Colors.RESET}")
print(f"\n{Colors.YELLOW}π LOCATION INFORMATION{Colors.RESET}")
print(f" Country : {self.data.get('country', 'N/A')} ({self.data.get('country_code', 'N/A')})")
print(f" Region : {self.data.get('region', 'N/A')}")
print(f" City : {self.data.get('city', 'N/A')}")
print(f" Coord : {self.data.get('latitude', 'N/A')}, {self.data.get('longitude', 'N/A')}")
print(f" Postal : {self.data.get('postal', 'N/A')}")
print(f" Timezone : {self.data.get('timezone', 'N/A')}")
print(f"\n{Colors.BLUE}π NETWORK INFORMATION{Colors.RESET}")
print(f" ISP : {self.data.get('isp', 'N/A')}")
print(f" Org : {self.data.get('org', 'N/A')}")
print(f" ASN : {self.data.get('asn', 'N/A')}")
# Additional flags
flags = []
if self.data.get('mobile'):
flags.append("π± Mobile")
if self.data.get('proxy'):
flags.append("π΅οΈ Proxy")
if self.data.get('hosting'):
flags.append("βοΈ Hosting")
if flags:
print(f"\n{Colors.MAGENTA}β‘ ADDITIONAL INFO{Colors.RESET}")
print(f" {', '.join(flags)}")
# Google Maps Link
maps_url = self.generate_google_maps_url()
if maps_url:
print(f"\n{Colors.GREEN}πΊοΈ GOOGLE MAPS{Colors.RESET}")
print(f" {maps_url}")
print(f" {Colors.YELLOW}[Copy URL to view exact location]{Colors.RESET}")
print(f"\n{Colors.CYAN}βββββββββββββββββββββββββββββββββββββββββββ{Colors.RESET}")
def save_output(self):
"""Save results to text file"""
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"{self.results_dir}/{self.ip}_{timestamp}.txt"
try:
with open(filename, 'w', encoding='utf-8') as f:
f.write("β" * 50 + "\n")
f.write("SHADOWMAP - IP GEOLOCATION REPORT\n")
f.write(f"Author: EvilmaxSec | GitHub: https://github.com/EvilmaxSec\n")
f.write("β" * 50 + "\n\n")
f.write(f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
f.write(f"Target IP: {self.data.get('ip', 'N/A')}\n\n")
f.write("π LOCATION INFORMATION\n")
f.write("-" * 30 + "\n")
f.write(f"Country: {self.data.get('country', 'N/A')} ({self.data.get('country_code', 'N/A')})\n")
f.write(f"Region: {self.data.get('region', 'N/A')}\n")
f.write(f"City: {self.data.get('city', 'N/A')}\n")
f.write(f"Coordinates: {self.data.get('latitude', 'N/A')}, {self.data.get('longitude', 'N/A')}\n")
f.write(f"Postal Code: {self.data.get('postal', 'N/A')}\n")
f.write(f"Timezone: {self.data.get('timezone', 'N/A')}\n\n")
f.write("π NETWORK INFORMATION\n")
f.write("-" * 30 + "\n")
f.write(f"ISP: {self.data.get('isp', 'N/A')}\n")
f.write(f"Organization: {self.data.get('org', 'N/A')}\n")
f.write(f"ASN: {self.data.get('asn', 'N/A')}\n\n")
# Google Maps Link
maps_url = self.generate_google_maps_url()
if maps_url:
f.write("πΊοΈ GOOGLE MAPS LOCATION\n")
f.write("-" * 30 + "\n")
f.write(f"URL: {maps_url}\n\n")
f.write("β" * 50 + "\n")
f.write("DISCLAIMER: For educational & authorized testing only\n")
f.write("Report generated by ShadowMap - EvilmaxSec\n")
print(f"\n{Colors.GREEN}[β] Saved: {filename}{Colors.RESET}")
return filename
except Exception as e:
print(f"\n{Colors.RED}[β] Save failed: {e}{Colors.RESET}")
return None
def ask_continue(self):
"""Ask user if they want to track another IP"""
while True:
print(f"\n{Colors.GREEN}[?] Track another IP? (y/n): {Colors.RESET}", end="")
choice = input().strip().lower()
if choice in ['y', 'yes']:
return True
elif choice in ['n', 'no']:
return False
else:
print(f"{Colors.RED}[!] Enter 'y' or 'n'{Colors.RESET}")
def run(self):
"""Main execution loop"""
while True:
self.clear_screen()
self.print_banner()
# Get IP from user
self.get_ip()
# Fetch location data
if self.fetch_location():
# Print to console
self.print_output()
# Save to file
self.save_output()
if not self.ask_continue():
print(f"\n{Colors.GREEN}[+] Thanks for using ShadowMap!{Colors.RESET}")
print(f"{Colors.CYAN}[+] Stay stealthy - EvilmaxSec | Cyber Ninja{Colors.RESET}\n")
time.sleep(1)
break
else:
print(f"\n{Colors.YELLOW}[!] Press Enter to retry...{Colors.RESET}", end="")
input()
def main():
"""Entry point"""
try:
tool = ShadowMap()
tool.run()
except KeyboardInterrupt:
print(f"\n\n{Colors.YELLOW}[!] Interrupted{Colors.RESET}")
print(f"{Colors.CYAN}[+] Stay stealthy - EvilmaxSec | Cyber Ninja{Colors.RESET}\n")
sys.exit(0)
except Exception as e:
print(f"\n{Colors.RED}[!] Error: {e}{Colors.RESET}\n")
sys.exit(1)
if __name__ == "__main__":
main()