-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbatch_gui.py
More file actions
executable file
·107 lines (85 loc) · 2.73 KB
/
batch_gui.py
File metadata and controls
executable file
·107 lines (85 loc) · 2.73 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
#!/usr/bin/env python3
import sys
import utils
sys.path.insert(0, utils.basedir('pycobalt'))
import time
import pycobalt.engine as engine
import pycobalt.aggressor as aggressor
import pycobalt.helpers as helpers
import pycobalt.events as events
import pycobalt.gui as gui
import sleep
import cleanup
def sleep_callback(bids):
def finish(text):
parts = text.split()
# sleep
pretty_time = parts[0]
# jitter
if len(parts) > 1:
jitter = int(parts[1])
else:
jitter = 30
for bid in bids:
aggressor.btask(bid, 'sl {} {}'.format(pretty_time, jitter))
sleep.sleep(bid, pretty_time, jitter)
aggressor.prompt_text('sleep [jitter=30]', '', finish)
def shell_callback(bids):
def finish(text):
for bid in bids:
aggressor.bshell(bid, text)
aggressor.prompt_text('Shell command', '', finish)
def powerpick_callback(bids):
def finish(text):
for bid in bids:
aggressor.bpowerpick(bid, text)
aggressor.prompt_text('Powerpick command', '', finish)
def alias_callback(bids):
def finish(text):
if ' ' in text:
parts = text.split(' ')
alias = parts[0]
args = ' '.join(parts[1:])
else:
alias = text
args = ''
for bid in bids:
aggressor.binput(bid, text)
aggressor.fireAlias(bid, alias, args)
# I think fireAlias is broken somewhere. possibly on cobaltstrike's side?
time.sleep(0.5)
aggressor.prompt_text('Alias command', '', finish)
def eval_callback(bids):
def finish(text):
for bid in bids:
code = '$bid = {}; $b = $bid; '.format(bid) + text
aggressor.binput(bid, 'eval ' + text)
engine.eval(code)
aggressor.prompt_text('Eval code ($bid and $b will be set to the bid)', '', finish)
def clear_callback(bids):
for bid in bids:
aggressor.bclear(bid)
def caffeinate_callback(bids):
for bid in bids:
aggressor.bsleep(bid, 0, 0)
def suicide_callback(bids, b=None, c=None):
engine.message('bc')
engine.message(b)
engine.message(c)
for bid in bids:
cleanup.suicide(bid)
menu = gui.popup('beacon_bottom', children=[
gui.menu('&Batch', children=[
gui.item('&Sleep', sleep_callback),
gui.separator(),
gui.item('&Shell', shell_callback),
gui.item('&Powerpick', powerpick_callback),
gui.item('&Alias', alias_callback),
gui.item('&Eval', eval_callback),
gui.separator(),
gui.item('&Clear', clear_callback),
gui.item('&Caffeinate', caffeinate_callback),
gui.item('&Suicide', suicide_callback),
])
])
gui.register(menu)