Skip to main content

A simple wrapper for PySMB.

Project description

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

Project details


Release history Release notifications | RSS feed

This version

0.4

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

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page