From aed38571ef3fd83b68011322f3e48a88c0d45d4b Mon Sep 17 00:00:00 2001 From: KDot227 Date: Thu, 9 May 2024 16:56:33 -0500 Subject: [PATCH] slightly better obfuscation for env vars. --- src/util/methods/common/common.py | 2 +- src/util/obfuscation/rans.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/util/methods/common/common.py b/src/util/methods/common/common.py index 26c63e2..3339215 100644 --- a/src/util/methods/common/common.py +++ b/src/util/methods/common/common.py @@ -56,7 +56,7 @@ def create_hex_string(characters) -> str: def random_spaces() -> str: - spaces = random.randint(1, 5) + spaces = random.randint(3, 20) return " " * spaces diff --git a/src/util/obfuscation/rans.py b/src/util/obfuscation/rans.py index a37f4fd..7e2bc92 100644 --- a/src/util/obfuscation/rans.py +++ b/src/util/obfuscation/rans.py @@ -105,26 +105,30 @@ def ran2(char, random_order: str, return_ran1: bool = True, *args, **kwargs) -> positive_index = random.choice([True, False]) if positive_index: random_positive_index = random.choice(valid_indexs) - return f"%{random_var}:~{random_positive_index},1%" + random_var = random_capitalization(random_var) + return f"%{random_var}:~{random_positive_index},{random_spaces()}1%" else: random_positive_index = random.choice(valid_indexs) negative_index = random_positive_index - len(value) - return f"%{random_var}:~{negative_index},1%" + random_var = random_capitalization(random_var) + return f"%{random_var}:~{negative_index},{random_spaces()}1%" elif modifier == "R": random_positive_index = random.choice(valid_indexs) - return f"%{random_var}:~{random_positive_index},1%" + random_var = random_capitalization(random_var) + return f"%{random_var}:~{random_positive_index},{random_spaces()}1%" elif modifier == "L": random_positive_index = random.choice(valid_indexs) negative_index = random_positive_index - len(value) - return f"%{random_var}:~{negative_index},1%" + random_var = random_capitalization(random_var) + return f"%{random_var}:~{negative_index},{random_spaces()}1%" if return_ran1: return ran1(char) else: if char not in string.ascii_letters: return char random_order_index = random_order.index(char) - return f"%KDOT:~{random_order_index},1%" + return f"%{random_capitalization('KDOT')}:~{random_order_index},{random_spaces()}1%" def ran3(char, random_order: str, *args, **kwargs) -> str: