deathCode 1.0.0__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.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: deathCode
3
+ Version: 1.0.0
4
+ Summary: مكتبة تشفير ملفات قوية (DC Encryption)
5
+ Author: DeathCode
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Requires-Python: >=3.7
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: pycryptodome>=3.19.0
11
+ Dynamic: author
12
+ Dynamic: classifier
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: requires-dist
16
+ Dynamic: requires-python
17
+ Dynamic: summary
18
+
19
+ # DeathCode - DC Encryption
20
+
21
+ مكتبة تشفير ملفات قوية باستخدام AES-256-CBC
22
+
23
+ ## التثبيت
24
+
25
+ ```bash
26
+ pip install deathCode
@@ -0,0 +1,8 @@
1
+ # DeathCode - DC Encryption
2
+
3
+ مكتبة تشفير ملفات قوية باستخدام AES-256-CBC
4
+
5
+ ## التثبيت
6
+
7
+ ```bash
8
+ pip install deathCode
@@ -0,0 +1,4 @@
1
+ from .encryptor import encrypt_file, decrypt_file, encrypt_folder, decrypt_folder
2
+
3
+ __version__ = "1.0.0"
4
+ __author__ = "DeathCode"
@@ -0,0 +1,113 @@
1
+ import os
2
+ import sys
3
+ import struct
4
+ from Crypto.Cipher import AES
5
+ from Crypto.Hash import SHA256
6
+ from Crypto.Random import get_random_bytes
7
+ import argparse
8
+
9
+ # ========== التشفير ==========
10
+
11
+ def encrypt_file(file_path, password):
12
+ """تشفير ملف وتحويله إلى .dc"""
13
+ output_path = file_path + ".dc"
14
+
15
+ # تحويل كلمة المرور إلى مفتاح 32 بايت
16
+ key = SHA256.new(password.encode()).digest()
17
+
18
+ # إنشاء IV عشوائي
19
+ iv = get_random_bytes(16)
20
+
21
+ cipher = AES.new(key, AES.MODE_CBC, iv)
22
+
23
+ with open(file_path, "rb") as f:
24
+ plaintext = f.read()
25
+
26
+ # Padding لجعل النص مضاعف 16 بايت
27
+ pad_len = 16 - (len(plaintext) % 16)
28
+ plaintext += bytes([pad_len]) * pad_len
29
+
30
+ ciphertext = cipher.encrypt(plaintext)
31
+
32
+ with open(output_path, "wb") as f:
33
+ f.write(iv + ciphertext) # نحفظ IV مع الملف
34
+
35
+ print(f"[✓] تم التشفير: {file_path} -> {output_path}")
36
+ return output_path
37
+
38
+
39
+ def decrypt_file(file_path, password):
40
+ """فك تشفير ملف .dc"""
41
+ if not file_path.endswith(".dc"):
42
+ print("[✗] الملف مو بصيغة .dc")
43
+ return None
44
+
45
+ # استخراج اسم الملف الأصلي
46
+ original_path = file_path[:-3]
47
+
48
+ key = SHA256.new(password.encode()).digest()
49
+
50
+ with open(file_path, "rb") as f:
51
+ iv = f.read(16) # أول 16 بايت هي IV
52
+ ciphertext = f.read()
53
+
54
+ cipher = AES.new(key, AES.MODE_CBC, iv)
55
+ plaintext = cipher.decrypt(ciphertext)
56
+
57
+ # إزالة padding
58
+ pad_len = plaintext[-1]
59
+ plaintext = plaintext[:-pad_len]
60
+
61
+ with open(original_path, "wb") as f:
62
+ f.write(plaintext)
63
+
64
+ print(f"[✓] تم فك التشفير: {file_path} -> {original_path}")
65
+ return original_path
66
+
67
+
68
+ def encrypt_folder(folder_path, password):
69
+ """تشفير كل الملفات في مجلد"""
70
+ count = 0
71
+ for root, dirs, files in os.walk(folder_path):
72
+ for file in files:
73
+ file_path = os.path.join(root, file)
74
+ if not file_path.endswith(".dc"):
75
+ encrypt_file(file_path, password)
76
+ count += 1
77
+ print(f"\n[✓] تم تشفير {count} ملف في المجلد: {folder_path}")
78
+ return count
79
+
80
+
81
+ def decrypt_folder(folder_path, password):
82
+ """فك تشفير كل ملفات .dc في مجلد"""
83
+ count = 0
84
+ for root, dirs, files in os.walk(folder_path):
85
+ for file in files:
86
+ if file.endswith(".dc"):
87
+ file_path = os.path.join(root, file)
88
+ decrypt_file(file_path, password)
89
+ count += 1
90
+ print(f"\n[✓] تم فك تشفير {count} ملف في المجلد: {folder_path}")
91
+ return count
92
+
93
+ def main():
94
+ parser = argparse.ArgumentParser(description="DeathCode - DC Encryption Tool")
95
+ parser.add_argument("action", choices=["encrypt", "decrypt", "encrypt-folder", "decrypt-folder"],
96
+ help="الإجراء المطلوب")
97
+ parser.add_argument("path", help="مسار الملف أو المجلد")
98
+ parser.add_argument("--password", "-p", required=True, help="كلمة المرور")
99
+
100
+ args = parser.parse_args()
101
+
102
+ if args.action == "encrypt":
103
+ encrypt_file(args.path, args.password)
104
+ elif args.action == "decrypt":
105
+ decrypt_file(args.path, args.password)
106
+ elif args.action == "encrypt-folder":
107
+ encrypt_folder(args.path, args.password)
108
+ elif args.action == "decrypt-folder":
109
+ decrypt_folder(args.path, args.password)
110
+
111
+
112
+ if __name__ == "__main__":
113
+ main()
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: deathCode
3
+ Version: 1.0.0
4
+ Summary: مكتبة تشفير ملفات قوية (DC Encryption)
5
+ Author: DeathCode
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Requires-Python: >=3.7
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: pycryptodome>=3.19.0
11
+ Dynamic: author
12
+ Dynamic: classifier
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: requires-dist
16
+ Dynamic: requires-python
17
+ Dynamic: summary
18
+
19
+ # DeathCode - DC Encryption
20
+
21
+ مكتبة تشفير ملفات قوية باستخدام AES-256-CBC
22
+
23
+ ## التثبيت
24
+
25
+ ```bash
26
+ pip install deathCode
@@ -0,0 +1,10 @@
1
+ README.md
2
+ setup.py
3
+ deathCode/__init__.py
4
+ deathCode/encryptor.py
5
+ deathCode.egg-info/PKG-INFO
6
+ deathCode.egg-info/SOURCES.txt
7
+ deathCode.egg-info/dependency_links.txt
8
+ deathCode.egg-info/entry_points.txt
9
+ deathCode.egg-info/requires.txt
10
+ deathCode.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ dcrypt = deathCode.encryptor:main
@@ -0,0 +1 @@
1
+ pycryptodome>=3.19.0
@@ -0,0 +1 @@
1
+ deathCode
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="deathCode",
5
+ version="1.0.0",
6
+ description="مكتبة تشفير ملفات قوية (DC Encryption)",
7
+ long_description=open("README.md", "r", encoding="utf-8").read(),
8
+ long_description_content_type="text/markdown",
9
+ author="DeathCode",
10
+ packages=find_packages(),
11
+ install_requires=[
12
+ "pycryptodome>=3.19.0",
13
+ ],
14
+ entry_points={
15
+ "console_scripts": [
16
+ "dcrypt=deathCode.encryptor:main",
17
+ ],
18
+ },
19
+ classifiers=[
20
+ "Programming Language :: Python :: 3",
21
+ "License :: OSI Approved :: MIT License",
22
+ ],
23
+ python_requires=">=3.7",
24
+ )