-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhost_payloads.cna
60 lines (41 loc) · 1.26 KB
/
host_payloads.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
#=======================================#
# #
# host payloads script #
# author: karen miller #
# #
#=======================================#
#=======================================================================#
# #
# usage: load this script into cobalt strike #
# in script console run: host_payloads /full/path/to/payloads #
# #
#=======================================================================#
command host_payloads {
local('$handle $data');
if ($1 eq $null || $1 eq "help" || $1 eq "-h" || $1 eq "--h") {
println("\c5 [!] Please provide a full path to the payloads directory (e.g., 'host_payloads /share/Working/payloads').");
}
else {
chdir($1);
@payloads = ls();
if (size(@payloads) > 0) {
foreach $file (@payloads) {
@path = split("/", $file);
$filename = @path[-1];
$uri = "/payloads/$filename";
$handle = openf($file);
if (checkError($error)) {
println("\c5 [!] Could not open file: $error");
}
$data = readb($handle, -1);
closef($handle);
site_host("127.0.0.1", 443, $uri, $data, "", $file, true);
$success = "\c3 [+] $filename has been hosted!";
println($success);
}
}
else {
println("\c5 [!] Files not found. Exiting...");
}
}
}