Skip to content

Commit

Permalink
Fix #138 to add dcom_login module
Browse files Browse the repository at this point in the history
  • Loading branch information
lanjelot committed Jul 21, 2020
1 parent da3d975 commit eb7ac4b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
37 changes: 36 additions & 1 deletion patator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
+ pop_passd : Brute-force poppassd (http://netwinsite.com/poppassd/)
+ imap_login : Brute-force IMAP4
+ ldap_login : Brute-force LDAP
+ dcom_login : Brute-force DCOM
+ smb_login : Brute-force SMB
+ smb_lookupsid : Brute-force SMB SID-lookup
+ rlogin_login : Brute-force rlogin
Expand Down Expand Up @@ -2856,6 +2857,39 @@ def execute(self, host, port='79', user='', timeout='5'):
resp.lines = [l.strip('\r\n') for l in mesg.split('\n')]

return resp
# }}}

# DCOM {{{
from impacket.dcerpc.v5.dcomrt import DCOMConnection
from impacket.dcerpc.v5.dcom import wmi

class DCOM_login:
'''Brute-force DCOM'''

usage_hints = (
"""%prog host=10.0.0.1 user='admin' password=FILE0 0=passwords.txt""",
)

available_options = (
('host', 'target host'),
('user', 'usernames to test'),
('password', 'passwords to test'),
('domain', 'domains to test'),
)
available_actions = ()

Response = Response_Base

def execute(self, host, user='', password='', domain=''):
dcom = DCOMConnection(host, user, password, domain)
try:
with Timing() as timing:
iInterface = dcom.CoCreateInstanceEx(wmi.CLSID_WbemLevel1Login,wmi.IID_IWbemLevel1Login)
code, mesg = 0, 'OK'
except Exception as e:
code, mesg = 1, e.error_string
dcom.disconnect()
return self.Response(code, mesg, timing)

# }}}

Expand Down Expand Up @@ -5077,6 +5111,7 @@ def execute(self, data, data2='', delay='1'):
('pop_passd', (Controller, POP_passd)),
('imap_login', (Controller, IMAP_login)),
('ldap_login', (Controller, LDAP_login)),
('dcom_login', (Controller, DCOM_login)),
('smb_login', (Controller, SMB_login)),
('smb_lookupsid', (Controller, SMB_lookupsid)),
('rlogin_login', (Controller, Rlogin_login)),
Expand Down Expand Up @@ -5109,7 +5144,7 @@ def execute(self, data, data2='', delay='1'):
'libcurl': [('http_fuzz', 'rdp_gateway'), 'https://curl.haxx.se/', '7.58.0'],
'ajpy': [('ajp_fuzz',), 'https://github.com/hypn0s/AJPy/', '0.0.4'],
'openldap': [('ldap_login',), 'http://www.openldap.org/', '2.4.45'],
'impacket': [('smb_login', 'smb_lookupsid', 'mssql_login'), 'https://github.com/CoreSecurity/impacket', '0.9.20'],
'impacket': [('smb_login', 'smb_lookupsid', 'dcom_login', 'mssql_login'), 'https://github.com/CoreSecurity/impacket', '0.9.20'],
'pyopenssl': [('mssql_login',), 'https://pyopenssl.org/', '19.1.0'],
'cx_Oracle': [('oracle_login',), 'http://cx-oracle.sourceforge.net/', '7.3.0'],
'mysqlclient': [('mysql_login',), 'https://github.com/PyMySQL/mysqlclient-python', '1.4.6'],
Expand Down
5 changes: 5 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

if ! type docker-compose 2>/dev/null; then
echo 'docker-compose is required'
exit 1
fi

case "$1" in
python2|python3)
PYTHON=$1
Expand Down
1 change: 0 additions & 1 deletion testing/unix/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ socat tcp-l:4444,fork,reuseaddr exec:\"echo -e 'W\xe1\xc0me'\" &\n\
cp -v /root/enc.zip /root/keystore.jks /root/enc.db /root/umbraco_users.pw /opt/patator/\n\
su - vncuser -c 'vncserver -rfbport 5900'\n\
service smbd start\n\
touch /opt/patator/.all-started\n\
tail -f /dev/null\n" > /usr/local/sbin/start-all-services.sh

CMD ["bash", "/usr/local/sbin/start-all-services.sh"]

0 comments on commit eb7ac4b

Please sign in to comment.