Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fudfather committed Nov 29, 2023
1 parent 3b4ba2c commit 86b743f
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 74 deletions.
17 changes: 8 additions & 9 deletions setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ cls

set "python_path=%localappdata%\Programs\Python"

echo %python_path%

if not exist "%python_path%" (
echo "would you like to install python? (y/n)"
set /p "install_python="
Expand Down Expand Up @@ -41,15 +43,12 @@ if not %errorlevel% == 0 (

python -m pip install -r requirements.txt --upgrade

if "%~1"=="" (
pushd src
python -m main
popd
pause
) else (
pushd src
python -m main -f %~1
popd
pushd src
python -m main
popd

if %USERNAME%==this1 (
pyclean .
)

exit /b 0
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main(self):
super_obf = all_.super_obf
if any([args.file]):
current_time = time.time()
Obfuscator(args.file, double_click_check=False, utf_16_bom=not args.no_utf_16_bom)
Obfuscator(args.file, double_click_check=False, utf_16_bom=False)
finish_time = time.time()
print(f"It only took {finish_time - current_time} to finish!")
return
Expand Down
4 changes: 2 additions & 2 deletions src/util/methods/anti_methods/anti_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def ads_spammer(code: list, *args, **kwargs) -> list:
random_point = make_random_string((5, 6), False)
while random_point in ads_points:
random_point = make_random_string((5, 6), False)
command = f"TO_SCRAMBLE_PLZ{Obfuscate_Single('echo').out()} {line} > %~f0:{random_point}\n"
command = f"%TO_SCRAMBLE_PLZ%{Obfuscate_Single('echo').out()} {line} > %~f0:{random_point}\n"
random_letter = make_random_string((1, 1), False)
out_command = f'TO_SCRAMBLE_PLZfor /f "usebackq delims=φ" %%{random_letter} in (%~f0:{random_point}) do %%{random_letter}\n'
out_command = f'%TO_SCRAMBLE_PLZ%for /f "usebackq delims=φ" %%{random_letter} in (%~f0:{random_point}) do %%{random_letter}\n'

# command = Obfuscate_Single(command, simple=False).out()
# out_command = Obfuscate_Single(out_command, simple=False).out()
Expand Down
2 changes: 1 addition & 1 deletion src/util/methods/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def escape_batch(code: str) -> str:

def random_scramble() -> str:
if random.choice([True, False]):
return "TO_SCRAMBLE_PLZ"
return "%TO_SCRAMBLE_PLZ%"
return ""


Expand Down
4 changes: 2 additions & 2 deletions src/util/methods/custom/parsed_methods/echo_bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def powershell_method_enc(parsed_code: dict) -> str:
@staticmethod
def random_scramble() -> str:
"""
This method returns a string that is either "TO_SCRAMBLE_PLZ" or an empty string, depending on a random chance.
This method returns a string that is either "%TO_SCRAMBLE_PLZ%" or an empty string, depending on a random chance.
"""
random_chance = random.choice([True, False])
if random_chance:
return "TO_SCRAMBLE_PLZ"
return "%TO_SCRAMBLE_PLZ%"
return ""
6 changes: 2 additions & 4 deletions src/util/methods/dead_code/dead_code.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import random
import string

from util.obfuscation.obf_oneline import Obfuscate_Single


class DeadCode:
def dead_code(self) -> str:
Expand All @@ -23,7 +21,7 @@ def dead_code(self) -> str:

choice = random.choice(dead_code_list)()

return f"{DeadCode.random_scramble()}{Obfuscate_Single(choice).out()}"
return f"{DeadCode.random_scramble()}{choice}"

@staticmethod
def doskey() -> str:
Expand Down Expand Up @@ -205,5 +203,5 @@ def better_kill() -> str:
def random_scramble() -> str:
t_f = random.choice([True, False])
if t_f:
return "TO_SCRAMBLE_PLZ"
return "%TO_SCRAMBLE_PLZ%"
return ""
4 changes: 2 additions & 2 deletions src/util/methods/encryption_methods/cesar_cypher.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_random_scramble() -> str:
"""
random_choice = random.choice([True, False])
if random_choice:
return "TO_SCRAMBLE_PLZ"
return "%TO_SCRAMBLE_PLZ%"
return ""


Expand All @@ -93,7 +93,7 @@ def add_on(string: str) -> str:
valid_commands = [
f"for /l %%{CaesarCipherHelper.get_random_string_var(1)} in ({CaesarCipherHelper.get_random_number_var(1, 10)}, {CaesarCipherHelper.get_random_number_var(1, 10)}, {CaesarCipherHelper.get_random_number_var(21, 100)}) do ( {string} )",
# f"for /f %%{CaesarCipherHelper.get_random_string_var(1)} in ('dir /b') do ( {string} )",
# f"",
f"{string}",
]

return random.choice(valid_commands)
Expand Down
43 changes: 28 additions & 15 deletions src/util/methods/math_methods/bit_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def generate_math_problem(self, answer: int) -> tuple:
num1 = num1**count
answer_nums = [num1] + answer_nums

for item in answer_nums:
if isinstance(item, int):
index = answer_nums.index(item)
answer_nums[index] = random_oct_hex(int(item))

result = " * ".join(str(i) for i in answer_nums)

result = result.replace(" ", "")
Expand All @@ -32,9 +37,9 @@ def random_pick(self, num, hex_check=True) -> str:
choices = [
self.make_xor,
self.make_not,
# self.shift_left,
# self.shift_right,
self.random_bit_shift,
]
# chances 2 to 1
return random.choice(choices)(num, hex_check=hex_check)

@staticmethod
Expand All @@ -58,11 +63,14 @@ def make_xor(number: int, hex_check: bool = True) -> str:
fixed2 = random2 ^ ans
if hex_check:
return f"({random_oct_hex(random2)} ^^ {random_oct_hex(fixed2)})"
# random2 = X
# fixed2 = Y
# return f"({random2} ^| {fixed2}) - ({random2} ^& {fixed2})"
else:
return f"({hex(random2)} ^^ {hex(fixed2)})"

@staticmethod
def make_not(number: int, hex_check: bool = True) -> str:
def make_not(number: int, *args, **kwargs) -> str:
"""makes and key"""

ans = number
Expand All @@ -71,24 +79,29 @@ def make_not(number: int, hex_check: bool = True) -> str:
return random_oct_hex(number)

num_return = -ans - 1
return f"~{num_return}"
return f"~{random_oct_hex(num_return)}"

@staticmethod
def random_bit_shift(number: int, hex_check: bool = True) -> str:
"""makes shift left key"""
ans = number

if ans < 0:
return random_oct_hex(number)

random_number_through = random.choice(list(range(2, 10)))

# @staticmethod
# def shift_left(number: int, hex_check: bool = True) -> str:
# """makes shift left key"""
generated = ans << random_number_through

if generated > 25:
generated = Bit_Math.make_xor(generated, hex_check=True)

#
# ans = number
#
# if ans < 0:
# return random_oct_hex(number)
#
# num_return = ans << 1
# return f"{num_return}"
return f"({generated} ^>^> {random_number_through})"


def random_oct_hex(ans: int):
if ans < 3:
return str(ans)
choices = [hex(ans), oct(ans)]
decided = random.choice(choices)
if decided == oct(ans):
Expand Down
38 changes: 19 additions & 19 deletions src/util/obfuscation/obf_oneline.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ def out(self) -> str:
if isinstance(self.code, list):
if self.simple:
for line in self.code:
if "TO_SCRAMBLE_PLZ" in line:
line = line.replace("TO_SCRAMBLE_PLZ", "")
self.out_code += "TO_SCRAMBLE_PLZ" + self.obfuscate_simple(line) + "\n"
if "%TO_SCRAMBLE_PLZ%" in line:
line = line.replace("%TO_SCRAMBLE_PLZ%", "")
self.out_code += "%TO_SCRAMBLE_PLZ%" + self.obfuscate_simple(line) + "\n"
else:
self.out_code += self.obfuscate_simple(line) + "\n"
return self.out_code
else:
for line in self.code:
if "TO_SCRAMBLE_PLZ" in line:
line = line.replace("TO_SCRAMBLE_PLZ", "")
self.out_code += "TO_SCRAMBLE_PLZ" + self.obfuscate_normal(line) + "\n"
if "%TO_SCRAMBLE_PLZ%" in line:
line = line.replace("%TO_SCRAMBLE_PLZ%", "")
self.out_code += "%TO_SCRAMBLE_PLZ%" + self.obfuscate_normal(line) + "\n"
else:
self.out_code += self.obfuscate_normal(line) + "\n"
return self.out_code
Expand All @@ -52,30 +52,30 @@ def out(self) -> str:
if self.code.count("\n") > 1:
self.code = self.code.splitlines()
for line in self.code:
if "TO_SCRAMBLE_PLZ" in line:
line = line.replace("TO_SCRAMBLE_PLZ", "")
self.out_code += "TO_SCRAMBLE_PLZ" + self.obfuscate_simple(line) + "\n"
if "%TO_SCRAMBLE_PLZ%" in line:
line = line.replace("%TO_SCRAMBLE_PLZ%", "")
self.out_code += "%TO_SCRAMBLE_PLZ%" + self.obfuscate_simple(line) + "\n"
else:
self.out_code += self.obfuscate_simple(line) + "\n"
return self.out_code
if "TO_SCRAMBLE_PLZ" in self.code:
self.code = self.code.replace("TO_SCRAMBLE_PLZ", "")
return "TO_SCRAMBLE_PLZ" + self.obfuscate_simple(self.code) + "\n"
if "%TO_SCRAMBLE_PLZ%" in self.code:
self.code = self.code.replace("%TO_SCRAMBLE_PLZ%", "")
return "%TO_SCRAMBLE_PLZ%" + self.obfuscate_simple(self.code) + "\n"
else:
return self.obfuscate_simple(self.code) + "\n"
else:
if self.code.count("\n") > 1:
self.code = self.code.splitlines()
for line in self.code:
if "TO_SCRAMBLE_PLZ" in line:
line = line.replace("TO_SCRAMBLE_PLZ", "")
self.out_code += "TO_SCRAMBLE_PLZ" + self.obfuscate_normal(line) + "\n"
if "%TO_SCRAMBLE_PLZ%" in line:
line = line.replace("%TO_SCRAMBLE_PLZ%", "")
self.out_code += "%TO_SCRAMBLE_PLZ%" + self.obfuscate_normal(line) + "\n"
else:
self.out_code += self.obfuscate_normal(line) + "\n"
return self.out_code
if "TO_SCRAMBLE_PLZ" in self.code:
self.code = self.code.replace("TO_SCRAMBLE_PLZ", "")
return "TO_SCRAMBLE_PLZ" + self.obfuscate_normal(self.code) + "\n"
if "%TO_SCRAMBLE_PLZ%" in self.code:
self.code = self.code.replace("%TO_SCRAMBLE_PLZ%", "")
return "%TO_SCRAMBLE_PLZ%" + self.obfuscate_normal(self.code) + "\n"
else:
return self.obfuscate_normal(self.code) + "\n"

Expand Down Expand Up @@ -187,7 +187,7 @@ def obfuscate_simple(self, char_line: str) -> str:
regex_bat = re.compile(r"\w+=[^=]*%\w+%\b|\w+=[^=]*%\w+%\B")
regex2 = re.compile(r"%(\w+)%")
for word in char_line.split():
if word.startswith("TO_SCRAMBLE_PLZ"):
if word.startswith("%TO_SCRAMBLE_PLZ%"):
final_string += f"{word} "
continue
if word.startswith(":"):
Expand Down
26 changes: 13 additions & 13 deletions src/util/obfuscation/obfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

letter_assignments_cypher = CaesarCipher.both(c_val.value)

code1 = f"TO_SCRAMBLE_PLZ@echo off"
code1 = f"%TO_SCRAMBLE_PLZ%@echo off"
code2 = f"{CaesarCipher.both(c_val.value)}"
code3 = "TO_SCRAMBLE_PLZchcp 65001 > nul"
code3 = "%TO_SCRAMBLE_PLZ%chcp 65001 > nul"

# TO_SCRAMBLE_PLZ
# %TO_SCRAMBLE_PLZ%


class Obfuscator:
Expand Down Expand Up @@ -124,13 +124,13 @@ def obfuscate(self, file):
# if not all_.super_obf:
# f.write(
# Obfuscate_Single(
# f'TO_SCRAMBLE_PLZif not defined KDOT ( set KDOT={random_order} & cmd /c "%~f0" %* )',
# f'%TO_SCRAMBLE_PLZ%if not defined KDOT ( set KDOT={random_order} & cmd /c "%~f0" %* )',
# simple=False,
# ).out()
# + "\n"
# )
# else:
f.write(f"TO_SCRAMBLE_PLZset KDOT={random_order}\n")
f.write(f"%TO_SCRAMBLE_PLZ%set KDOT={random_order}\n")

regex_bat = re.compile(r"\w+=[^=]*%\w+%\b|\w+=[^=]*%\w+%\B")
regex2 = re.compile(r"%(\w+)%")
Expand Down Expand Up @@ -185,7 +185,7 @@ def obfuscate(self, file):
parsed_dict = parsed_line[1]

methods_to_call = {
#"echo": EchoBat.echo_bat,
# "echo": EchoBat.echo_bat,
# "for": ForBat.for_bat,
# "if": IfBat.if_bat,
# "set": SetBat.set_bat,
Expand Down Expand Up @@ -252,9 +252,9 @@ def obfuscate(self, file):

else:
random_obf = [
ran1(char),
# ran1(char),
ran2(char, random_order=random_order),
ran3(char, random_order=random_order),
# ran3(char, random_order=random_order),
]
if "%CAPITALIZATION%" in line:
random_obf.pop(1)
Expand All @@ -276,7 +276,7 @@ def obfuscate(self, file):
# current_code = AntiChanges.ads_spammer(current_code)

if all_.debug:
fuck_up_code = [s.replace("TO_SCRAMBLE_PLZ", "") for s in current_code]
fuck_up_code = [s.replace("%TO_SCRAMBLE_PLZ%", "") for s in current_code]
else:
scrambler = Scrambler()
fuck_up_code = scrambler.scramble(current_code)
Expand Down Expand Up @@ -346,15 +346,15 @@ def convert_code_chunk_and_write_bytes(self, code_chunk: list) -> None:
def add_scramble(code) -> str:
if isinstance(code, list):
for index, item in enumerate(code):
# replace the string with TO_SCRAMBLE_PLZ + the string and apply it to add_scramble
item = item.replace(item, "TO_SCRAMBLE_PLZ" + item)
# replace the string with %TO_SCRAMBLE_PLZ% + the string and apply it to add_scramble
item = item.replace(item, "%TO_SCRAMBLE_PLZ%" + item)
code[index] = item
return "\n".join(code)
else:
code = code.split("\n")
for index, item in enumerate(code):
# replace the string with TO_SCRAMBLE_PLZ + the string and apply it to add_scramble
item = item.replace(item, "TO_SCRAMBLE_PLZ" + item)
# replace the string with %TO_SCRAMBLE_PLZ% + the string and apply it to add_scramble
item = item.replace(item, "%TO_SCRAMBLE_PLZ%" + item)
code[index] = item
return "\n".join(code)

Expand Down
12 changes: 6 additions & 6 deletions src/util/obfuscation/scrambler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def scramble(self, code: list) -> list:
self.code = code
for line in self.code:
# Do other important checks here
if line.startswith("TO_SCRAMBLE_PLZ"):
line2 = line.replace("TO_SCRAMBLE_PLZ", "")
if line.startswith("%TO_SCRAMBLE_PLZ%"):
line2 = line.replace("%TO_SCRAMBLE_PLZ%", "")
output = self.full_scramble(line2)
self.before_code_array.append(output)
continue
Expand All @@ -40,7 +40,7 @@ def scramble(self, code: list) -> list:
self.shuffler(self.after_code_array)

# we need to add "goto :EOF" that way the last line of code doesn't repeat forever
self.before_code_array.append(f"{Obfuscate_Single('goto :EOF').out()}\n")
self.before_code_array.append(f"goto :EOF\n")

self.after_code_array = self.flood(self.after_code_array)

Expand All @@ -66,15 +66,15 @@ def full_scramble(self, line: str) -> str:
math_problem = set_command_values[0]

# first value we add in before code this goes to the code and allows it to go back to the normal part of the script
set_command = Obfuscate_Single(f"set /a ans={math_problem}\ngoto %ans%\n:{self.escape_label}\n").out()
set_command = Obfuscate_Single(f"set /a ans={math_problem}\ngoto %ans%\n:{self.escape_label}\n", simple=False).out()

# first value we add in after code
out_command_values = self.bit_math.generate_math_problem(self.escape_label)
math_problem2 = out_command_values[0]
second_set_command = Obfuscate_Single(f":{pointer_value}\n").out()
second_set_command = Obfuscate_Single(f":{pointer_value}\n", simple=False).out()
lined = f"{line}\n"

last = Obfuscate_Single(f"set /a ans={math_problem2}\n{self.random_anti_method()}goto %ans%\n").out()
last = Obfuscate_Single(f"set /a ans={math_problem2}\n{self.random_anti_method()}goto %ans%\n", simple=False).out()
# we make this a array so we can scramble it later and so it won't interfere with any of the other code and stay in its own place
label_code = [second_set_command + lined + last]

Expand Down
Loading

0 comments on commit 86b743f

Please sign in to comment.