Skip to content

Commit

Permalink
biggest somalifuscator update of all time
Browse files Browse the repository at this point in the history
  • Loading branch information
KingKDot committed Dec 25, 2023
1 parent 01dc6d4 commit fb711e2
Show file tree
Hide file tree
Showing 21 changed files with 351 additions and 462 deletions.
146 changes: 144 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import time
import cProfile

from util.supporting.settings import all_

Expand All @@ -20,7 +21,7 @@
from argparse import ArgumentParser


__version__ = "2.3.0"
__version__ = "2.6.0"


class Main:
Expand Down Expand Up @@ -66,10 +67,151 @@ def main(self):
input("Press any key to exit...")


TIME_CHECK = False

if TIME_CHECK:
parse = ArgumentParser()
parse.add_argument("-f", "--file", help="File to obfuscate", type=str)
parse.add_argument("-nu", "--no-utf-16-bom", help="No UTF-16 BOM", action="store_true")
args = parse.parse_args()
# profile the Main().main() function and show what functions took the longest to execute and write the info to a file
with cProfile.Profile() as pr:
Main().main()
pr.print_stats(sort="cumtime")
with open("profile.txt", "w") as f:
sys.stdout = f
pr.print_stats(sort="time")
sys.exit(0)

if __name__ == "__main__":
parse = ArgumentParser()
parse.add_argument("-f", "--file", help="File to obfuscate", type=str)
parse.add_argument("-nu", "--no-utf-16-bom", help="No UTF-16 BOM", action="store_true")
args = parse.parse_args()
Main().main()
sys.exit(0)

# import os
# import sys
# import time
# import json
# from dataclasses import dataclass
#
# from util.methods.common.common import console
#
# from util.supporting.settings import conf_file
#
# try:
# from tkinter import Tk
# from tkinter import filedialog as fd
# except:
# pass
#
# from rich.align import Align
#
# from textual.app import App, ComposeResult
# from textual.containers import Container, Horizontal, ScrollableContainer
# from textual.widgets import Footer, Header, Button, Static, Placeholder, Pretty, RichLog
# from textual.events import Print
# from textual.reactive import Reactive
# from textual.binding import Binding
# from rich.syntax import Syntax
# from textual import work, events
#
#
# @dataclass
# class settings:
# file: str = ""
# debug: bool = False
#
#
# class Code_Console1(Static):
# code: str = Reactive("test")
#
# def compose(self) -> ComposeResult:
# yield RichLog(highlight=True, markup=True)
#
#
# class Code_Console2(Static):
# def compose(self) -> ComposeResult:
# settings.file = SomalifuscatorV2.get_user_file()
# with open(settings.file, "r") as f:
# code = f.read()
# yield Static(
# Syntax(code, "bat", theme="monokai", line_numbers=True, word_wrap=True),
# )
#
#
# class Obfuscator(Static):
# def compose(self) -> ComposeResult:
# yield Button("Obfuscate", id="start", variant="success")
#
#
# class SomalifuscatorV2(App):
# CSS_PATH = "util\\ui\\style.tcss"
# BINDINGS = [Binding("d", "toggle_debug", "Toggle Debug")]
#
# def on_button_pressed(self, event: Button.Pressed) -> None:
# if event.button.id == "start":
# OBF(settings.file, double_click_check=all_.double_click_check, utf_16_bom=all_.utf_16_bom)
# else:
# print("Unknown button pressed!")
#
# def compose(self) -> ComposeResult:
# yield Header()
# yield Footer()
# with Container(id="MainContainer"):
# yield Horizontal(
# ScrollableContainer(Code_Console1()),
# ScrollableContainer(Code_Console2()),
# )
# yield Obfuscator()
#
# def action_toggle_debug(self) -> None:
# settings.debug = not settings.debug
# print(f"Debug is now {settings.debug}")
#
# def on_print(self, event: Print) -> None:
# # check if any text in events.text is not in string.printable
# # if so, then it's probably a key event
# self.query_one(RichLog).write(event.text)
#
# def on_mount(self) -> None:
# self.run_my_worker()
#
# @work(thread=True)
# def run_my_worker(self):
# self.begin_capture_print(self, True, True)
#
# @staticmethod
# def pretty_print_settings() -> None:
# with open(conf_file, "r") as f:
# settings = json.load(f)
# print(Align.center(f"[cyan]Settings: {conf_file}[/cyan]"))
# print(Align.center(f"[bold white]{'-' * (14 + len(conf_file.strip()))}[/bold white]"))
# for key, value in settings.items():
# print(Align.center(f"[bold white]{key}: [/bold white]{value}"))
#
# @staticmethod
# def get_user_file() -> str:
# """
# Prompts the user to select a batch file.
# Returns the file path of the selected file.
#
# Returns:
# - str: The file path of the selected file.
# """
# file_path = ""
# # keep prompting user until they select a valid file
# root = Tk()
# root.withdraw()
# root.wm_attributes("-topmost", 1)
# while not os.path.isfile(file_path):
# # make sure file is bat file
# file_path = fd.askopenfilename(
# title="Select a batch file",
# filetypes=[("Batch Files", ("*.bat", "*.cmd"))],
# initialdir=os.getcwd(),
# parent=root,
# )
# root.destroy()
# return file_path
43 changes: 10 additions & 33 deletions src/util/methods/anti_methods/anti_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


from util.methods.common.common import make_random_string
from util.obfuscation.obf_oneline import Obfuscate_Single
from util.supporting.settings import all_

checked = False
Expand Down Expand Up @@ -36,8 +35,8 @@ def byte_check(*args, **kwargs) -> str:
"""powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command \"$bytes = [System.IO.File]::ReadAllBytes('%~f0') ; if (($bytes[0] -ne 0xFF) -or ($bytes[1] -ne 0xFE) -or ($bytes[2] -ne 0x26)) { Write-Host 'The first 3 bytes of the file are not FF FE 0A.' ; taskkill /F /IM cmd.exe }\"""",
]

choice = random.choice(choices)
return choice
# choice = random.choice(choices)
return choices[0]

@staticmethod
def vm_test(*args, **kwargs):
Expand All @@ -49,7 +48,8 @@ def vm_test(*args, **kwargs):
# """powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "$tr=(Get-WmiObject Win32_ComputerSystem).TotalPhysicalMemory / 1KB ; $trgb=[math]::Round($tr / 1024, 2) ; if ($trgb -lt 8) { Write-Host 'Less than 8gb ram exiting' ; pause }\""""
]
# ill add more one day
return random.choice(codes)
# return random.choice(codes)
return codes[0]

@staticmethod
def anti_wifi(*args, **kwargs) -> str:
Expand All @@ -64,38 +64,15 @@ def tests(*args, **kwargs):
AntiChanges.first_line_echo_check,
]

if all_.require_wifi:
choices.append(AntiChanges.anti_wifi)
# if all_.require_wifi:
# choices.append(AntiChanges.anti_wifi)
# if all_.utf_16_bom:
# choices.append(AntiChanges.byte_check)

return random.choice(choices)(False)

@staticmethod
def ads_spammer(code: list, *args, **kwargs) -> list:
ads_points = {}
for index, line in enumerate(code):
random_chance = random.randint(1, 10)
if random_chance == 1:
# replace the line with a ads method that points towards its own scramble
line.replace("|", "^|").replace(">", "^>").replace("<", "^<").replace("&", "^&").replace("%", "%%")
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"
random_letter = make_random_string((1, 1), False)
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()

together = command + out_command

print(together)

# replace the current line of code with this and rewrite it
code[index] = together
return code
# return the name of the function used too
choice = random.choice(choices)
output = choice()
return (output, choice.__name__)

@staticmethod
def anti_edit(*args, **kwargs):
Expand Down
47 changes: 19 additions & 28 deletions src/util/methods/common/common.py

Large diffs are not rendered by default.

This file was deleted.

Loading

0 comments on commit fb711e2

Please sign in to comment.