-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshadow.py
More file actions
127 lines (103 loc) · 3.74 KB
/
Copy pathshadow.py
File metadata and controls
127 lines (103 loc) · 3.74 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
#!/usr/bin/env python3
import os
import sys
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
from datetime import datetime
def convert_to_degrees(value):
try:
if not value or len(value) != 3:
return None
d = float(value[0])
m = float(value[1])
s = float(value[2])
return d + (m / 60.0) + (s / 3600.0)
except (TypeError, ValueError, IndexError):
return None
def sanitize_display_value(value, max_length=30):
sanitized = []
visible_length = 0
for char in str(value).strip():
part = char if char.isprintable() else f"\\x{ord(char):02x}"
if visible_length + len(part) > max_length:
break
sanitized.append(part)
visible_length += len(part)
return "".join(sanitized)
def get_gps_info(exif_data):
gps_info = {}
if not exif_data: return None
# GPSInfo etiketini bul (Genelde 34853 numaralı etiket)
gps_raw = None
for tag, value in exif_data.items():
decoded = TAGS.get(tag, tag)
if decoded == "GPSInfo":
gps_raw = value
break
if not gps_raw: return None
for t in gps_raw:
sub_tag = GPSTAGS.get(t, t)
gps_info[sub_tag] = gps_raw[t]
try:
lat = convert_to_degrees(gps_info['GPSLatitude'])
lon = convert_to_degrees(gps_info['GPSLongitude'])
if lat is None or lon is None:
return None
lat_ref = gps_info.get('GPSLatitudeRef', 'N')
lon_ref = gps_info.get('GPSLongitudeRef', 'E')
if lat_ref not in ('N', 'S') or lon_ref not in ('E', 'W'):
return None
if lat_ref == 'S': lat = -lat
if lon_ref == 'W': lon = -lon
return {
"Coords": f"{lat:.6f}, {lon:.6f}",
"Link": f"https://www.google.com/maps?q={lat},{lon}"
}
except KeyError: return None
def print_banner():
banner = r"""
@@@@@@ @@@ @@@ @@@@@@ @@@@@@@ @@@@@@ @@@ @@@ @@@
@@! @@! @@@ @@! @@@ @@! @@@ @@! @@@ @@! @@! @@!
!@! @!@!@!@! @!@!@!@! @!@ !@! @!@ !@! @!! !!@ @!@
!!: !!: !!! !!: !!! !!: !!! !!: !!! !: !!: !!:
:: :: : ::: : : : :: : : : : :: :: : :: :
[>] Shadow Engine V3.1 | [>] Author: Naz
----------------------------------------------------------
"""
print(banner)
def analyze_image(image_path):
if not os.path.exists(image_path):
print(f"[!] File not found: {image_path}")
return
try:
with Image.open(image_path) as img:
exif_data = img._getexif()
print_banner()
print(f"[*] TARGET: {os.path.basename(image_path)}")
print("=" * 66)
if exif_data:
# Önce GPS'i kontrol et
gps_data = get_gps_info(exif_data)
if gps_data:
print(f"[+++] GEOLOCATION FOUND!")
print(f"[>] Coordinates : {gps_data['Coords']}")
print(f"[>] Google Maps : {gps_data['Link']}")
print("-" * 66)
# Diğer verileri listele
for tag, value in exif_data.items():
tag_name = TAGS.get(tag, tag)
if tag_name != 'GPSInfo' and tag_name != 'MakerNote':
val = sanitize_display_value(value)
print(f"| {tag_name:<28} | {val:<31} |")
else:
print("[-] No metadata found.")
except Exception as e:
print(f"[x] Error: {e}")
print("=" * 66)
print("[*] Scan Finished.\n")
if __name__ == "__main__":
if len(sys.argv) < 2:
print_banner()
print("Usage: shadow <file>")
else:
analyze_image(sys.argv[1])