From 45db71d8c26aa79f5d118deee3a5ab87e306a129 Mon Sep 17 00:00:00 2001 From: "Remi GASCOU (Podalirius)" <79218792+p0dalirius@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:06:27 +0200 Subject: [PATCH] Fixed double backslashes in paths printed by module find --- smbclientng/core/SMBSession.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/smbclientng/core/SMBSession.py b/smbclientng/core/SMBSession.py index f55f8f8..49ec57d 100644 --- a/smbclientng/core/SMBSession.py +++ b/smbclientng/core/SMBSession.py @@ -250,15 +250,13 @@ def recurse_action(paths=[], depth=0, callback=None): for entry in entries: if entry.is_directory(): - callback(entry, path + ntpath.sep + entry.get_longname() + ntpath.sep, depth) + fullpath = path + ntpath.sep + entry.get_longname() + ntpath.sep + next_directories_to_explore.append(fullpath) else: - callback(entry, path + ntpath.sep + entry.get_longname(), depth) - - # Next directories to explore - for entry in entries: - if entry.is_directory(): - next_directories_to_explore.append(path + ntpath.sep + entry.get_longname() + ntpath.sep) - + fullpath = path + ntpath.sep + entry.get_longname() + fullpath = re.sub(r'\\\\+', r'\\', fullpath) + callback(entry, fullpath, depth) + return next_directories_to_explore # if callback is not None: