cheesefactory-smb-PySMB的簡單包裝。-Todd Salazar Installation Dependencies

cheesefactory-smb-PySMB的簡單包裝。-Todd Salazar

發佈:2020-12-23 11:28:12.019012

做者:Todd Salazar

### 做者郵箱:unixsal@yahoo.com

### 首頁:https://bitbucket.org/hellsgrannies/cheesefactory-smb

### 文檔:None

### 下載連接 

# 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.python

Installation

The source is hosted at https://bitbucket.org/hellsgrannies/cheesefactory-smbwindows

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.
  • clientname_ (str): Client machine name.
  • servername_ (str): SMB server name.
  • serverip_ (str): SMB server IP address or hostname.
  • serverport_ (str): SMB server port. Default = '445'
  • domain (str): Domain used for authentication.
  • usentlmv2 (bool): Use NTLMv1 (False) or NTLMv2 (True) for authentication. Default = True
  • isdirecttcp (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.
  • sourcepath_ (str): Full path of remote filename to download.
  • destinationpath_ (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.
  • sourcepath_ (str): Full path of local filename to upload.
  • destinationpath_ (str): Full path of destination filename on Remote SMB server.

Close the connection to a remote SMB server

smb.close()
Copy from pypi.org

查詢時間:13.295ms
渲染時間:13.439ms

本文同步分享在 博客「zhenruyan」(other)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。app

相關文章
相關標籤/搜索