Skip to content

Commit df91a01

Browse files
committed
fixed deprecated kerberos option for samba tools
-k is deprecated in samba tools and produced warning messages. rpcclient wasn't working at all with -k. use --use-krb5-ccache instead.
1 parent d069d75 commit df91a01

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

enum4linux-ng.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,13 @@ def __init__(self, command, target, creds):
495495
self.env = os.environ.copy()
496496
self.env['KRB5CCNAME'] = self.creds.ticket_file
497497
# User and domain are taken from the ticket
498-
self.exec += ['-k']
498+
# Kerberos options differ between samba versions
499+
samba_version = re.match(r".*(\d+\.\d+\.\d+).*", check_output(["smbclient", "--version"]).decode()).group(1)
500+
samba_version = tuple(int(x) for x in samba_version.split('.'))
501+
if samba_version < (4, 15, 0):
502+
self.exec += ['-k']
503+
else:
504+
self.exec += ['--use-krb5-ccache', self.creds.ticket_file]
499505
elif creds.nthash:
500506
self.exec += ['-W', f'{self.creds.domain}']
501507
self.exec += ['-U', f'{self.creds.user}%{self.creds.nthash}', '--pw-nt-hash']

0 commit comments

Comments
 (0)