ShadowB 0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ShadowB/Core/fileorg.py +38 -0
- ShadowB/Core/randwords.py +76 -0
- ShadowB/GetD/make_cookies.py +27 -0
- ShadowB/GetD/my_data.py +86 -0
- ShadowB/GetD/my_ip.py +12 -0
- ShadowB/GetD/scan.py +72 -0
- ShadowB/Image/check_image.py +39 -0
- ShadowB/Image/export_metadata.py +96 -0
- ShadowB/Image/extr_hidden_files.py +44 -0
- ShadowB/Image/extr_hidden_text.py +39 -0
- ShadowB/Image/makeFile.py +48 -0
- ShadowB/Image/makeText.py +41 -0
- ShadowB/Image/remove_metadata.py +48 -0
- ShadowB/Mail/make_mail.py +36 -0
- ShadowB/Mail/res_msj.py +44 -0
- ShadowB/Mail/send_msj.py +13 -0
- ShadowB/Qrcode/generate.py +35 -0
- ShadowB/Qrcode/scan.py +26 -0
- ShadowB/Safe/clean.py +127 -0
- ShadowB/Safe/cleanText.py +37 -0
- ShadowB/Safe/ext.py +5 -0
- ShadowB/Safe/filename.py +6 -0
- ShadowB/Safe/safeFile.py +171 -0
- ShadowB/__init__.py +44 -0
- ShadowB/captcha.py +73 -0
- ShadowB/core.py +106 -0
- ShadowB/getD.py +28 -0
- ShadowB/image.py +31 -0
- ShadowB/mail.py +21 -0
- ShadowB/passwords.py +47 -0
- ShadowB/qrcode.py +10 -0
- ShadowB/safe.py +80 -0
- ShadowB/search.py +50 -0
- shadowb-0.1.dist-info/LICENSE +21 -0
- shadowb-0.1.dist-info/METADATA +200 -0
- shadowb-0.1.dist-info/RECORD +38 -0
- shadowb-0.1.dist-info/WHEEL +5 -0
- shadowb-0.1.dist-info/top_level.txt +1 -0
ShadowB/Core/fileorg.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
|
|
4
|
+
def florg(folder=None):
|
|
5
|
+
if folder is None:
|
|
6
|
+
return "The folder path is required!"
|
|
7
|
+
types = {
|
|
8
|
+
".jpg": "Images", ".png": "Images", ".jpeg": "Images",
|
|
9
|
+
".zip": "Archives", ".rar": "Archives",
|
|
10
|
+
".pdf": "Documents", ".docx": "Documents", ".txt": "Documents",
|
|
11
|
+
".mp3": "Music", ".wav": "Music",
|
|
12
|
+
".py": "Code", ".js": "Code", ".html": "Code",
|
|
13
|
+
".exe": "Code", ".cpp": "Code", ".css": "Code"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
skip_folders = set(types.values())
|
|
18
|
+
|
|
19
|
+
for root, dirs, files in os.walk(folder):
|
|
20
|
+
|
|
21
|
+
dirs[:] = [d for d in dirs if d not in skip_folders]
|
|
22
|
+
|
|
23
|
+
moved = 0
|
|
24
|
+
for file in files:
|
|
25
|
+
path = os.path.join(root, file)
|
|
26
|
+
ext = os.path.splitext(file)[1].lower()
|
|
27
|
+
if ext in types:
|
|
28
|
+
target_folder = os.path.join(root, types[ext])
|
|
29
|
+
os.makedirs(target_folder, exist_ok=True)
|
|
30
|
+
shutil.move(path, os.path.join(target_folder, file))
|
|
31
|
+
print(f"{file} → {root}/{types[ext]}/")
|
|
32
|
+
moved += 1
|
|
33
|
+
else:
|
|
34
|
+
print(f"Unknown extension: {file}")
|
|
35
|
+
|
|
36
|
+
if moved > 0:
|
|
37
|
+
print(f"\n Your files have been organized successfully: {root}\n")
|
|
38
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import string
|
|
2
|
+
from random import choice
|
|
3
|
+
import itertools as ito
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def randw(filename,rep,others_chars,numbers,symbols,letters,form):
|
|
8
|
+
if numbers and symbols and letters:
|
|
9
|
+
if form == "maj":
|
|
10
|
+
final_combo = string.ascii_uppercase + string.digits + string.punctuation + others_chars
|
|
11
|
+
elif form == "min":
|
|
12
|
+
final_combo = string.ascii_lowercase + string.digits + string.punctuation + others_chars
|
|
13
|
+
else:
|
|
14
|
+
final_combo = string.ascii_letters + string.digits + string.punctuation + others_chars
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# numbers
|
|
18
|
+
elif numbers and symbols and not letters:
|
|
19
|
+
final_combo = string.digits + string.punctuation + others_chars
|
|
20
|
+
|
|
21
|
+
elif numbers and not symbols and letters:
|
|
22
|
+
if form == "maj":
|
|
23
|
+
final_combo = string.ascii_uppercase + string.digits + others_chars
|
|
24
|
+
elif form == "min":
|
|
25
|
+
final_combo = string.ascii_lowercase + string.digits + others_chars
|
|
26
|
+
else:
|
|
27
|
+
final_combo = string.ascii_letters + string.digits + others_chars
|
|
28
|
+
|
|
29
|
+
elif numbers and not symbols and not letters:
|
|
30
|
+
final_combo = string.digits
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# letters
|
|
34
|
+
elif letters and symbols and not numbers:
|
|
35
|
+
if form == "maj":
|
|
36
|
+
final_combo = string.ascii_uppercase + string.punctuation + others_chars
|
|
37
|
+
elif form == "min":
|
|
38
|
+
final_combo = string.ascii_lowercase + string.punctuation + others_chars
|
|
39
|
+
else:
|
|
40
|
+
final_combo = string.ascii_letters + string.punctuation + others_chars
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
elif letters and not symbols and not numbers:
|
|
44
|
+
if form == "maj":
|
|
45
|
+
final_combo = string.ascii_uppercase
|
|
46
|
+
elif form == "min":
|
|
47
|
+
final_combo = string.ascii_lowercase
|
|
48
|
+
else:
|
|
49
|
+
final_combo = string.ascii_letters
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
#symbols
|
|
53
|
+
elif symbols and not letters and not numbers:
|
|
54
|
+
if form == "maj":
|
|
55
|
+
final_combo = string.punctuation + others_chars
|
|
56
|
+
elif form == "min":
|
|
57
|
+
final_combo = string.punctuation + others_chars
|
|
58
|
+
else:
|
|
59
|
+
final_combo = string.punctuation + others_chars
|
|
60
|
+
|
|
61
|
+
else:
|
|
62
|
+
final_combo = string.ascii_letters + string.digits + string.punctuation + others_chars
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
final_combo = string.ascii_letters + string.digits + someCaracters + others_chars
|
|
66
|
+
if rep > 5:
|
|
67
|
+
print("The maximum number of slots you can reach is 5")
|
|
68
|
+
if rep < 2:
|
|
69
|
+
print("The smallest number of digits possible is 2")
|
|
70
|
+
desktop = Path.home() / "Desktop"
|
|
71
|
+
words = [''.join(combo) for combo in ito.product(final_combo, repeat=rep)]
|
|
72
|
+
with open(desktop / f"{filename}.txt","w") as w:
|
|
73
|
+
for wr in words:
|
|
74
|
+
w.write(wr + "\n")
|
|
75
|
+
print(f"Alright, it has been saved in : {desktop / (filename + '.txt')}")
|
|
76
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
try:
|
|
3
|
+
import browser_cookie3
|
|
4
|
+
except ImportError:
|
|
5
|
+
import os
|
|
6
|
+
os.system("pip install browser_cookie3")
|
|
7
|
+
import browser_cookie3
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def cookies(filename):
|
|
11
|
+
cookies = browser_cookie3.chrome()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
with open(f"{filename}.txt", "w", encoding="utf-8") as f:
|
|
15
|
+
f.write("# Netscape HTTP Cookie File\n")
|
|
16
|
+
f.write("# This is a generated file! Do not edit.\n\n")
|
|
17
|
+
|
|
18
|
+
for cookie in cookies:
|
|
19
|
+
|
|
20
|
+
is_secure = "TRUE" if cookie.secure else "FALSE"
|
|
21
|
+
expiration = str(int(cookie.expires)) if cookie.expires else "0"
|
|
22
|
+
|
|
23
|
+
line = f"{cookie.domain}\t{is_secure}\t{cookie.path}\t{is_secure}\t{expiration}\t{cookie.name}\t{cookie.value}\n"
|
|
24
|
+
f.write(line)
|
|
25
|
+
|
|
26
|
+
print(f"Saved at : {filename}.txt and cookies")
|
|
27
|
+
return cookies
|
ShadowB/GetD/my_data.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import platform
|
|
2
|
+
import socket
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import ctypes
|
|
6
|
+
import getpass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def make_file():
|
|
10
|
+
|
|
11
|
+
data = []
|
|
12
|
+
|
|
13
|
+
data.append("=== Device Information ===\n")
|
|
14
|
+
|
|
15
|
+
username = getpass.getuser()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
data.append(username)
|
|
21
|
+
|
|
22
|
+
hostname = socket.gethostname()
|
|
23
|
+
data.append(f"Hostname: {hostname}\n")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
28
|
+
s.connect(("8.8.8.8", 80))
|
|
29
|
+
local_ip = s.getsockname()[0]
|
|
30
|
+
s.close()
|
|
31
|
+
except:
|
|
32
|
+
local_ip = "Not available"
|
|
33
|
+
data.append(f"Local IP: {local_ip}\n")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
os_name = platform.system()
|
|
37
|
+
os_release = platform.release()
|
|
38
|
+
arch = platform.architecture()[0]
|
|
39
|
+
data.append(f"Operating System: {os_name} {os_release}\n")
|
|
40
|
+
data.append(f"Architecture: {arch}\n")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class MEMORYSTATUSEX(ctypes.Structure):
|
|
44
|
+
_fields_ = [
|
|
45
|
+
("dwLength", ctypes.c_ulong),
|
|
46
|
+
("dwMemoryLoad", ctypes.c_ulong),
|
|
47
|
+
("ullTotalPhys", ctypes.c_ulonglong),
|
|
48
|
+
("ullAvailPhys", ctypes.c_ulonglong),
|
|
49
|
+
("ullTotalPageFile", ctypes.c_ulonglong),
|
|
50
|
+
("ullAvailPageFile", ctypes.c_ulonglong),
|
|
51
|
+
("ullTotalVirtual", ctypes.c_ulonglong),
|
|
52
|
+
("ullAvailVirtual", ctypes.c_ulonglong),
|
|
53
|
+
("sullAvailExtendedVirtual", ctypes.c_ulonglong),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
def __init__(self):
|
|
57
|
+
super(MEMORYSTATUSEX, self).__init__()
|
|
58
|
+
self.dwLength = ctypes.sizeof(self)
|
|
59
|
+
|
|
60
|
+
kernel32 = ctypes.windll.kernel32
|
|
61
|
+
stat = MEMORYSTATUSEX()
|
|
62
|
+
kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
|
|
63
|
+
|
|
64
|
+
ram_bytes = stat.ullTotalPhys
|
|
65
|
+
ram_mb = ram_bytes // (1024 * 1024)
|
|
66
|
+
ram_gb = round(ram_mb / 1024, 1)
|
|
67
|
+
data.append(f"Total RAM: {ram_gb} GB ({ram_mb} MB)\n")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
total, used, free = shutil.disk_usage('C:\\')
|
|
72
|
+
total_gb = round(total / (1024**3), 1)
|
|
73
|
+
used_gb = round(used / (1024**3), 1)
|
|
74
|
+
free_gb = round(free / (1024**3), 1)
|
|
75
|
+
data.append(f"Disk C: Total {total_gb} GB\n")
|
|
76
|
+
data.append(f"Disk C: Used {used_gb} GB\n")
|
|
77
|
+
data.append(f"Disk C: Free {free_gb} GB\n")
|
|
78
|
+
except Exception as e:
|
|
79
|
+
data.append(f"Disk C: Error reading usage - {str(e)}\n")
|
|
80
|
+
d = [data]
|
|
81
|
+
data.append("\n=== End of Information ===\n")
|
|
82
|
+
|
|
83
|
+
with open("PcData.txt", "w", encoding="utf-8") as f:
|
|
84
|
+
f.writelines(data)
|
|
85
|
+
print("Saved at : PcData.txt")
|
|
86
|
+
return d
|
ShadowB/GetD/my_ip.py
ADDED
ShadowB/GetD/scan.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from colorama import Fore, Style, init
|
|
6
|
+
init(autoreset=True)
|
|
7
|
+
except ImportError:
|
|
8
|
+
print("[-] 'colorama' library is missing. Attempting to install it now...")
|
|
9
|
+
try:
|
|
10
|
+
|
|
11
|
+
os.system(f"{sys.executable} -m pip install colorama")
|
|
12
|
+
from colorama import Fore, Style, init
|
|
13
|
+
init(autoreset=True)
|
|
14
|
+
print("[+] 'colorama' installed successfully!\n")
|
|
15
|
+
except Exception as e:
|
|
16
|
+
print(f"[-] Failed to install the library: {e}. Proceeding without colors.")
|
|
17
|
+
|
|
18
|
+
class Fore: GREEN = ''; RED = ''; RESET = ''
|
|
19
|
+
class Style: BRIGHT = ''
|
|
20
|
+
|
|
21
|
+
import socket
|
|
22
|
+
from datetime import datetime
|
|
23
|
+
|
|
24
|
+
def scan(ip):
|
|
25
|
+
"""
|
|
26
|
+
Scans a target IP address for open TCP ports.
|
|
27
|
+
"""
|
|
28
|
+
print("-" * 50)
|
|
29
|
+
print(f"{Fore.GREEN}Starting scan on target: {ip}")
|
|
30
|
+
print(f"Time started: {str(datetime.now())}")
|
|
31
|
+
print("-" * 50)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
ports_to_scan = range(1, 1025)
|
|
35
|
+
open_ports = []
|
|
36
|
+
|
|
37
|
+
try:
|
|
38
|
+
for port in ports_to_scan:
|
|
39
|
+
|
|
40
|
+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
41
|
+
|
|
42
|
+
s.settimeout(1.0)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
result = s.connect_ex((ip, port))
|
|
46
|
+
|
|
47
|
+
if result == 0:
|
|
48
|
+
print(f"[+] Port {Fore.GREEN}{Style.BRIGHT}{port}{Style.RESET}: OPEN")
|
|
49
|
+
open_ports.append(port)
|
|
50
|
+
|
|
51
|
+
s.close()
|
|
52
|
+
|
|
53
|
+
except KeyboardInterrupt:
|
|
54
|
+
print(f"\n{Fore.RED}Scan stopped by user (Ctrl+C).")
|
|
55
|
+
sys.exit()
|
|
56
|
+
|
|
57
|
+
except socket.gaierror:
|
|
58
|
+
print(f"\n{Fore.RED}[- ] Hostname could not be resolved.")
|
|
59
|
+
sys.exit()
|
|
60
|
+
|
|
61
|
+
except socket.error:
|
|
62
|
+
print(f"\n{Fore.RED}[- ] Could not connect to server.")
|
|
63
|
+
sys.exit()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
print("-" * 50)
|
|
67
|
+
print(f"{Fore.GREEN}Scan Completed!")
|
|
68
|
+
if open_ports:
|
|
69
|
+
print(f"Open ports found: {Fore.GREEN}{open_ports}")
|
|
70
|
+
else:
|
|
71
|
+
print(f"{Fore.RED}No open ports found in the scanned range.")
|
|
72
|
+
print("-" * 50)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
from PIL.ExifTags import TAGS, GPSTAGS
|
|
6
|
+
except:
|
|
7
|
+
import os
|
|
8
|
+
os.system("pip install pillow")
|
|
9
|
+
from PIL import Image
|
|
10
|
+
from PIL.ExifTags import TAGS,GPSTAGS
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
import stepic
|
|
16
|
+
except:
|
|
17
|
+
import os
|
|
18
|
+
os.system("pip install stepic")
|
|
19
|
+
import stepic
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def check(image_path):
|
|
24
|
+
if not image_path or not os.path.exists(image_path):
|
|
25
|
+
return "No image provided or file does not exist"
|
|
26
|
+
|
|
27
|
+
valid_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.webp')
|
|
28
|
+
if not image_path.lower().endswith(valid_extensions):
|
|
29
|
+
return "We only accept images"
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
img = Image.open(image_path)
|
|
33
|
+
decoded_data = stepic.decode(img)
|
|
34
|
+
|
|
35
|
+
if decoded_data:
|
|
36
|
+
return "true"
|
|
37
|
+
return "false"
|
|
38
|
+
except:
|
|
39
|
+
return "false"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
from PIL.ExifTags import TAGS, GPSTAGS
|
|
6
|
+
except:
|
|
7
|
+
os.system("pip install pillow")
|
|
8
|
+
from PIL import Image
|
|
9
|
+
from PIL.ExifTags import TAGS,GPSTAGS
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
import stepic
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install stepic")
|
|
16
|
+
import stepic
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _convert_to_degrees(value):
|
|
21
|
+
try:
|
|
22
|
+
degrees = float(value[0])
|
|
23
|
+
minutes = float(value[1])
|
|
24
|
+
seconds = float(value[2])
|
|
25
|
+
return degrees + (minutes / 60.0) + (seconds / 3600.0)
|
|
26
|
+
except Exception:
|
|
27
|
+
return None
|
|
28
|
+
|
|
29
|
+
def exp(file_path):
|
|
30
|
+
|
|
31
|
+
if not os.path.exists(file_path):
|
|
32
|
+
return "File does not exist"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
with Image.open(file_path) as img:
|
|
37
|
+
|
|
38
|
+
metadata = {
|
|
39
|
+
"Filename": os.path.basename(file_path),
|
|
40
|
+
"Format": img.format,
|
|
41
|
+
"Dimensions": f"{img.width}x{img.height} pixels",
|
|
42
|
+
"Mode": img.mode,
|
|
43
|
+
"Capture_Date": "Unknown",
|
|
44
|
+
"Camera_Make": "Unknown",
|
|
45
|
+
"Camera_Model": "Unknown",
|
|
46
|
+
"Software": "Unknown",
|
|
47
|
+
"Location_GPS": "Unknown"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
exif_data = img._getexif()
|
|
52
|
+
|
|
53
|
+
if exif_data is not None:
|
|
54
|
+
gps_info = {}
|
|
55
|
+
|
|
56
|
+
for tag_id, value in exif_data.items():
|
|
57
|
+
tag_name = TAGS.get(tag_id, tag_id)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if tag_name == "DateTimeOriginal" or tag_name == "DateTime":
|
|
61
|
+
metadata["Capture_Date"] = str(value)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
elif tag_name == "Make":
|
|
65
|
+
metadata["Camera_Make"] = str(value).strip()
|
|
66
|
+
elif tag_name == "Model":
|
|
67
|
+
metadata["Camera_Model"] = str(value).strip()
|
|
68
|
+
elif tag_name == "Software":
|
|
69
|
+
metadata["Software"] = str(value).strip()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
elif tag_name == "GPSInfo":
|
|
73
|
+
for key in value:
|
|
74
|
+
sub_tag = GPSTAGS.get(key, key)
|
|
75
|
+
gps_info[sub_tag] = value[key]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if gps_info and "GPSLatitude" in gps_info and "GPSLongitude" in gps_info:
|
|
79
|
+
lat = _convert_to_degrees(gps_info["GPSLatitude"])
|
|
80
|
+
lon = _convert_to_degrees(gps_info["GPSLongitude"])
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if lat and gps_info.get("GPSLatitudeRef") == "S":
|
|
84
|
+
lat = -lat
|
|
85
|
+
if lon and gps_info.get("GPSLongitudeRef") == "W":
|
|
86
|
+
lon = -lon
|
|
87
|
+
|
|
88
|
+
if lat and lon:
|
|
89
|
+
|
|
90
|
+
metadata["Location_GPS"] = f"{lat:.6f}, {lon:.6f}"
|
|
91
|
+
|
|
92
|
+
return metadata
|
|
93
|
+
|
|
94
|
+
except (IOError, SyntaxError, Image.UnidentifiedImageError):
|
|
95
|
+
return "This is not an image"
|
|
96
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
from PIL.ExifTags import TAGS, GPSTAGS
|
|
6
|
+
except:
|
|
7
|
+
os.system("pip install pillow")
|
|
8
|
+
from PIL import Image
|
|
9
|
+
from PIL.ExifTags import TAGS,GPSTAGS
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
import stepic
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install stepic")
|
|
16
|
+
import stepic
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def extract_file_from_img(image_path, output_directory="."):
|
|
20
|
+
try:
|
|
21
|
+
img = Image.open(image_path)
|
|
22
|
+
decoded_data = stepic.decode(img)
|
|
23
|
+
|
|
24
|
+
if not decoded_data:
|
|
25
|
+
return "No hidden data found in this image"
|
|
26
|
+
|
|
27
|
+
if isinstance(decoded_data, str):
|
|
28
|
+
decoded_data = decoded_data.encode('utf-8')
|
|
29
|
+
|
|
30
|
+
header_parts = decoded_data.split(b':', 2)
|
|
31
|
+
if len(header_parts) < 3:
|
|
32
|
+
return "Hidden data does not match the expected file format"
|
|
33
|
+
|
|
34
|
+
file_name = header_parts[0].decode('utf-8')
|
|
35
|
+
file_size = int(header_parts[1].decode('utf-8'))
|
|
36
|
+
file_data = header_parts[2][:file_size]
|
|
37
|
+
|
|
38
|
+
out_file_path = os.path.join(output_directory, file_name)
|
|
39
|
+
with open(out_file_path, 'wb') as f:
|
|
40
|
+
f.write(file_data)
|
|
41
|
+
|
|
42
|
+
return f"File extracted successfully and saved as: {out_file_path}"
|
|
43
|
+
except Exception as e:
|
|
44
|
+
return f"An error occurred during extraction: {str(e)}"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
from PIL.ExifTags import TAGS, GPSTAGS
|
|
6
|
+
except:
|
|
7
|
+
os.system("pip install pillow")
|
|
8
|
+
from PIL import Image
|
|
9
|
+
from PIL.ExifTags import TAGS,GPSTAGS
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
import stepic
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install stepic")
|
|
16
|
+
import stepic
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def extract_text_from_img(image_path):
|
|
20
|
+
if not image_path or not os.path.exists(image_path):
|
|
21
|
+
return "No image provided or file does not exist"
|
|
22
|
+
|
|
23
|
+
valid_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.webp')
|
|
24
|
+
if not image_path.lower().endswith(valid_extensions):
|
|
25
|
+
return "We only accept images"
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
img = Image.open(image_path)
|
|
29
|
+
decoded_data = stepic.decode(img)
|
|
30
|
+
|
|
31
|
+
if not decoded_data:
|
|
32
|
+
return "No hidden text found in this image"
|
|
33
|
+
|
|
34
|
+
if isinstance(decoded_data, bytes):
|
|
35
|
+
return decoded_data.decode('utf-8')
|
|
36
|
+
|
|
37
|
+
return decoded_data
|
|
38
|
+
except Exception as e:
|
|
39
|
+
return f"An error occurred: {str(e)}"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
except:
|
|
6
|
+
os.system("pip install pillow")
|
|
7
|
+
from PIL import Image
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import stepic
|
|
11
|
+
except:
|
|
12
|
+
os.system("pip install stepic")
|
|
13
|
+
import stepic
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def hide_file_in_img(image_path, file_to_hide_path):
|
|
17
|
+
if not image_path or not os.path.exists(image_path):
|
|
18
|
+
return "No image provided or file does not exist"
|
|
19
|
+
|
|
20
|
+
if not file_to_hide_path or not os.path.exists(file_to_hide_path):
|
|
21
|
+
return "File to hide does not exist"
|
|
22
|
+
|
|
23
|
+
valid_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.webp')
|
|
24
|
+
if not image_path.lower().endswith(valid_extensions):
|
|
25
|
+
return "We only accept images"
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
img = Image.open(image_path)
|
|
29
|
+
if img.mode != 'RGBA':
|
|
30
|
+
img = img.convert('RGBA')
|
|
31
|
+
|
|
32
|
+
file_name = os.path.basename(file_to_hide_path)
|
|
33
|
+
with open(file_to_hide_path, 'rb') as f:
|
|
34
|
+
file_data = f.read()
|
|
35
|
+
|
|
36
|
+
header = f"{file_name}:{len(file_data)}:".encode('utf-8')
|
|
37
|
+
payload = header + file_data
|
|
38
|
+
|
|
39
|
+
encoded_img = stepic.encode(img, payload)
|
|
40
|
+
|
|
41
|
+
img_dir, img_name = os.path.split(image_path)
|
|
42
|
+
filename, _ = os.path.splitext(img_name)
|
|
43
|
+
output_path = os.path.join(img_dir, f"{filename}_with_file.png")
|
|
44
|
+
|
|
45
|
+
encoded_img.save(output_path, format='PNG')
|
|
46
|
+
return f"Success! File hidden inside image. Saved at: {output_path}"
|
|
47
|
+
except Exception as e:
|
|
48
|
+
return f"An error occurred: {str(e)}"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
except:
|
|
6
|
+
os.system("pip install pillow")
|
|
7
|
+
from PIL import Image
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
import stepic
|
|
11
|
+
except:
|
|
12
|
+
os.system("pip install stepic")
|
|
13
|
+
import stepic
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def hide_text_in_img(image_path, text):
|
|
17
|
+
if not image_path or not os.path.exists(image_path):
|
|
18
|
+
return "No image provided or file does not exist"
|
|
19
|
+
|
|
20
|
+
valid_extensions = ('.jpg', '.jpeg', '.png', '.bmp', '.webp')
|
|
21
|
+
if not image_path.lower().endswith(valid_extensions):
|
|
22
|
+
return "We only accept images"
|
|
23
|
+
|
|
24
|
+
if not text:
|
|
25
|
+
return "No text provided to hide"
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
img = Image.open(image_path)
|
|
29
|
+
|
|
30
|
+
if img.mode != 'RGBA':
|
|
31
|
+
img = img.convert('RGBA')
|
|
32
|
+
|
|
33
|
+
encoded_img = stepic.encode(img, text.encode('utf-8'))
|
|
34
|
+
|
|
35
|
+
filename, ext = os.path.splitext(image_path)
|
|
36
|
+
output_path = f"{filename}_hidden.png"
|
|
37
|
+
|
|
38
|
+
encoded_img.save(output_path, format='PNG')
|
|
39
|
+
return f"Success! Image saved at: {output_path}"
|
|
40
|
+
except Exception as e:
|
|
41
|
+
return f"An error occurred: {str(e)}"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from PIL import Image
|
|
5
|
+
from PIL.ExifTags import TAGS, GPSTAGS
|
|
6
|
+
except:
|
|
7
|
+
import os
|
|
8
|
+
os.system("pip install pillow")
|
|
9
|
+
from PIL import Image
|
|
10
|
+
from PIL.ExifTags import TAGS,GPSTAGS
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def remove(file_path, output_suffix="_cleaned"):
|
|
14
|
+
|
|
15
|
+
if not os.path.exists(file_path):
|
|
16
|
+
return "File does not exist"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
with Image.open(file_path) as img:
|
|
21
|
+
|
|
22
|
+
file_dir, file_name = os.path.split(file_path)
|
|
23
|
+
name, ext = os.path.splitext(file_name)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
new_file_name = f"{name}{output_suffix}{ext}"
|
|
27
|
+
output_path = os.path.join(file_dir, new_file_name)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
cleaned_img = Image.new(img.mode, img.size)
|
|
31
|
+
cleaned_img.putdata(img.getdata())
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
cleaned_img.save(output_path, format=img.format)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
"Status": "Success",
|
|
39
|
+
"Message": "Metadata removed successfully",
|
|
40
|
+
"Original_File": file_name,
|
|
41
|
+
"Cleaned_File": new_file_name,
|
|
42
|
+
"Format": img.format,
|
|
43
|
+
"Dimensions": f"{img.width}x{img.height} pixels"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
except (IOError, SyntaxError, Image.UnidentifiedImageError):
|
|
47
|
+
|
|
48
|
+
return "This is not an image"
|