-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScenarios.py
More file actions
386 lines (314 loc) · 12.6 KB
/
Copy pathScenarios.py
File metadata and controls
386 lines (314 loc) · 12.6 KB
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
"""
This program uses the modules to run scenarios.
Dependencies:
All modules imported below are required. All required modules can be located on the same gitHub as the scenarios
"""
import audioPlayer, lampControl, utilities,AvacomControl,attacks #required modules
import time # needed to sleep between commands
import datetime
import threading # needed to operate lamp with other devices
from multiprocessing import Process
"""
LOCAL VARIABLES: will need to be updated per device
"""
sudoPwd = "BajaB1@st" # local password to utilize sudo
tpLightIP = "192.168.1.104" #ip of the tp link lamp
avacomIP= "192.168.1.116" #ip of the avacom webcam
ghIP = "192.168.1.112" #ip of the google home
commanderIP = "192.168.1.100" #ip of iot commander
computerIP = "192.168.1.129" #ip of Amazon echo "computer"
"""
Time Keeping File
"""
timeFile = str(datetime.datetime.now()) + "_Scenario_Times.txt"
writeFile = open(timeFile, "w")
writeFile.close()
writeFile = open(timeFile, "a+")
def timeKeeper(moduleName,textFile, mode):
#This functions accepts the name of the module, the name of the text file to write to, and whether the method started or ended and adds the start and end timestamps to a textfile for logging
currentTime = datetime.datetime.now()
#print(currentTime)
#O = open(textFile, "a+")
output = str(moduleName) + " " + mode + " " + str(currentTime) + "\n"
textFile.write(str(output))
#O.close()
#end timeKeeper
def stringCopy(string2Copy): #depricated function used for error resolution
newString = ""
for char in string2Copy:
newString += char
return newString
"""
Wake Up Scenarios
**********************************************************************************************************
"""
def wakeUp():
timeKeeper("WakeUp ", writeFile, "Beginning")
timeKeeper("Light Turning On ", writeFile, "Beginning")
lampControl.lightOn(tpLightIP)
time.sleep(5)
timeKeeper("Querrying Weather on Goolge Home", writeFile, "Beginning")
audioPlayer.ghWeather()
time.sleep(10)
timeKeeper("Alexa turning on music ", writeFile, "Beginning")
audioPlayer.compMusicOn()
time.sleep(5)
timeKeeper("Google home play music video", writeFile, "Beginning")
audioPlayer.ghYoutubeOpen()
time.sleep(5)
timeKeeper("Alexa turn off muisc", writeFile, " ")
audioPlayer.compMusicOff()
time.sleep(5)
timeKeeper("Google home stop playing music", writeFile, " ")
audioPlayer.ghYoutubeClose()
time.sleep(5)
timeKeeper("light turning off", writeFile, " ")
lampControl.lightOff(tpLightIP)
timeKeeper("WakeUp", writeFile, "Ending")
#end wakeUp
def DOSWakeUp(target):
#accepts the IP of the device to attack
dosThread = threading.Thread(target=attacks.hPing3, args = (target, 5000, sudoPwd))
wakeThread = threading.Thread(target = wakeUp, args = ())
wakeThread.start()
timeKeeper("DoS Attack", writeFile, "Beginning")
dosThread.start()
dosThread.join()
wakeThread.join()
timeKeeper("DoS Attack", writeFile, "Ending")
#end DOSWakeUp()
def pingWakeUp(target):
#accepts the IP of the device to attack, the size of the packet, and the number of attacks
attackThread = threading.Thread(target=attacks.avacomPing, args = (str(avacomIP), str(target)))
wakeThread = threading.Thread(target = wakeUp, args = ())
wakeThread.start()
timeKeeper("Ping Attack", writeFile, "Beginning")
attackThread.start()
attackThread.join()
wakeThread.join()
timeKeeper("Ping Attack", writeFile, "Ending")
#end PingWakeUp()
def scanWakeUp(target):
#accepts the IP of the device to scan
#attackThread = threading.Thread(target=attacks.scanning, args = (target))
wakeThread = threading.Thread(target = wakeUp, args = ())
wakeThread.start()
timeKeeper("Scan", writeFile, "Beginning")
attacks.scanning(target)
#attackThread.start()
#attackThread.join()
wakeThread.join()
timeKeeper("Scan", writeFile, "Ending")
def bruteForceWakeUp(target, pwdFile):
attackThread = threading.Thread(target = attacks.bruteForce, args = (target, pwdFile, sudoPwd))
wakeUpThread = threading.Thread(target = wakeUp, args = ())
wakeUpThread.start()
timeKeeper(("Brute Force Attack on" + str(target)), writeFile, "Beginning")
attackThread.start()
attackThread.join()
wakeUpThread.join()
timeKeeper("Brute Force Attack", writeFile, "Ending")
#end scanWakeUp()
"""
House Party Scenarios
**********************************************************************************************************
"""
def houseParty():
timeKeeper("House Party", writeFile, "Beginning")
lampThread= threading.Thread(target = lampControl.strobeLight, args=(tpLightIP,10))
browser = AvacomControl.accessAvacomWebPortal(avacomIP)
time.sleep(5)
timeKeeper("Strobe Light ", writeFile, "Beginning")
lampThread.start()
timeKeeper("Alexa play music ", writeFile, "Beginning")
audioPlayer.compMusicOn()
time.sleep(5)
timeKeeper("Google home open youtube", writeFile, "Beginning")
audioPlayer.ghYoutubeOpen()
timeKeeper("Avacom horizontal panning", writeFile, "Beginning")
AvacomControl.avacomHorizPan(browser, 2)
timeKeeper("avacom horizontal panning", writeFile, "ending")
lampThread.join(5)
timeKeeper("strobe light ", writeFile, "ending")
time.sleep(5)
timeKeeper("google home close youtube ", writeFile, " ")
audioPlayer.ghYoutubeClose()
time.sleep(5)
timeKeeper("computer turn off music ", writeFile, " ")
audioPlayer.compMusicOff()
time.sleep(2)
timeKeeper("House Party", writeFile, "Ending")
browser.close()
#end houseParty
def scanHouseParty(target):
#accepts the IP of the device to scan
#attackThread = threading.Thread(target=attacks.scanning, args = (target))
housePartyThread = threading.Thread(target = houseParty, args = ())
housePartyThread.start()
timeKeeper("Scan", writeFile, "Begining")
attacks.scanning(target)
#attackThread.start()
#attackThread.join()
housePartyThread.join()
timeKeeper("Scan", writeFile, "Ending")
#end scanHouseParty()
def pingHouseParty(target):
#accepts the IP of the device to ping
attackThread = threading.Thread(target=attacks.avacomPing, args = (str(avacomIP), str(target)))
housePartyThread = threading.Thread(target = houseParty, args = ())
housePartyThread.start()
timeKeeper("Ping Attack", writeFile, "Beginning")
attackThread.start()
attackThread.join()
housePartyThread.join()
timeKeeper("Ping", writeFile, "Ending")
#end pingHouseParty()
def DOSHouseParty(target):
#accepts the IP of the device to DOS
timeKeeper("DoS Attack", writeFile, "Beginning")
attackThread = threading.Thread(target=attacks.hPing3, args = (target, 5000, sudoPwd))
housePartyThread = threading.Thread(target = houseParty, args = ())
housePartyThread.start()
attackThread.start()
attackThread.join()
housePartyThread.join()
timeKeeper("Dos Attack", writeFile, "Ending")
#end DOSHouseParty()
def bruteForceHouseParty(target, pwdFile):
attackThread = threading.Thread(target = attacks.bruteForce, args = (target, pwdFile, sudoPwd))
partyThread = threading.Thread(target = houseParty, args = ())
partyThread.start()
timeKeeper(("Brute Force Attack on" + str(target)), writeFile, "Beginning")
attackThread.start()
attackThread.join()
partyThread.join()
timeKeeper("Brute Force Attack", writeFile, "Ending")
#end bruteForceHouseParty
"""
Enterprise Normal Business Hours Scenarios
**********************************************************************************************************
"""
def enterpriseNormalHours():
timeKeeper("Enterprise Normal Businesss Hours", writeFile, "Begining")
browser = AvacomControl.accessAvacomWebPortal(avacomIP)
time.sleep(5)
timeKeeper("Light Turned on", writeFile, " ")
lampControl.lightOn(tpLightIP)
timeKeeper("Avacom horizontal pan", writeFile, "Beginning")
AvacomControl.avacomHorizPan(browser, 2)
timeKeeper("Avacom horizontal pan", writeFile, "Ending")
browser.close()
timeKeeper("Enterprise Normal Business Hours", writeFile, "Ending")
#end enterpriseNormalHours
def scanEntNH(target):
#accepts the IP of the device to scan
#attackThread = threading.Thread(target=attacks.scanning, args = (target))
entNHThread = threading.Thread(target = enterpriseNormalHours, args = ())
entNHThread.start()
timeKeeper("Scan", writeFile, "Beginning")
attacks.scanning(target)
#attackThread.start()
#attackThread.join()
entNHThread.join()
timeKeeper("Scan", writeFile, "Ending")
#end scaneEntNH()
def pingEntNH(target):
#accepts the IP of the device to scan
attackThread = threading.Thread(target=attacks.avacomPing, args = (str(avacomIP), str(target)))
entNHThread = threading.Thread(target = enterpriseNormalHours, args = ())
entNHThread.start()
timeKeeper("Ping Attack", writeFile, "Beginning")
attackThread.start()
attackThread.join()
entNHThread.join()
timeKeeper("Ping Attack", writeFile, "Ending")
#end pingEntNH()
def DOSEntNH(target):
#accepts the IP of the device to scan
attackThread = threading.Thread(target=attacks.hPing3, args = (target, 5000, sudoPwd))
entNHThread = threading.Thread(target = enterpriseNormalHours, args = ())
entNHThread.start()
timeKeeper("DoS Attack", writeFile, "Beginning")
attackThread.start()
attackThread.join()
entNHThread.join()
timeKeeper("DoS Attack", writeFile, "Ending")
#end DOSEntNH()
"""
Enterprise After Hours Scenarios
**********************************************************************************************************
"""
def enterpriseAfterHours():
timeKeeper("Enterprise After Hours", writeFile, "Begining")
print("starting")
#Browser setup
browser = AvacomControl.accessAvacomWebPortal(avacomIP)
time.sleep(10)
#cameraThread = threading.Thread(target = AvacomControl.avacomHorizPan, args = (avacomIP, 10))
#cameraThread.start()
timeKeeper("Turning light of ", writeFile, " ")
lampControl.lightOff(tpLightIP)
timeKeeper("Avacom Horizontal Pan ", writeFile, "Beginning")
AvacomControl.avacomHorizPan(browser,5)
timeKeeper("Avacom Horizontal Pan ", writeFile, "Ending")
timeKeeper("Avacom Vertical Pan ", writeFile, "Beginning")
AvacomControl.avacomVertPan(browser,5)
timeKeeper("Avacom Vertical Pan ", writeFile, "Ending")
#cameraThread.join()
browser.close()
timeKeeper("Enterprise After Hours", writeFile, "Ending")
#end enterpriseAfterHours
def scanEntAf(target):
#accepts the IP of the device to scan
entAfThread = threading.Thread(target = enterpriseAfterHours, args = ())
#attackThread = threading.Thread(target=attacks.scanning, args = (target))
entAfThread.start()
timeKeeper(("Scan on " + str(target)), writeFile, " Beginning")
attacks.scanning(target)
#attackThread.start()
#attackThread.join()
timeKeeper("Scan", writeFile, "Ending")
entAfThread.join()
#end scanEntAf()
def pingEntAf(target):
#accepts the IP of the device to scan
attackThread = threading.Thread(target=attacks.avacomPing, args = (str(avacomIP), str(target)))
entAfThread = threading.Thread(target = enterpriseAfterHours, args = ())
entAfThread.start()
timeKeeper(("Ping Attack on " + str(target)), writeFile, "Beginning")
attackThread.start()
attackThread.join()
entAfThread.join()
timeKeeper("Ping Attack", writeFile, "Ending")
#end pingEntAf()
def DOSEntAf(target):
#accepts the IP of the device to scan
attackThread = threading.Thread(target=attacks.hPing3, args = (target, 5000, sudoPwd))
entAfThread = threading.Thread(target = enterpriseAfterHours, args = ())
entAfThread.start()
timeKeeper(("DOS Attack on" + str(target)), writeFile, "Beginning")
attackThread.start()
attackThread.join()
entAfThread.join()
timeKeeper("DOS Attack", writeFile, "Ending")
#end DOSEntAf()
def bruteForceEntAf(target, pwdFile):
attackThread = threading.Thread(target = attacks.bruteForce, args = (target, pwdFile, sudoPwd))
entAfThread = threading.Thread(target = enterpriseAfterHours, args = ())
entAfThread.start()
timeKeeper(("Brute Force Attack on" + str(target)), writeFile, "Beginning")
attackThread.start()
attackThread.join()
entAfThread.join()
timeKeeper("Brute Force Attack", writeFile, "Ending")
#end bruteForceEntAf
#example code to run the scenario with 20 second breaks between runs
wakeUp()
time.sleep(20)
DOSWakeUp(ghIP)
time.sleep(20)
scanWakeUp(ghIP)
time.sleep(20)
pingWakeUp(ghIP)
time.sleep(20)
bruteForceWakeUp(ghIP,"pwds.txt")