Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cobalt Strike Team Server support #121

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Currently it supports the following modules:
* rdp_login : Brute-force RDP (NLA)
* pgsql_login : Brute-force PostgreSQL
* vnc_login : Brute-force VNC
* cs_login : Brute-force Cobalt Strike Team Server
* dns_forward : Brute-force DNS
* dns_reverse : Brute-force DNS (reverse lookup subnets)
* ike_enum : Enumerate IKE transforms
Expand Down
55 changes: 55 additions & 0 deletions patator.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
* rdp_login : Brute-force RDP (NLA)
+ pgsql_login : Brute-force PostgreSQL
+ vnc_login : Brute-force VNC
+ cs_login : Brute-force Cobalt Strike Team Server

+ dns_forward : Forward DNS lookup
+ dns_reverse : Reverse DNS lookup
Expand Down Expand Up @@ -529,6 +530,15 @@
vnc_login host=10.0.0.1 password=FILE0 0=passwords.txt --threads 1
-x retry:fgrep!='Authentication failure' --max-retries -1 -x quit:code=0
(b) (b) (c)
}}}
{{{ CS

* Brute-force Cobalt Strike Team Server authentication.

---------

cs_login host=10.0.0.1 password=FILE0 0=rockyou.txt -t 1 -x 'quit:code=0'

}}}
{{{ DNS

Expand Down Expand Up @@ -4085,6 +4095,50 @@ def execute(self, host, port=None, password=None, timeout='10'):

# }}}

# CS {{{
try:
import ssl, struct
except ImportError:
notfound.append('ssl or struct')

class CS_login:
'''Brute-force CS'''

usage_hints = (
'''%prog host=10.0.0.1 password=FILE0 0=rockyou.txt -t 1 -x 'quit:code=0' ''',
)

available_options = (
('host', 'target host'),
('port', 'target port [50050]'),
('password', 'passwords to test'),
('timeout', 'seconds to wait for a response [10]')
)
available_actions = ()

Response = Response_Base

def execute(self, host, port=50050, password=None, timeout='10'):
with Timing() as timing:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(int(timeout))
ss = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1_2)
addr = (host, int(port))
ss.connect(addr)
password_len = struct.pack('b', len(password))
req = b'\x00\x00\xbe\xef' + password_len + password.encode('utf8') + b'A' * 255
ss.send(req)
r1 = ss.recv(1)
r2 = ss.recv(1)
r3 = ss.recv(1)
ss.close()
if(r3 == b'\xca'):
code, mesg = 0, 'OK'
else:
code, mesg = 1, 'CS auth failed'
return self.Response(code, mesg, timing)
# }}}

# DNS {{{
try:
import dns.rdatatype
Expand Down Expand Up @@ -4862,6 +4916,7 @@ def execute(self, data, data2='', delay='1'):
('rdp_login', (Controller, RDP_login)),
('pgsql_login', (Controller, Pgsql_login)),
('vnc_login', (Controller, VNC_login)),
('cs_login', (Controller, CS_login)),

('dns_forward', (Controller_DNS, DNS_forward)),
('dns_reverse', (Controller_DNS, DNS_reverse)),
Expand Down