mirror of
https://github.com/Pennyw0rth/NetExec
synced 2026-06-06 16:34:30 +00:00
Add color when smb status is not ACCESS_DENIED #391
This commit is contained in:
+2
-2
@@ -69,8 +69,8 @@ class CMEAdapter(logging.LoggerAdapter):
|
||||
msg, kwargs = self.process(u'{} {}'.format(colored("[*]", 'blue', attrs=['bold']), msg), kwargs)
|
||||
self.logger.info(msg, *args, **kwargs)
|
||||
|
||||
def error(self, msg, *args, **kwargs):
|
||||
msg, kwargs = self.process(u'{} {}'.format(colored("[-]", 'red', attrs=['bold']), msg), kwargs)
|
||||
def error(self, msg, color='red', *args, **kwargs):
|
||||
msg, kwargs = self.process(u'{} {}'.format(colored("[-]", color, attrs=['bold']), msg), kwargs)
|
||||
self.logger.error(msg, *args, **kwargs)
|
||||
|
||||
def debug(self, msg, *args, **kwargs):
|
||||
|
||||
+16
-4
@@ -38,6 +38,17 @@ from traceback import format_exc
|
||||
smb_share_name = gen_random_string(5).upper()
|
||||
smb_server = None
|
||||
|
||||
smb_error_status = [
|
||||
"STATUS_ACCOUNT_DISABLED",
|
||||
"STATUS_ACCOUNT_EXPIRED",
|
||||
"STATUS_ACCOUNT_RESTRICTION",
|
||||
"STATUS_INVALID_LOGON_HOURS",
|
||||
"STATUS_INVALID_WORKSTATION",
|
||||
"STATUS_LOGON_TYPE_NOT_GRANTED",
|
||||
"STATUS_PASSWORD_EXPIRED",
|
||||
"STATUS_PASSWORD_MUST_CHANGE"
|
||||
]
|
||||
|
||||
def requires_smb_server(func):
|
||||
def _decorator(self, *args, **kwargs):
|
||||
global smb_server
|
||||
@@ -90,7 +101,6 @@ def requires_smb_server(func):
|
||||
|
||||
return wraps(func)(_decorator)
|
||||
|
||||
|
||||
class smb(connection):
|
||||
|
||||
def __init__(self, args, db, host):
|
||||
@@ -318,7 +328,8 @@ class smb(connection):
|
||||
username,
|
||||
password,
|
||||
error,
|
||||
'({})'.format(desc) if self.args.verbose else ''))
|
||||
'({})'.format(desc) if self.args.verbose else ''),
|
||||
color='magenta' if error in smb_error_status else 'red')
|
||||
|
||||
if error == 'STATUS_LOGON_FAILURE': self.inc_failed_login(username)
|
||||
|
||||
@@ -366,11 +377,12 @@ class smb(connection):
|
||||
self.create_conn_obj()
|
||||
except SessionError as e:
|
||||
error, desc = e.getErrorString()
|
||||
self.logger.error(u'{}\\{} {} {} {}'.format(domain,
|
||||
self.logger.error(u'{}\\{}:{} {} {}'.format(domain,
|
||||
username,
|
||||
ntlm_hash,
|
||||
error,
|
||||
'({})'.format(desc) if self.args.verbose else ''))
|
||||
'({})'.format(desc) if self.args.verbose else ''),
|
||||
color='magenta' if error in smb_error_status else 'red')
|
||||
|
||||
if error == 'STATUS_LOGON_FAILURE': self.inc_failed_login(username)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user