Skip to content

Commit 8af4bfa

Browse files
authored
Merge pull request Pennyw0rth#856 from Pennyw0rth/guest
2 parents 5f29dd0 + 020e5a1 commit 8af4bfa

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

nxc/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
reveal_chars_of_pwd = int(nxc_config.get("nxc", "reveal_chars_of_pwd", fallback=0))
3838
config_log = nxc_config.getboolean("nxc", "log_mode", fallback=False)
3939
host_info_colors = literal_eval(nxc_config.get("nxc", "host_info_colors", fallback=["green", "red", "yellow", "cyan"]))
40-
40+
check_guest_account = nxc_config.getboolean("nxc", "check_guest_account", fallback=False)
4141

4242
if len(host_info_colors) != 4:
4343
nxc_logger.error("Config option host_info_colors must have 4 values! Using default values.")

nxc/data/nxc.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ audit_mode =
66
reveal_chars_of_pwd = 0
77
log_mode = False
88
host_info_colors = ["green", "red", "yellow", "cyan"]
9+
check_guest_account = False
910

1011
[BloodHound]
1112
bh_enabled = False

nxc/protocols/smb.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from impacket.smb3structs import FILE_SHARE_WRITE, FILE_SHARE_DELETE, SMB2_0_IOCTL_IS_FSCTL
3838
from impacket.dcerpc.v5 import tsts as TSTS
3939

40-
from nxc.config import process_secret, host_info_colors
40+
from nxc.config import process_secret, host_info_colors, check_guest_account
4141
from nxc.connection import connection, sem, requires_admin, dcom_FirewallChecker
4242
from nxc.helpers.misc import gen_random_string, validate_ntlm
4343
from nxc.logger import NXCAdapter
@@ -185,6 +185,14 @@ def enum_host_info(self):
185185
self.no_ntlm = True
186186
self.logger.debug("NTLM not supported")
187187

188+
if check_guest_account and not self.no_ntlm:
189+
try:
190+
self.conn.login("Guest", "")
191+
self.logger.debug("Guest authentication successful")
192+
self.is_guest = True
193+
except Exception:
194+
self.is_guest = False
195+
188196
# self.domain is the attribute we authenticate with
189197
# self.targetDomain is the attribute which gets displayed as host domain
190198
if not self.no_ntlm:
@@ -295,7 +303,8 @@ def print_host_info(self):
295303
smbv1 = colored(f"SMBv1:{self.smbv1}", host_info_colors[2], attrs=["bold"]) if self.smbv1 else colored(f"SMBv1:{self.smbv1}", host_info_colors[3], attrs=["bold"])
296304
ntlm = colored(f" (NTLM:{not self.no_ntlm})", host_info_colors[2], attrs=["bold"]) if self.no_ntlm else ""
297305
null_auth = colored(f" (Null Auth:{self.null_auth})", host_info_colors[2], attrs=["bold"]) if self.null_auth else ""
298-
self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.targetDomain}) ({signing}) ({smbv1}){ntlm}{null_auth}")
306+
guest = colored(f" (Guest Auth:{self.is_guest})", host_info_colors[1], attrs=["bold"]) if self.is_guest else ""
307+
self.logger.display(f"{self.server_os}{f' x{self.os_arch}' if self.os_arch else ''} (name:{self.hostname}) (domain:{self.targetDomain}) ({signing}) ({smbv1}){ntlm}{null_auth}{guest}")
299308

300309
if self.args.generate_hosts_file or self.args.generate_krb5_file:
301310
if self.args.generate_hosts_file:

0 commit comments

Comments
 (0)