Код:
Код: Выделить всё
import smbc
import pwd
import os
def do_auth (svr, shr, wg, un, pw):
return ('SEVEN.LOCAL', user_info.pw_name , user_info.pw_passwd)
user_info = pwd.getpwnam(pwd.getpwuid(os.getuid()).pw_name)
ctx = smbc.Context(auth_fn=do_auth)
entries = ctx.opendir('smb://IBM').getdents()
for entry in entries:
print (entry.name)