import smbclient

def scan_smb_server(server, username, password):
    files_dict = {}
    with smbclient.SambaClient(server, username=username, password=password) as client:
        for entry in client.listdir(''):
            if client.isdir(entry):
                for root, dirs, files in client.walk(entry):
                    for f in files:
                        file_path = root + '/' + f
                        files_dict[file_path] = f
            else:
                files_dict[entry] = entry
    return files_dict

# Example usage
files = scan_smb_server('smb://myserver/myshare', 'myusername', 'mypassword')
print(files)

+ Recent posts