Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Fixed #103 #104

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions smbclientng/core/SMBSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ def init_smb_session(self):
else:
self.logger.debug("[>] Authenticating as '%s\\%s' with NTLM with password ... " % (self.credentials.domain, self.credentials.username))
try:
self.logger.debug(" | user = %s" % self.credentials.username)
self.logger.debug(" | password = %s" % self.credentials.password)
self.logger.debug(" | domain = %s" % self.credentials.domain)
self.logger.debug(" | lmhash = %s" % self.credentials.lm_hex)
self.logger.debug(" | nthash = %s" % self.credentials.nt_hex)

self.connected = self.smbClient.login(
user=self.credentials.username,
password=self.credentials.password,
Expand Down Expand Up @@ -216,11 +222,12 @@ def ping_smb_session(self):
bool: True if the echo command succeeds (indicating the session is active), False otherwise.
"""

result, error = is_port_open(self.host, self.port, self.timeout)
if result:
portIsOpen, error = is_port_open(self.host, self.port, self.timeout)
if portIsOpen == False:
self.connected = False
else:
try:
# Try to ping the SMB server to see if we timed out
self.smbClient.getSMBServer().echo()
except Exception as e:
self.connected = False
Expand Down Expand Up @@ -423,7 +430,6 @@ def recurse_action(base_dir="", path=[], localDownloadDir="./"):
except BrokenPipeError as err:
f.set_error(message="[bold red]Failed downloading '%s': %s" % (f.path, err))
f.close(remove=True)
break
except Exception as err:
f.set_error(message="[bold red]Failed downloading '%s': %s" % (f.path, err))
f.close(remove=True)
Expand Down
Loading