-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathexample.py
53 lines (44 loc) · 1.46 KB
/
example.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
#!/usr/local/bin/python3
## Import the bridge
from sleep_python_bridge.striker import CSConnector
from argparse import ArgumentParser
from pprint import pp, pprint
###################
## Argparse
def parseArguments():
parser = ArgumentParser()
parser.add_argument('host', help='The teamserver host.')
parser.add_argument('port', help='The teamserver port.')
parser.add_argument('username', help='The desired username.')
parser.add_argument('password', help='The teamserver password.')
parser.add_argument('path', help="Directory to CobaltStrike")
args = parser.parse_args()
return args
## Let's go
def main(args):
cs_host = args.host
cs_port = args.port
cs_user = args.username
cs_pass = args.password
cs_directory = args.path
## Connect to server
print(f"[*] Connecting to teamserver: {cs_host}")
with CSConnector(
cs_host=cs_host,
cs_port=cs_port,
cs_user=cs_user,
cs_pass=cs_pass,
cs_directory=cs_directory) as cs:
# Perform some actions
#
# Get beacon metadata - i.e., x beacons() from the script console
beacons = cs.get_beacons()
print("BEACONS")
pprint(beacons)
# Get list of listners - i.e., x listeners_stageless() from the script console
listeners = cs.get_listeners_stageless()
print("LISTENERS")
pprint(listeners)
if __name__ == "__main__":
args = parseArguments()
main(args)