ShadowB 0.3__tar.gz → 0.5__tar.gz

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.
Files changed (42) hide show
  1. {shadowb-0.3 → shadowb-0.5}/PKG-INFO +1 -1
  2. shadowb-0.5/ShadowB/Safe/clean.py +127 -0
  3. shadowb-0.5/ShadowB/Safe/cleanText.py +37 -0
  4. shadowb-0.5/ShadowB/Safe/ext.py +5 -0
  5. shadowb-0.5/ShadowB/Safe/filename.py +6 -0
  6. shadowb-0.5/ShadowB/Safe/safeFile.py +171 -0
  7. {shadowb-0.3 → shadowb-0.5}/ShadowB/core.py +1 -1
  8. {shadowb-0.3 → shadowb-0.5}/ShadowB/qrcode.py +0 -1
  9. {shadowb-0.3 → shadowb-0.5}/ShadowB.egg-info/PKG-INFO +1 -1
  10. {shadowb-0.3 → shadowb-0.5}/ShadowB.egg-info/SOURCES.txt +6 -1
  11. {shadowb-0.3 → shadowb-0.5}/pyproject.toml +1 -1
  12. {shadowb-0.3 → shadowb-0.5}/LICENSE +0 -0
  13. {shadowb-0.3 → shadowb-0.5}/README.md +0 -0
  14. {shadowb-0.3 → shadowb-0.5}/ShadowB/Core/fileorg.py +0 -0
  15. {shadowb-0.3 → shadowb-0.5}/ShadowB/Core/randwords.py +0 -0
  16. {shadowb-0.3 → shadowb-0.5}/ShadowB/GetD/make_cookies.py +0 -0
  17. {shadowb-0.3 → shadowb-0.5}/ShadowB/GetD/my_data.py +0 -0
  18. {shadowb-0.3 → shadowb-0.5}/ShadowB/GetD/my_ip.py +0 -0
  19. {shadowb-0.3 → shadowb-0.5}/ShadowB/GetD/scan.py +0 -0
  20. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/check_image.py +0 -0
  21. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/export_metadata.py +0 -0
  22. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/extr_hidden_files.py +0 -0
  23. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/extr_hidden_text.py +0 -0
  24. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/makeFile.py +0 -0
  25. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/makeText.py +0 -0
  26. {shadowb-0.3 → shadowb-0.5}/ShadowB/Image/remove_metadata.py +0 -0
  27. {shadowb-0.3 → shadowb-0.5}/ShadowB/Mail/make_mail.py +0 -0
  28. {shadowb-0.3 → shadowb-0.5}/ShadowB/Mail/res_msj.py +0 -0
  29. {shadowb-0.3 → shadowb-0.5}/ShadowB/Mail/send_msj.py +0 -0
  30. {shadowb-0.3 → shadowb-0.5}/ShadowB/Qrcode/generate.py +0 -0
  31. {shadowb-0.3 → shadowb-0.5}/ShadowB/__init__.py +0 -0
  32. {shadowb-0.3 → shadowb-0.5}/ShadowB/captcha.py +0 -0
  33. {shadowb-0.3 → shadowb-0.5}/ShadowB/getD.py +0 -0
  34. {shadowb-0.3 → shadowb-0.5}/ShadowB/image.py +0 -0
  35. {shadowb-0.3 → shadowb-0.5}/ShadowB/mail.py +0 -0
  36. {shadowb-0.3 → shadowb-0.5}/ShadowB/passwords.py +0 -0
  37. {shadowb-0.3 → shadowb-0.5}/ShadowB/safe.py +0 -0
  38. {shadowb-0.3 → shadowb-0.5}/ShadowB/search.py +0 -0
  39. {shadowb-0.3 → shadowb-0.5}/ShadowB.egg-info/dependency_links.txt +0 -0
  40. {shadowb-0.3 → shadowb-0.5}/ShadowB.egg-info/requires.txt +0 -0
  41. {shadowb-0.3 → shadowb-0.5}/ShadowB.egg-info/top_level.txt +0 -0
  42. {shadowb-0.3 → shadowb-0.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ShadowB
3
- Version: 0.3
3
+ Version: 0.5
4
4
  Summary: ShadowB is an all-in-one Python toolkit that bundles a wide range of everyday utilities — system info, image steganography, temporary email, QR codes, CAPTCHA generation, password tools, file safety checks, and more — into a single, easy-to-import package.
5
5
  Author-email: Adem mzoughi <ademzoughi1312@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -0,0 +1,127 @@
1
+ import os
2
+ import re
3
+
4
+ try:
5
+ from pypdf import PdfReader
6
+ except:
7
+ import os
8
+ os.system("pip install pypdf")
9
+ from pypdf import PdfReader
10
+
11
+ try:
12
+ from better_profanity import profanity
13
+ except ImportError:
14
+ import os
15
+ os.system("pip install better_profanity")
16
+ from better_profanity import profanity
17
+
18
+ custom_bad_words = ["irheb","de3ch","israil","اسرائيل","trump","ارهاب","إرهاب","zab", "zebi", "asba","3asba","nyk","nayek","nik","nik omk","3asba lik","mnayek","fuck","shit","fuck you","fuck u","nik omo","t7chi fih","yatek asba","yatek 3asba","ya3tek 3asba","zok","omk","kiss","زبي","عصب","نيك","امك","برا نيك","يعطك عصبة","عصبة"]
19
+
20
+ def normalize(text):
21
+ text = text.lower()
22
+ text = re.sub(r'[^a-zA-Z0-9\u0600-\u06FF]', '', text)
23
+ return text
24
+
25
+
26
+
27
+
28
+
29
+ def pdf_to_txt(file):
30
+ try:
31
+ if not file.lower().endswith(".pdf"):
32
+ raise ValueError("Currently, the accepted files are .pdf and .txt")
33
+
34
+ reader = PdfReader(file)
35
+ text = ""
36
+ for page in reader.pages:
37
+ text += page.extract_text() or ""
38
+
39
+ return text
40
+
41
+ except Exception as e:
42
+ print(e)
43
+ return "error"
44
+
45
+
46
+
47
+ def txt_to_text(file):
48
+ try:
49
+ if not file.lower().endswith(".txt"):
50
+ raise ValueError("Currently, the accepted files are .pdf and .txt")
51
+
52
+ with open(file, "r", encoding="utf-8") as f:
53
+ text = f.read()
54
+
55
+ return text
56
+
57
+ except Exception as e:
58
+ print(e)
59
+ return "error"
60
+
61
+
62
+
63
+ def is_clean(text,check_list=None):
64
+ if not text:
65
+ print("Maybe there's a mistake, no text was received!")
66
+ return False
67
+
68
+ normalized_text = normalize(text)
69
+
70
+
71
+ for word in custom_bad_words:
72
+ if word in normalized_text:
73
+ return False
74
+
75
+ if check_list:
76
+ for w in check_list:
77
+ if w in normalized_text:
78
+ return False
79
+
80
+
81
+ if profanity.contains_profanity(text):
82
+ return False
83
+
84
+ return True
85
+
86
+
87
+
88
+ def cleann(file,check_list=None):
89
+ if not file:
90
+ print("Maybe there's a mistake, no file was received!")
91
+ return False
92
+
93
+
94
+
95
+ if file.lower().endswith(".pdf"):
96
+ text = pdf_to_txt(file)
97
+
98
+ elif file.lower().endswith(".txt"):
99
+ text = txt_to_text(file)
100
+
101
+ else:
102
+ print("Currently, the accepted files are .pdf and .txt")
103
+ return "Currently, the accepted files are .pdf and .txt"
104
+
105
+ if text == "error":
106
+ print("An error occurred: Please try again, making sure the file is in PDF format and that it is a text document, not a scanned copy or image!")
107
+ return False
108
+
109
+ normalized_text = normalize(text)
110
+
111
+
112
+ for word in custom_bad_words:
113
+ if word in normalized_text:
114
+ return False
115
+
116
+ if check_list:
117
+ for w in check_list:
118
+ if w in normalized_text:
119
+ return False
120
+
121
+
122
+ if profanity.contains_profanity(text):
123
+ return False
124
+
125
+ return True
126
+
127
+
@@ -0,0 +1,37 @@
1
+ import os
2
+ import re
3
+ try:
4
+ from better_profanity import profanity
5
+ except ImportError:
6
+ import os
7
+ os.system("pip install better_profanity")
8
+ from better_profanity import profanity
9
+
10
+ custom_bad_words = ["irheb","ass","dick","cock","asshole","de3ch","israil","اسرائيل","trump","ارهاب","إرهاب","zab", "zebi", "asba","3asba","nyk","nayek","nik","nik omk","3asba lik","mnayek","fuck","shit","fuck you","fuck u","nik omo","t7chi fih","yatek asba","yatek 3asba","ya3tek 3asba","zok","omk","kiss","زبي","عصب","نيك","امك","برا نيك","يعطك عصبة","عصبة"]
11
+
12
+ def normalize(text):
13
+ text = text.lower()
14
+ text = re.sub(r'[^a-zA-Z0-9\u0600-\u06FF]', '', text)
15
+ return text
16
+
17
+ def is_clean(text,check_list=None):
18
+ if not text:
19
+ return True
20
+
21
+ normalized_text = normalize(text)
22
+
23
+
24
+ for word in custom_bad_words:
25
+ if word in normalized_text:
26
+ return False
27
+
28
+ if check_list:
29
+ for w in check_list:
30
+ if w in normalized_text:
31
+ return False
32
+
33
+
34
+ if profanity.contains_profanity(text):
35
+ return False
36
+
37
+ return True
@@ -0,0 +1,5 @@
1
+ import os
2
+
3
+ def real_ext(file):
4
+ ext = os.path.splitext(file)[1].lower()
5
+ return ext
@@ -0,0 +1,6 @@
1
+ import os
2
+
3
+ def real_filename(file):
4
+ name = ext = os.path.splitext(os.path.basename(file))[0]
5
+ return name
6
+
@@ -0,0 +1,171 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+ import zipfile
5
+
6
+
7
+ def _ensure_package(import_name, pip_name=None):
8
+
9
+ pip_name = pip_name or import_name
10
+ try:
11
+ return __import__(import_name)
12
+ except ImportError:
13
+ try:
14
+ subprocess.check_call(
15
+ [sys.executable, "-m", "pip", "install",
16
+ "--break-system-packages", pip_name],
17
+ stdout=subprocess.DEVNULL,
18
+ stderr=subprocess.DEVNULL,
19
+ )
20
+ except Exception:
21
+ return None
22
+ try:
23
+ return __import__(import_name)
24
+ except ImportError:
25
+ return None
26
+
27
+
28
+
29
+ magic = _ensure_package("magic", "python-magic")
30
+
31
+
32
+ pyclamd = _ensure_package("pyclamd", "pyclamd")
33
+
34
+
35
+ BLOCKED_EXTENSIONS = {
36
+ "exe", "bat", "cmd", "apk", "cpp", "py", "js", "html",
37
+ "css", "c", "java", "msi", "vbs", "ps1", "dll", "scr",
38
+ "sh", "rb", "php", "pl", "go", "rs", "ts", "jar", "com",
39
+ "pif", "reg", "hta", "wsf", "lnk"
40
+ }
41
+
42
+
43
+ EXECUTABLE_SIGNATURES = {
44
+ b"MZ": "Windows PE/EXE",
45
+ b"\x7fELF": "Linux ELF executable",
46
+ b"\xfe\xed\xfa\xce": "Mach-O 32-bit executable",
47
+ b"\xfe\xed\xfa\xcf": "Mach-O 64-bit executable",
48
+ b"\xca\xfe\xba\xbe": "Mach-O fat binary / Java class",
49
+ }
50
+
51
+
52
+ EXECUTABLE_LIKE_EXTENSIONS = {"exe", "dll", "com", "scr", "msi"}
53
+
54
+ MAX_ZIP_DEPTH = 1
55
+ MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024
56
+ MAX_COMPRESSION_RATIO = 100
57
+
58
+ ZIP_BASED_EXTENSIONS = {"zip", "jar", "apk", "docx", "xlsx", "pptx"}
59
+
60
+
61
+ def _get_extension(file_path):
62
+ return os.path.splitext(file_path)[1].lower().lstrip(".")
63
+
64
+
65
+ def _read_header(file_path, n=8):
66
+ try:
67
+ with open(file_path, "rb") as f:
68
+ return f.read(n)
69
+ except OSError:
70
+ return b""
71
+
72
+
73
+ def _is_disguised_executable(file_path):
74
+
75
+ header = _read_header(file_path, 8)
76
+ ext = _get_extension(file_path)
77
+
78
+ if ext in EXECUTABLE_LIKE_EXTENSIONS:
79
+ return False
80
+
81
+ for sig in EXECUTABLE_SIGNATURES:
82
+ if header.startswith(sig):
83
+ return True
84
+ return False
85
+
86
+
87
+ def _check_zip_bomb(file_path, depth=0):
88
+
89
+ if depth > MAX_ZIP_DEPTH:
90
+ return False
91
+
92
+ try:
93
+ with zipfile.ZipFile(file_path) as zf:
94
+ total_uncompressed = 0
95
+ for info in zf.infolist():
96
+ total_uncompressed += info.file_size
97
+ if total_uncompressed > MAX_UNCOMPRESSED_SIZE:
98
+ return False
99
+
100
+ if info.compress_size > 0:
101
+ ratio = info.file_size / max(info.compress_size, 1)
102
+ if ratio > MAX_COMPRESSION_RATIO:
103
+ return False
104
+
105
+ if info.filename.lower().endswith(".zip"):
106
+ if depth + 1 > MAX_ZIP_DEPTH:
107
+ return False
108
+ tmp_path = f"{file_path}.__nested_{depth}.tmp"
109
+ try:
110
+ with zf.open(info) as nested_file:
111
+ with open(tmp_path, "wb") as tmp:
112
+ tmp.write(nested_file.read())
113
+ nested_ok = _check_zip_bomb(tmp_path, depth + 1)
114
+ if not nested_ok:
115
+ return False
116
+ except (zipfile.BadZipFile, OSError):
117
+ return False
118
+ finally:
119
+ if os.path.exists(tmp_path):
120
+ os.remove(tmp_path)
121
+ except zipfile.BadZipFile:
122
+ return False
123
+ except OSError:
124
+ return False
125
+
126
+ return True
127
+
128
+
129
+ def _clamav_scan(file_path):
130
+
131
+ if pyclamd is None:
132
+ return None
133
+ try:
134
+ cd = pyclamd.ClamdUnixSocket()
135
+ if not cd.ping():
136
+ cd = pyclamd.ClamdNetworkSocket()
137
+ cd.ping()
138
+ result = cd.scan_file(file_path)
139
+ return result is None
140
+ except Exception:
141
+ return None
142
+
143
+
144
+ def is_safe(file):
145
+
146
+ if not file or not os.path.isfile(file):
147
+ return False
148
+
149
+ ext = _get_extension(file)
150
+
151
+
152
+ if ext in BLOCKED_EXTENSIONS:
153
+ return False
154
+
155
+
156
+ if _is_disguised_executable(file):
157
+ return False
158
+
159
+
160
+ header = _read_header(file, 4)
161
+ looks_like_zip = header.startswith(b"PK\x03\x04") or ext in ZIP_BASED_EXTENSIONS
162
+ if looks_like_zip:
163
+ if not _check_zip_bomb(file):
164
+ return False
165
+
166
+
167
+ av_result = _clamav_scan(file)
168
+ if av_result is False:
169
+ return False
170
+
171
+ return True
@@ -82,7 +82,7 @@ def owner():
82
82
  print("Github : https://github.com/erec2smith")
83
83
 
84
84
  def vr():
85
- print("0.2")
85
+ print("0.5")
86
86
 
87
87
  def team():
88
88
  print("Adem")
@@ -1,5 +1,4 @@
1
1
  from ShadowB.Qrcode.generate import qrcode
2
- from ShadowB.Qrcode.scan import scan
3
2
 
4
3
  def generate_qrcode(text,filename):
5
4
  return qrcode(text,filename)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ShadowB
3
- Version: 0.3
3
+ Version: 0.5
4
4
  Summary: ShadowB is an all-in-one Python toolkit that bundles a wide range of everyday utilities — system info, image steganography, temporary email, QR codes, CAPTCHA generation, password tools, file safety checks, and more — into a single, easy-to-import package.
5
5
  Author-email: Adem mzoughi <ademzoughi1312@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -32,4 +32,9 @@ ShadowB/Image/remove_metadata.py
32
32
  ShadowB/Mail/make_mail.py
33
33
  ShadowB/Mail/res_msj.py
34
34
  ShadowB/Mail/send_msj.py
35
- ShadowB/Qrcode/generate.py
35
+ ShadowB/Qrcode/generate.py
36
+ ShadowB/Safe/clean.py
37
+ ShadowB/Safe/cleanText.py
38
+ ShadowB/Safe/ext.py
39
+ ShadowB/Safe/filename.py
40
+ ShadowB/Safe/safeFile.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ShadowB"
7
- version = "0.3"
7
+ version = "0.5"
8
8
  authors = [
9
9
  {name = "Adem mzoughi", email = "ademzoughi1312@gmail.com"},
10
10
  ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes