Update RDP protocol and adding better error message

main
mpgn 2022-03-12 06:54:40 -05:00
parent 3f08b96581
commit bfb40f2d4f
1 changed files with 24 additions and 5 deletions

View File

@ -16,6 +16,10 @@ except ImportError:
logger.setLevel(logging.WARNING) logger.setLevel(logging.WARNING)
rdp_error_status = {
'-1073741711': 'STATUS_PASSWORD_EXPIRED'
}
class rdp(connection): class rdp(connection):
def __init__(self, args, db, host): def __init__(self, args, db, host):
@ -41,6 +45,9 @@ class rdp(connection):
dgroup.add_argument("-d", metavar="DOMAIN", dest='domain', type=str, default=None, help="domain to authenticate to") dgroup.add_argument("-d", metavar="DOMAIN", dest='domain', type=str, default=None, help="domain to authenticate to")
dgroup.add_argument("--local-auth", action='store_true', help='authenticate locally to each target') dgroup.add_argument("--local-auth", action='store_true', help='authenticate locally to each target')
egroup = rdp_parser.add_argument_group("Screenshot", "Remote Desktop Screenshot")
egroup.add_argument("--screenshot", action="store_true", help="Screenshot RDP if connection success")
return parser return parser
def proto_flow(self): def proto_flow(self):
@ -109,12 +116,16 @@ class rdp(connection):
return True return True
except Exception as e: except Exception as e:
#print(e) reason = None
for word in rdp_error_status.keys():
if word in str(e):
reason = rdp_error_status[word]
self.logger.error(u'{}\\{}:{} {}'.format(self.domain, self.logger.error(u'{}\\{}:{} {}'.format(self.domain,
username, username,
password, password,
'({})'.format(e) if "STATUS" in str(e) else ''), '({})'.format(reason) if reason else ''),
color='red' if "CredSSP" in str(e) else 'magenta') color='magenta' if (reason or "CredSSP" not in str(e)) else 'red')
return False return False
def hash_login(self, domain, username, ntlm_hash): def hash_login(self, domain, username, ntlm_hash):
@ -133,10 +144,18 @@ class rdp(connection):
return True return True
except Exception as e: except Exception as e:
reason = None
for word in rdp_error_status.keys():
if word in str(e):
reason = rdp_error_status[word]
self.logger.error(u'{}\\{}:{} {}'.format(self.domain, self.logger.error(u'{}\\{}:{} {}'.format(self.domain,
username, username,
ntlm_hash, ntlm_hash,
'({})'.format(e) if "STATUS" in str(e) else ''), '({})'.format(reason) if reason else ''),
color='red' if "CredSSP" in str(e) else 'magenta') color='magenta' if (reason or "CredSSP" not in str(e)) else 'red')
return False return False
def screenshot(self):
print("screenshot")