mirror of
https://github.com/p0dalirius/smbclient-ng
synced 2026-08-09 13:02:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a8a902a58 | ||
|
|
58fbd9e4b6 | ||
|
|
a40eb121ef |
@@ -10,6 +10,11 @@
|
||||
<br>
|
||||
</p>
|
||||
|
||||
> [!NOTE]
|
||||
> Check out the new smbclient-ng written in Go, faster and cross platform by default!
|
||||
>
|
||||
> https://github.com/TheManticoreProject/smbclient-ng
|
||||
|
||||
## Features
|
||||
|
||||
- [x] `acls`: List ACLs of files and folders in cwd. Syntax: `acls`
|
||||
|
||||
@@ -90,7 +90,11 @@ def parseArgs():
|
||||
"-d", "--domain", default=".", type=str, help="Authentication domain."
|
||||
)
|
||||
group_auth.add_argument(
|
||||
"-u", "--user", type=str, default="", help="Username for authentication."
|
||||
"-u",
|
||||
"--user",
|
||||
type=str,
|
||||
default="",
|
||||
help=r"Username for authentication. Supports DOMAIN\user.",
|
||||
)
|
||||
group_auth.add_argument(
|
||||
"-k", "--kerberos", action="store_true", help="Use Kerberos authentication."
|
||||
@@ -132,8 +136,11 @@ def parseArgs():
|
||||
if options.user and not (options.password or options.no_pass or options.hashes or options.ccache_file or options.kerberos):
|
||||
from getpass import getpass
|
||||
|
||||
prompt_domain, prompt_username = Credentials.parse_domain_username(
|
||||
domain=options.domain, username=options.user
|
||||
)
|
||||
options.password = getpass(
|
||||
f" | Provide a password for '{options.domain}\\{options.user}': "
|
||||
f" | Provide a password for '{prompt_domain}\\{prompt_username}': "
|
||||
)
|
||||
|
||||
if options.aes_key or options.ccache_file:
|
||||
|
||||
@@ -213,7 +213,7 @@ class SessionsManager(object):
|
||||
dest="auth_username",
|
||||
metavar="USER",
|
||||
action="store",
|
||||
help="User to authenticate with.",
|
||||
help=r"User to authenticate with. Supports DOMAIN\user.",
|
||||
)
|
||||
secret = mode_create.add_argument_group()
|
||||
cred = secret.add_mutually_exclusive_group()
|
||||
|
||||
@@ -61,8 +61,9 @@ class Credentials(object):
|
||||
):
|
||||
super(Credentials, self).__init__()
|
||||
# Identity
|
||||
self.domain = domain
|
||||
self.username = username
|
||||
self.domain, self.username = self.parse_domain_username(
|
||||
domain=domain, username=username
|
||||
)
|
||||
self.password = password
|
||||
|
||||
# Hashes
|
||||
@@ -74,6 +75,21 @@ class Credentials(object):
|
||||
self.aesKey = aesKey
|
||||
self.ccacheFile = ccacheFile
|
||||
|
||||
@staticmethod
|
||||
def parse_domain_username(
|
||||
domain: str, username: Optional[str]
|
||||
) -> tuple[str, Optional[str]]:
|
||||
if username is None:
|
||||
return domain, username
|
||||
|
||||
for separator in ("\\", "/"):
|
||||
if separator in username:
|
||||
user_domain, user_name = username.split(separator, 1)
|
||||
if user_domain and user_name:
|
||||
return user_domain, user_name
|
||||
|
||||
return domain, username
|
||||
|
||||
def set_hashes(self, hashes: Optional[str]):
|
||||
"""
|
||||
Sets the LM and NT hashes for the credentials.
|
||||
|
||||
@@ -61,6 +61,10 @@ def parse_lm_nt_hashes(lm_nt_hashes_string: str) -> tuple[str, str]:
|
||||
elif m_lm_hash is not None and m_nt_hash is None:
|
||||
lm_hash_value = m_lm_hash
|
||||
nt_hash_value = "31d6cfe0d16ae931b73c59d7e0c089c0"
|
||||
else:
|
||||
lm_hash_value = m_lm_hash
|
||||
nt_hash_value = m_nt_hash
|
||||
|
||||
return lm_hash_value, nt_hash_value
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user