Skip to content

Commit

Permalink
slightly better obfuscation for env vars.
Browse files Browse the repository at this point in the history
  • Loading branch information
KingKDot committed May 9, 2024
1 parent d7735dd commit aed3857
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/util/methods/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
14 changes: 9 additions & 5 deletions src/util/obfuscation/rans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit aed3857

Please sign in to comment.