Kekik 1.5.0__tar.gz → 1.5.2__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.
- kekik-1.5.2/Kekik/Sifreleme/AESManager.py +66 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/Sifreleme/CryptoJS.py +35 -3
- kekik-1.5.2/Kekik/Sifreleme/HexCodec.py +23 -0
- kekik-1.5.2/Kekik/Sifreleme/Packer.py +62 -0
- kekik-1.5.2/Kekik/Sifreleme/__init__.py +7 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik.egg-info/PKG-INFO +1 -1
- {kekik-1.5.0 → kekik-1.5.2}/Kekik.egg-info/SOURCES.txt +2 -1
- {kekik-1.5.0 → kekik-1.5.2}/PKG-INFO +1 -1
- {kekik-1.5.0 → kekik-1.5.2}/setup.py +1 -1
- kekik-1.5.0/Kekik/Sifreleme/Aes.py +0 -39
- kekik-1.5.0/Kekik/Sifreleme/Packer.py +0 -43
- kekik-1.5.0/Kekik/Sifreleme/__init__.py +0 -6
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/BIST.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/Domain2IP.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/Nesne.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/Sifreleme/AtobRtt.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/__init__.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/cli.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/csv2dict.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/dict2csv.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/dict2json.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/dosya2set.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/dosya_indir.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/hwid_kontrol.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/kisi_ver/__init__.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/kisi_ver/biyografiler.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/kisi_ver/isimler.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/kisi_ver/soyisimler.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/link_islemleri.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/list2html.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/liste_fetis.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/mail_gonder.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/okunabilir_byte.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/proxy_ver.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/qr_ver.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/ses_fetis.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/slugify.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/terminal_baslik.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/txt_fetis.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/unicode_tr.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik/zaman_donustur.py +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik.egg-info/dependency_links.txt +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik.egg-info/entry_points.txt +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik.egg-info/requires.txt +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/Kekik.egg-info/top_level.txt +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/LICENSE +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/MANIFEST.in +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/README.md +0 -0
- {kekik-1.5.0 → kekik-1.5.2}/setup.cfg +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# ! Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
|
+
|
|
3
|
+
from json import loads, dumps
|
|
4
|
+
from Crypto.Hash import MD5
|
|
5
|
+
from Crypto.Cipher import AES
|
|
6
|
+
from Crypto.Random import get_random_bytes
|
|
7
|
+
from Crypto.Util.Padding import pad, unpad
|
|
8
|
+
from base64 import b64encode, b64decode
|
|
9
|
+
|
|
10
|
+
class AESManager:
|
|
11
|
+
"""
|
|
12
|
+
AES/CBC/PKCS5Padding şifreleme ve çözme işlemleri için bir sınıf.
|
|
13
|
+
"""
|
|
14
|
+
@staticmethod
|
|
15
|
+
def generate_key_and_iv(password, salt, key_length=32, iv_length=16, iterations=1):
|
|
16
|
+
"""Anahtar ve IV oluşturmak için bir KDF fonksiyonu."""
|
|
17
|
+
derived_key_iv = b""
|
|
18
|
+
previous_block = b""
|
|
19
|
+
|
|
20
|
+
while len(derived_key_iv) < key_length + iv_length:
|
|
21
|
+
current_block = MD5.new(previous_block + password.encode() + salt).digest()
|
|
22
|
+
|
|
23
|
+
for _ in range(1, iterations):
|
|
24
|
+
current_block = MD5.new(current_block).digest()
|
|
25
|
+
|
|
26
|
+
derived_key_iv += current_block
|
|
27
|
+
previous_block = current_block
|
|
28
|
+
|
|
29
|
+
key = derived_key_iv[:key_length]
|
|
30
|
+
iv = derived_key_iv[key_length:key_length + iv_length]
|
|
31
|
+
|
|
32
|
+
return key, iv
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
def hex_to_bytes(hex_str):
|
|
36
|
+
"""Hex string'i byte array'e çevirir."""
|
|
37
|
+
return bytes.fromhex(hex_str)
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def encrypt(plain_text, password):
|
|
41
|
+
"""Verilen metni AES/CBC/PKCS5Padding şifreleme yöntemi ile şifreler."""
|
|
42
|
+
salt = get_random_bytes(8)
|
|
43
|
+
key, iv = AESManager.generate_key_and_iv(password, salt)
|
|
44
|
+
|
|
45
|
+
cipher = AES.new(key, AES.MODE_CBC, iv)
|
|
46
|
+
ct_bytes = cipher.encrypt(pad(plain_text.encode("utf-8"), AES.block_size))
|
|
47
|
+
|
|
48
|
+
return dumps({
|
|
49
|
+
"ct" : b64encode(ct_bytes).decode("utf-8"),
|
|
50
|
+
"iv" : iv.hex(),
|
|
51
|
+
"s" : salt.hex()
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
@staticmethod
|
|
55
|
+
def decrypt(crypted_data, password):
|
|
56
|
+
"""Verilen şifreli metni AES/CBC/PKCS5Padding şifreleme yöntemi ile çözer."""
|
|
57
|
+
data = loads(crypted_data)
|
|
58
|
+
salt = AESManager.hex_to_bytes(data["s"])
|
|
59
|
+
iv = AESManager.hex_to_bytes(data["iv"])
|
|
60
|
+
|
|
61
|
+
key, iv = AESManager.generate_key_and_iv(password, salt, iv_length=len(iv))
|
|
62
|
+
|
|
63
|
+
cipher = AES.new(key, AES.MODE_CBC, iv)
|
|
64
|
+
decrypted = unpad(cipher.decrypt(b64decode(data["ct"])), AES.block_size)
|
|
65
|
+
|
|
66
|
+
return decrypted.decode("utf-8")
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# ! Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
2
|
|
|
3
3
|
from Crypto.Cipher import AES
|
|
4
|
+
from Crypto.Random import get_random_bytes
|
|
4
5
|
import hashlib, base64
|
|
5
6
|
|
|
6
7
|
class CryptoJS:
|
|
7
8
|
"""
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Paroladan türetilmiş anahtar ile AES/CBC/PKCS7Padding şifreleme ve şifre çözme işlemleri için bir sınıf.
|
|
10
|
+
CryptoJS AES yöntemine uygundur.
|
|
11
|
+
! » https://gist.github.com/thackerronak/554c985c3001b16810af5fc0eb5c358f
|
|
10
12
|
"""
|
|
11
13
|
KEY_SIZE = 32
|
|
12
14
|
IV_SIZE = 16
|
|
@@ -17,6 +19,7 @@ class CryptoJS:
|
|
|
17
19
|
|
|
18
20
|
@staticmethod
|
|
19
21
|
def evp_kdf(password, salt, key_size=32, iv_size=16, iterations=1, hash_algorithm="md5"):
|
|
22
|
+
"""Paroladan Anahtar ve IV oluşturmak için bir KDF fonksiyonu."""
|
|
20
23
|
target_key_size = key_size + iv_size
|
|
21
24
|
derived_bytes = b""
|
|
22
25
|
block = None
|
|
@@ -37,8 +40,23 @@ class CryptoJS:
|
|
|
37
40
|
|
|
38
41
|
return derived_bytes[:key_size], derived_bytes[key_size:key_size + iv_size]
|
|
39
42
|
|
|
43
|
+
@staticmethod
|
|
44
|
+
def encrypt(password, plain_text):
|
|
45
|
+
"""Verilen metni AES/CBC/PKCS7Padding şifreleme yöntemi ile şifreler."""
|
|
46
|
+
salt = CryptoJS.generate_salt(8)
|
|
47
|
+
key, iv = CryptoJS.evp_kdf(password.encode("utf-8"), salt, key_size=CryptoJS.KEY_SIZE, iv_size=CryptoJS.IV_SIZE)
|
|
48
|
+
|
|
49
|
+
cipher = AES.new(key, CryptoJS.AES_MODE, iv)
|
|
50
|
+
cipher_text = cipher.encrypt(CryptoJS._pad(plain_text.encode("utf-8")))
|
|
51
|
+
|
|
52
|
+
# Create CryptoJS-like encrypted output
|
|
53
|
+
encrypted_data = CryptoJS.APPEND + salt + cipher_text
|
|
54
|
+
|
|
55
|
+
return base64.b64encode(encrypted_data).decode("utf-8")
|
|
56
|
+
|
|
40
57
|
@staticmethod
|
|
41
58
|
def decrypt(password, cipher_text):
|
|
59
|
+
"""Verilen şifreli metni AES/CBC/PKCS7Padding şifreleme yöntemi ile çözer."""
|
|
42
60
|
ct_bytes = base64.b64decode(cipher_text)
|
|
43
61
|
salt = ct_bytes[8:16]
|
|
44
62
|
cipher_text_bytes = ct_bytes[16:]
|
|
@@ -50,6 +68,20 @@ class CryptoJS:
|
|
|
50
68
|
|
|
51
69
|
return CryptoJS._unpad(plain_text).decode("utf-8")
|
|
52
70
|
|
|
71
|
+
@staticmethod
|
|
72
|
+
def _pad(s):
|
|
73
|
+
"""Veriyi AES blok boyutuna göre doldurur (PKCS7)."""
|
|
74
|
+
block_size = AES.block_size
|
|
75
|
+
padding = block_size - len(s) % block_size
|
|
76
|
+
|
|
77
|
+
return s + bytes([padding] * padding)
|
|
78
|
+
|
|
53
79
|
@staticmethod
|
|
54
80
|
def _unpad(s):
|
|
55
|
-
|
|
81
|
+
"""Dolguyu kaldırır (PKCS7)."""
|
|
82
|
+
return s[:-ord(s[-1:])]
|
|
83
|
+
|
|
84
|
+
@staticmethod
|
|
85
|
+
def generate_salt(length):
|
|
86
|
+
"""Belirtilen uzunlukta rastgele bir tuz oluşturur."""
|
|
87
|
+
return get_random_bytes(length)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ! Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
|
+
|
|
3
|
+
class HexCodec:
|
|
4
|
+
@staticmethod
|
|
5
|
+
def encode(utf8_string: str) -> str:
|
|
6
|
+
"""
|
|
7
|
+
UTF-8 stringini kaçış dizileriyle birlikte hex stringine dönüştürür.
|
|
8
|
+
"""
|
|
9
|
+
byte_data = utf8_string.encode("utf-8")
|
|
10
|
+
hex_string = byte_data.hex()
|
|
11
|
+
escaped_hex = "\\x".join(hex_string[i:i+2] for i in range(0, len(hex_string), 2))
|
|
12
|
+
|
|
13
|
+
return f"\\x{escaped_hex}"
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def decode(escaped_hex: str) -> str:
|
|
17
|
+
"""
|
|
18
|
+
Kaçış dizileri içeren bir hex stringini UTF-8 formatındaki stringe dönüştürür.
|
|
19
|
+
"""
|
|
20
|
+
hex_string = escaped_hex.replace("\\x", "")
|
|
21
|
+
byte_data = bytes.fromhex(hex_string)
|
|
22
|
+
|
|
23
|
+
return byte_data.decode("utf-8")
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ! Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
class Packer:
|
|
6
|
+
"""
|
|
7
|
+
P.A.C.K.E.R. sıkıştırma ve çözme işlemleri için bir sınıf.
|
|
8
|
+
! » https://github.com/beautifier/js-beautify/blob/main/python/jsbeautifier/unpackers/packer.py
|
|
9
|
+
"""
|
|
10
|
+
@staticmethod
|
|
11
|
+
def clean_escape_sequences(source: str) -> str:
|
|
12
|
+
"""Kaçış dizilerini temizler."""
|
|
13
|
+
source = re.sub(r'\\\\', r'\\', source)
|
|
14
|
+
source = source.replace("\\'", "'")
|
|
15
|
+
source = source.replace('\\"', '"')
|
|
16
|
+
return source
|
|
17
|
+
|
|
18
|
+
@staticmethod
|
|
19
|
+
def extract_arguments(source: str) -> tuple[str, list[str], int, int]:
|
|
20
|
+
"""P.A.C.K.E.R. formatındaki kaynak koddan argümanları çıkarır."""
|
|
21
|
+
match = re.search(r"}\('(.*)',(\d+),(\d+),'(.*)'\.split\('\|'\)", source, re.DOTALL)
|
|
22
|
+
|
|
23
|
+
if not match:
|
|
24
|
+
raise ValueError("Invalid P.A.C.K.E.R. source format.")
|
|
25
|
+
|
|
26
|
+
payload, radix, count, symtab = match.groups()
|
|
27
|
+
|
|
28
|
+
return payload, symtab.split("|"), int(radix), int(count)
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def convert_base(s: str, base: int) -> int:
|
|
32
|
+
"""Bir sayıyı belirli bir tabandan ondalık tabana çevirir."""
|
|
33
|
+
alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
34
|
+
|
|
35
|
+
return sum(alphabet.index(char) * (base**idx) for idx, char in enumerate(reversed(s)))
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def lookup_symbol(match: re.Match, symtab: list[str], radix: int) -> str:
|
|
39
|
+
"""Sembolleri arar ve yerine koyar."""
|
|
40
|
+
word = match[0]
|
|
41
|
+
|
|
42
|
+
return symtab[Packer.convert_base(word, radix)] or word
|
|
43
|
+
|
|
44
|
+
@staticmethod
|
|
45
|
+
def unpack(source: str) -> str:
|
|
46
|
+
"""P.A.C.K.E.R. formatındaki sıkıştırılmış bir kaynağı çözer."""
|
|
47
|
+
source = Packer.clean_escape_sequences(source)
|
|
48
|
+
|
|
49
|
+
payload, symtab, radix, count = Packer.extract_arguments(source)
|
|
50
|
+
|
|
51
|
+
if count != len(symtab):
|
|
52
|
+
raise ValueError("Malformed P.A.C.K.E.R. symtab.")
|
|
53
|
+
|
|
54
|
+
return re.sub(r"\b\w+\b", lambda match: Packer.lookup_symbol(match, symtab, radix), payload)
|
|
55
|
+
|
|
56
|
+
@staticmethod
|
|
57
|
+
def pack(source: str, radix: int = 62) -> str:
|
|
58
|
+
"""Bir metni P.A.C.K.E.R. formatında sıkıştırır."""
|
|
59
|
+
# Bu işlev, simgeleri ve sıkıştırılmış metni yeniden oluşturmak için bir yol sağlar.
|
|
60
|
+
# Ancak bu, belirli bir algoritma veya sıkıştırma tekniğine bağlıdır.
|
|
61
|
+
# Gerçekleştirilmesi zor olabilir çünkü P.A.C.K.E.R.'ın spesifik sıkıştırma mantığını takip etmek gerekir.
|
|
62
|
+
raise NotImplementedError("Packing function is not implemented.")
|
|
@@ -32,9 +32,10 @@ Kekik.egg-info/dependency_links.txt
|
|
|
32
32
|
Kekik.egg-info/entry_points.txt
|
|
33
33
|
Kekik.egg-info/requires.txt
|
|
34
34
|
Kekik.egg-info/top_level.txt
|
|
35
|
-
Kekik/Sifreleme/
|
|
35
|
+
Kekik/Sifreleme/AESManager.py
|
|
36
36
|
Kekik/Sifreleme/AtobRtt.py
|
|
37
37
|
Kekik/Sifreleme/CryptoJS.py
|
|
38
|
+
Kekik/Sifreleme/HexCodec.py
|
|
38
39
|
Kekik/Sifreleme/Packer.py
|
|
39
40
|
Kekik/Sifreleme/__init__.py
|
|
40
41
|
Kekik/kisi_ver/__init__.py
|
|
@@ -6,7 +6,7 @@ from io import open
|
|
|
6
6
|
setup(
|
|
7
7
|
# ? Genel Bilgiler
|
|
8
8
|
name = "Kekik",
|
|
9
|
-
version = "1.5.
|
|
9
|
+
version = "1.5.2",
|
|
10
10
|
url = "https://github.com/keyiflerolsun/Kekik",
|
|
11
11
|
description = "İşlerimizi kolaylaştıracak fonksiyonların el altında durduğu kütüphane..",
|
|
12
12
|
keywords = ["Kekik", "KekikAkademi", "keyiflerolsun"],
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# ! Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
|
-
|
|
3
|
-
from json import loads
|
|
4
|
-
from Crypto.Hash import MD5
|
|
5
|
-
from Crypto.Cipher import AES
|
|
6
|
-
from Crypto.Util.Padding import unpad
|
|
7
|
-
from base64 import b64decode
|
|
8
|
-
|
|
9
|
-
def decrypt_aes_with_custom_kdf(crypted_data, password) -> str:
|
|
10
|
-
"""
|
|
11
|
-
AES/CBC/PKCS5Padding şifreleme şemasını kullanarak şifre çözme işlemi yapar.
|
|
12
|
-
|
|
13
|
-
:param crypted_data: JSON formatında şifrelenmiş veri (ct, iv, s içerir).
|
|
14
|
-
:param password: Anahtar türetmede kullanılacak şifre.
|
|
15
|
-
:return: Çözülmüş veri (string olarak).
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
def generate_key_and_iv(password, salt, key_length=32, iv_length=16, iterations=1):
|
|
19
|
-
"""Anahtar ve IV oluşturmak için bir KDF fonksiyonu."""
|
|
20
|
-
d = d_i = b""
|
|
21
|
-
while len(d) < key_length + iv_length:
|
|
22
|
-
d_i = MD5.new(d_i + password + salt).digest()
|
|
23
|
-
for _ in range(1, iterations):
|
|
24
|
-
d_i = MD5.new(d_i).digest()
|
|
25
|
-
d += d_i
|
|
26
|
-
return d[:key_length], d[key_length : key_length + iv_length]
|
|
27
|
-
|
|
28
|
-
def hex_to_bytes(hex_str):
|
|
29
|
-
"""Hex string'i byte array'e çevirir."""
|
|
30
|
-
return bytes.fromhex(hex_str)
|
|
31
|
-
|
|
32
|
-
data = loads(crypted_data)
|
|
33
|
-
|
|
34
|
-
key, iv = generate_key_and_iv(password, hex_to_bytes(data["s"]), iv_length=len(data["iv"]) // 2)
|
|
35
|
-
|
|
36
|
-
cipher = AES.new(key, AES.MODE_CBC, iv)
|
|
37
|
-
decrypted = unpad(cipher.decrypt(b64decode(data["ct"])), AES.block_size)
|
|
38
|
-
|
|
39
|
-
return decrypted.decode("utf-8")
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# ! Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
|
-
|
|
3
|
-
import re
|
|
4
|
-
|
|
5
|
-
def unpack_packer(source: str) -> str:
|
|
6
|
-
"""https://github.com/beautifier/js-beautify/blob/main/python/jsbeautifier/unpackers/packer.py"""
|
|
7
|
-
|
|
8
|
-
def clean_escape_sequences(source: str) -> str:
|
|
9
|
-
source = re.sub(r'\\\\', r'\\', source)
|
|
10
|
-
source = source.replace("\\'", "'")
|
|
11
|
-
source = source.replace('\\"', '"')
|
|
12
|
-
return source
|
|
13
|
-
|
|
14
|
-
source = clean_escape_sequences(source)
|
|
15
|
-
|
|
16
|
-
def extract_arguments(source: str) -> tuple[str, list[str], int, int]:
|
|
17
|
-
match = re.search(r"}\('(.*)',(\d+),(\d+),'(.*)'\.split\('\|'\)", source, re.DOTALL)
|
|
18
|
-
|
|
19
|
-
if not match:
|
|
20
|
-
raise ValueError("Invalid P.A.C.K.E.R. source format.")
|
|
21
|
-
|
|
22
|
-
payload, radix, count, symtab = match.groups()
|
|
23
|
-
|
|
24
|
-
return payload, symtab.split("|"), int(radix), int(count)
|
|
25
|
-
|
|
26
|
-
def convert_base(s: str, base: int) -> int:
|
|
27
|
-
alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
28
|
-
|
|
29
|
-
return sum(alphabet.index(char) * (base**idx) for idx, char in enumerate(reversed(s)))
|
|
30
|
-
|
|
31
|
-
payload, symtab, radix, count = extract_arguments(source)
|
|
32
|
-
|
|
33
|
-
if count != len(symtab):
|
|
34
|
-
raise ValueError("Malformed P.A.C.K.E.R. symtab.")
|
|
35
|
-
|
|
36
|
-
def lookup_symbol(match: re.Match) -> str:
|
|
37
|
-
word = match[0]
|
|
38
|
-
|
|
39
|
-
return symtab[convert_base(word, radix)] or word
|
|
40
|
-
|
|
41
|
-
unpacked_source = re.sub(r"\b\w+\b", lookup_symbol, payload)
|
|
42
|
-
|
|
43
|
-
return unpacked_source
|
|
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
|
|
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
|