sách gpt4 ăn đã đi

ví dụ về python

In lại 作者:太空狗 更新时间:2023-10-29 20:11:30 33 4
mua khóa gpt4 giày nike

你能给我一个使用 pysmb 库连接到一些 samba 服务器的例子吗?我读过有类 smb.SMBConnection.SMBConnection(用户名、密码、my_name、remote_name、domain=''、use_ntlm_v2=True)但我不知道如何使用它

câu trả lời hay nhất

我最近一直在使用 pysmb 进行网络共享枚举,发现要找到好的/完整的示例并不那么容易。我建议您引用我编写的一个小脚本,用于枚举 smb 与 pysmb 的共享:https://github.com/n3if/scripts/tree/master/smb_enumerator

同时为了完整起见,我在这里贴出完成连接和枚举的代码片段:

from smb import SMBConnection

thử:
conn = SMBConnection(username,password,'name',system_name,domain,use_ntlm_v2=True,
sign_options=SMBConnection.SIGN_WHEN_SUPPORTED,
is_direct_tcp=True)
connected = conn.connect(system_name,445)

thử:
Response = conn.listShares(timeout=30) # obtain a list of shares
print('Shares on: ' + system_name)

for i in range(len(Response)): # iterate through the list of shares
print(" Share[",i,"] =", Response[i].name)

thử:
# list the files on each share
Response2 = conn.listPath(Response[i].name,'/',timeout=30)
print(' Files on: ' + system_name + '/' + " Share[",i,"] =",
Response[i].name)
for i in range(len(Response2)):
print(" File[",i,"] =", Response2[i].filename)
except:
print('### can not access the resource')
except:
print('### can not list shares')
except:
print('### can not access the system')

关于python - 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10248796/

33 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress