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

相关文章
相关标签/搜索