Fix wrongly displayed domain when using winrm and remove duplicate statement
parent
04b0b3aa6b
commit
0917a05188
|
@ -25,7 +25,8 @@ urllib3.disable_warnings()
|
||||||
|
|
||||||
class winrm(connection):
|
class winrm(connection):
|
||||||
def __init__(self, args, db, host):
|
def __init__(self, args, db, host):
|
||||||
self.domain = None
|
self.domain = ""
|
||||||
|
self.targedDomain = ""
|
||||||
self.server_os = None
|
self.server_os = None
|
||||||
self.output_filename = None
|
self.output_filename = None
|
||||||
self.endpoint = None
|
self.endpoint = None
|
||||||
|
@ -52,30 +53,24 @@ class winrm(connection):
|
||||||
|
|
||||||
def enum_host_info(self):
|
def enum_host_info(self):
|
||||||
ntlm_info = parse_challenge(base64.b64decode(self.challenge_header.split(" ")[1].replace(",", "")))
|
ntlm_info = parse_challenge(base64.b64decode(self.challenge_header.split(" ")[1].replace(",", "")))
|
||||||
self.domain = ntlm_info["domain"]
|
self.targetDomain = self.domain = ntlm_info["domain"]
|
||||||
self.hostname = ntlm_info["hostname"]
|
self.hostname = ntlm_info["hostname"]
|
||||||
self.server_os = ntlm_info["os_version"]
|
self.server_os = ntlm_info["os_version"]
|
||||||
self.logger.extra["hostname"] = self.hostname
|
self.logger.extra["hostname"] = self.hostname
|
||||||
|
|
||||||
self.output_filename = os.path.expanduser(f"~/.nxc/logs/{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}")
|
self.db.add_host(self.host, self.port, self.hostname, self.targetDomain, self.server_os)
|
||||||
|
|
||||||
self.db.add_host(self.host, self.port, self.hostname, self.domain, self.server_os)
|
|
||||||
|
|
||||||
if self.args.domain:
|
if self.args.domain:
|
||||||
self.domain = self.args.domain
|
self.domain = self.args.domain
|
||||||
|
|
||||||
if self.args.local_auth:
|
if self.args.local_auth:
|
||||||
self.domain = self.hostname
|
self.domain = self.hostname
|
||||||
|
|
||||||
if self.domain is None:
|
|
||||||
self.domain = ""
|
|
||||||
|
|
||||||
self.output_filename = os.path.expanduser(f"~/.nxc/logs/{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-"))
|
self.output_filename = os.path.expanduser(f"~/.nxc/logs/{self.hostname}_{self.host}_{datetime.now().strftime('%Y-%m-%d_%H%M%S')}".replace(":", "-"))
|
||||||
|
|
||||||
def print_host_info(self):
|
def print_host_info(self):
|
||||||
self.logger.extra["protocol"] = "WINRM-SSL" if self.ssl else "WINRM"
|
self.logger.extra["protocol"] = "WINRM-SSL" if self.ssl else "WINRM"
|
||||||
self.logger.extra["port"] = self.port
|
self.logger.extra["port"] = self.port
|
||||||
self.logger.display(f"{self.server_os} (name:{self.hostname}) (domain:{self.domain})")
|
self.logger.display(f"{self.server_os} (name:{self.hostname}) (domain:{self.targetDomain})")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue