From 1d66bacd36ba4e0a4e6e4f75afeacf8db0748ab2 Mon Sep 17 00:00:00 2001 From: securisec Date: Tue, 5 Nov 2024 00:39:22 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=93=20Nov=205,=202024=2012:38:36?= =?UTF-8?q?=E2=80=AFAM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 fix decimal xor --- chepy/chepy_plugins | 2 +- chepy/modules/encryptionencoding.py | 17 +++++++++++------ docs/conf.py | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/chepy/chepy_plugins b/chepy/chepy_plugins index b01126f..ebca7ce 160000 --- a/chepy/chepy_plugins +++ b/chepy/chepy_plugins @@ -1 +1 @@ -Subproject commit b01126f84260d4d5c9cf397c8aea1fdc2893b1a6 +Subproject commit ebca7ceab0697d77d2f4d9736516bece24c9df1e diff --git a/chepy/modules/encryptionencoding.py b/chepy/modules/encryptionencoding.py index 4925a0e..2adef72 100644 --- a/chepy/modules/encryptionencoding.py +++ b/chepy/modules/encryptionencoding.py @@ -341,13 +341,18 @@ def xor( elif key_type == "base64": key = binascii.hexlify(base64.b64decode(key.encode())) elif key_type == "decimal": - key = binascii.hexlify( - int(key).to_bytes(len(str(key)), byteorder="big") - ) + if int(key) < 0 or int(key) > 255: + raise ValueError("Invalid decimal key") # pragma: no cover - key = binascii.unhexlify(key) - for char, key_val in zip(self._convert_to_bytes(), itertools.cycle(key)): - x.append(char ^ key_val) + _s = self._convert_to_bytes() + + if key_type == "decimal": + for b in _s: + x.append(b ^ int(key)) + else: + key = binascii.unhexlify(key) + for char, key_val in zip(_s, itertools.cycle(key)): + x.append(char ^ key_val) self.state = bytes(x) return self diff --git a/docs/conf.py b/docs/conf.py index ab47a78..ccce7ec 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,8 +26,8 @@ def setup(app): # -- Project information ----------------------------------------------------- project = "Chepy" -copyright = "2019, Hapsida @securisec" -author = "Hapsida @securisec" +copyright = "2019, @securisec" +author = "@securisec" master_doc = 'index'