Skip to content

Commit 841f9d8

Browse files
committed
add generate_hosts_file option for lab
1 parent 78da498 commit 841f9d8

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

nxc/protocols/smb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ def print_host_info(self):
313313
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"])
314314
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})")
315315

316+
if self.args.generate_hosts_file:
317+
with open(self.args.generate_hosts_file, "a+") as host_file:
318+
host_file.write(f"{self.host} {self.hostname} {self.hostname}.{self.targetDomain}\n")
319+
320+
return self.host, self.hostname, self.targetDomain
321+
316322
def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="", kdcHost="", useCache=False):
317323
self.logger.debug(f"KDC set to: {kdcHost}")
318324
lmhash = ""

nxc/protocols/smb/proto_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def proto_args(parser, parents):
1919
smb_parser.add_argument("--gen-relay-list", metavar="OUTPUT_FILE", help="outputs all hosts that don't require SMB signing to the specified file")
2020
smb_parser.add_argument("--smb-timeout", help="SMB connection timeout", type=int, default=2)
2121
smb_parser.add_argument("--laps", dest="laps", metavar="LAPS", type=str, help="LAPS authentification", nargs="?", const="administrator")
22+
smb_parser.add_argument("--generate-hosts-file", type=str, help="IP for the remote system to connect back to")
2223
self_delegate_arg.make_required = [delegate_arg]
2324

2425
cred_gathering_group = smb_parser.add_argument_group("Credential Gathering", "Options for gathering credentials")

0 commit comments

Comments
 (0)