from smb.SMBConnection import SMBConnection # Establish a connection to the remote server conn = SMBConnection('username', 'password', 'client_name', 'server_name') # List all shares available on the server shares = conn.listShares() # print the name of each share for share in shares: print(share.name)
from smb.SMBConnection import SMBConnection # Establish a connection to the remote server conn = SMBConnection('username', 'password', 'client_name', 'server_name') # List only the hidden shares available on the server shares = conn.listShares(hidden=True) # print the name of each share for share in shares: print(share.name)In this example, we create an instance of the SMBConnection class as before, but this time we pass the `hidden=True` parameter to the listShares function to filter only the hidden shares. We then print the name of each share in the list. Package Library: PySMB