-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdeckbuilder.cna
330 lines (222 loc) · 5.22 KB
/
deckbuilder.cna
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
#deckbuilder -- an argument spoofer tool to be used with the argue command in Cobaltstrike
#Cobaltstrike version required: 3.13+
#author: Christopher Cottrell (@1c3be4r)
# Hate (my) comments? sed -i 's/^#/d' deckbuilder.cna
# Shuffle is the main function of this script. It will iterate through the @commands list and crank out some funky stuff
alias shuffle {
$bid = $1;
@collector = @("");
foreach $cmd (@commands) {
#initializing stuff
$temp = '';
($cmdsplit, $null) = split('\.', $cmd); #splitting so you get both cmd.exe and just cmd
$rand2 = '';
$argargs = '';
$argoutput = '';
$basepath = '';
$filename = '';
$ext = '';
# an int is returned from randomizer()
$rand2 = randomizer();
$argargs = argpopper(); #generating our spoofed args
$argoutput = rand(@arg_output); #picking a random io redirection technique
$basepath = rand(@arg_basepath); #picking a random file path
$filename = rand(@arg_filename); #generating random filename
$ext = rand(@arg_ext); #picking a random extension
push(@collector, %(cmd => "$cmdsplit", entry => "$argargs$argoutput$basepath$filename$rand2$ext"));
push(@collector, %(cmd => "$cmd", entry => "$argargs$argoutput$basepath$filename$rand2$ext"));
};
#looping through @collector and pushing out our stuff
foreach $line (@collector){
bargue_add($bid, "$line['cmd']", "$line['entry']");
};
#listing everything afterwards so we can see the finished product
bargue_list($bid);
};
#this alias works just like &shuffle, but will take a single argument to spoof (entered by you: cmd.exe, wmic.exe, uploadedbinary.exe)
alias mulligan {
$bid = $1;
redraw($2);
}
sub redraw {
$temp = '';
($cmdsplit, $null) = split('\.', $1);
$rand2 = '';
$argargs = '';
$argoutput = '';
$basepath = '';
$filename = '';
$ext = '';
$rand2 = randomizer(); # an int returned from randomizer(@numberrand)
$argargs = argpopper();
$argoutput = rand(@arg_output);
$basepath = rand(@arg_basepath);
$filename = rand(@arg_filename);
$ext = rand(@arg_ext);
bargue_add($bid, "$cmdsplit", "$argargs$argoutput$basepath$filename$rand2$ext");
bargue_add($bid, "$1", "$argargs$argoutput$basepath$filename$rand2$ext");
};
#this function spits out a randomized number (seeded by @numberrand) in an int format
sub randomizer {
$x = '';
$xx = '';
$xxx = '';
$x = rand(@numberrand);
nullzero($x, @numberrand); #nullzero takes two args: the original arg and a backup arg incase the value of the first is 0
$xx = int($x);
$xxx = rand($xx);
return $xxx;
};
#this function will ensure that numbers randomized aren't 0
sub nullzero {
$redo = "";
$redo = $1;
$numtwo = '';
$numtwo = $2; #this will be 7 for argpopper
while ($redo == 0){
$redo = rand($numtwo); #for argpopper this will always be an int
}
if ( $redo == 0) {
nullzero($1, $2);
} else {
$x = '';
$xx = '';
$x = int($redo);
$xx = rand($x);
return $xx;
}
};
#this function is what generates the spoofed arguments
sub argpopper {
$argnum = "";
$cleanrand = "";
$argnum = rand(7);
$cleanrand = nullzero($argnum, 7);
@cleanarg = @("");
$alldone = "";
$argcatcher = @();
@cleanarg = @argargs;
while ( $cleanrand > 0 ) {
$temp = rand(@cleanarg); #copy the list to here so we can muck with it
if ($temp ismatch '.+='){ #using a regex matcher to match anything that any number of characters that ENDS with a =
$numtempb = rand(@numberrand);
$numtemp = nullzero($numtempb,$numtempb);
push (@argcatcher, "$temp$numtemp ");
} else {
push (@argcatcher, "$temp");
};
$cleanrand--;
};
$alldone = join('', @argcatcher);
@argcatcher = @('');
return $alldone;
};
# sometimes you just need to turn it off. Will only turn off what is in @commands, not extra commands added in via &mulligan
alias argue_off {
$bid = $1;
foreach $cmd (@commands){
($cmdsplit, $null) = split('\.', $cmd);
bargue_remove($bid, "$cmd");
bargue_remove($bid, "$cmdsplit");
};
};
# LISTS AND DATA GO BELOW THIS LINE
# [--------------------------------]
@arg_output = @(
"",
"\> ",
"\>\> ",
"\| "
"\< "
);
@argargs = @(
"-a ",
"-n ",
"-r ",
"-t ",
"--type=renderer ",
"\-\-field-trial-handle\=",
"--service-pipe-token\=",
"--lang=en-US ",
"--extension-process ",
"--extension-process\=",
"--enable-offline-auto-reload "
);
#unused currently in this script
@arg_net = @(
'8.8.8.8 ',
'8.8.4.4',
'google.com',
'www.google.com',
'localhost',
'127.0.0.1'
);
@arg_basepath = @(
".\\",
"c:\\windows\\",
"C:\\Windows\\",
"C:\\WINDOWS\\",
"c:\\program files\\",
"C:\\Program Files\\",
"C:\\PROGRAM FILES\\",
"c:\\program files (x86)\\",
"C:\\Program Files (x86)\\",
"C:\\PROGRAM FILES (x86)\\",
"%windir%\\",
"%WINDIR%\\",
"%appdata%\\",
"%APPDATA%\\",
"%systemroot%\\",
"%SYSTEMROOT%\\",
"%temp%\\",
"%TEMP%\\"
);
@arg_filename = @(
"",
"output_",
"file_",
"output",
"_output",
"file",
"_file",
"report_",
"report",
"_report",
"db",
"db_",
"_db",
"scan",
"scan_",
"_scan"
);
@arg_ext = @(
".txt",
".csv",
".zip",
".7z",
".doc",
".vbe",
".wsf",
".msc",
);
@numberrand = @(
9,
99,
999,
9999,
99999,
999999,
9999999
);
@commands = @(
"cmd.exe",
"reg.exe",
"wmic.exe",
"ipconfig.exe",
"ping.exe",
"netstat.exe",
"nbtstat.exe",
"nslookup.exe",
"tasklist.exe",
"dir.exe"
);