Skip to main content

cheesefactory-smb


A simple wrapper for PySMB.

PyPI Latest Release PyPI status PyPI download month PyPI download week PyPI download day

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()

Release files for cheesefactory-smb 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cheesefactory-smb 0.4
File Size Uploaded
cheesefactory-smb-0.4.tar.gz 5.7 kB Details

Release files / cheesefactory-smb-0.4.tar.gz

Download URL cheesefactory-smb-0.4.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f35b1f3352d65735824d253be7d9b610f4899ceaa9698ffa17cc76a8cff85305
BLAKE2b-256 checksum
How to use checksums
3d247ee5e3caeaec3c5c8c93b10098b104598d814d09b18f6015635082e29362
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page