A simple wrapper for PySMB.
Project description
cheesefactory-smb
A simple wrapper for PySMB.
Main Features
- Built around PySMB.
- Push and pull files with ease.
Note: This package is still in beta status. As such, future versions may not be backwards compatible and features may change.
Installation
The source is hosted at https://bitbucket.org/hellsgrannies/cheesefactory-smb
pip install cheesefactory-smb
Dependencies
Connect to a remote SMB/CIFS server
smb = CfSmb(
user='jdoe',
password='superSecret',
client_name='yoyo',
server_name='windows_server1',
server_ip='192.168.1.22',
server_port='445',
domain='mydomain',
use_ntlm_v2=True,
is_direct_tcp=True
)
- user (str): SMB server username.
- password (str): SMB server password.
- client_name (str): Client machine name.
- server_name (str): SMB server name.
- server_ip (str): SMB server IP address or hostname.
- server_port (str): SMB server port. Default =
'445'
- domain (str): Domain used for authentication.
- use_ntlm_v2 (bool): Use NTLMv1 (False) or NTLMv2 (True) for authentication. Default =
True
- is_direct_tcp (bool): Use NetBIOS over TCP/IP (False) or direct TCP/IP (True) for communication. Default =
True
Query the SMB server for a list of shares
shares = smb.get_shares()
for share in shares:
print(share)
Query the SMB server for a list of files in a directory on a share
files = smb.get_files(
share='my_share',
directory='/dir1/dir2/directory_of_stuff'
)
- share (str): Remote SMB share.
- directory (str): The remote directory to inspect.
Download a file from the remote SMB server
smb.download(
share='my_share',
source_path='/remote_dir1/remote_dir2/cool_beans.pdf',
destination_path='c:/local_dir1/cool_beans.pdf')
- share (str): Remote SMB share.
- source_path (str): Full path of remote filename to download.
- destination_path (str): Full path of destination filename on local machine.
Upload a local file to the SMB server
smb.upload(
share='my_share',
source_path='c:/local_dir1/cool_beans.pdf',
destination_path='/remote_dir1/remote_dir2/cool_beans.pdf'
)
- share (str): Remote SMB share.
- source_path (str): Full path of local filename to upload.
- destination_path (str): Full path of destination filename on Remote SMB server.
Close the connection to a remote SMB server
smb.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cheesefactory-smb-0.4.tar.gz
(5.7 kB
view details)
File details
Details for the file cheesefactory-smb-0.4.tar.gz
.
File metadata
- Download URL: cheesefactory-smb-0.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f35b1f3352d65735824d253be7d9b610f4899ceaa9698ffa17cc76a8cff85305 |
|
MD5 | e81131af96bf42116b517a3d833bb82e |
|
BLAKE2b-256 | 3d247ee5e3caeaec3c5c8c93b10098b104598d814d09b18f6015635082e29362 |