Create a new SMBProtocolFactory instance. You will pass this instance to *reactor.connectTCP()* which will then instantiate the TCP connection to the remote SMB/CIFS server. Note that the default TCP port for most SMB/CIFS servers using NetBIOS over TCP/IP is 139. Some newer
(self, username, password, my_name, remote_name, domain = '', use_ntlm_v2 = True, sign_options = SIGN_WHEN_REQUIRED, is_direct_tcp = False)
| 86 | SIGN_WHEN_REQUIRED = 2 |
| 87 | |
| 88 | def __init__(self, username, password, my_name, remote_name, domain = '', use_ntlm_v2 = True, sign_options = SIGN_WHEN_REQUIRED, is_direct_tcp = False): |
| 89 | """ |
| 90 | Create a new SMBProtocolFactory instance. You will pass this instance to *reactor.connectTCP()* which will then instantiate the TCP connection to the remote SMB/CIFS server. |
| 91 | Note that the default TCP port for most SMB/CIFS servers using NetBIOS over TCP/IP is 139. |
| 92 | Some newer server installations might also support Direct hosting of SMB over TCP/IP; for these servers, the default TCP port is 445. |
| 93 | |
| 94 | *username* and *password* are the user credentials required to authenticate the underlying SMB connection with the remote server. |
| 95 | File operations can only be proceeded after the connection has been authenticated successfully. |
| 96 | |
| 97 | :param string my_name: The local NetBIOS machine name that will identify where this connection is originating from. |
| 98 | You can freely choose a name as long as it contains a maximum of 15 alphanumeric characters and does not contain spaces and any of ``\/:*?";|+`` |
| 99 | :param string remote_name: The NetBIOS machine name of the remote server. |
| 100 | On windows, you can find out the machine name by right-clicking on the "My Computer" and selecting "Properties". |
| 101 | This parameter must be the same as what has been configured on the remote server, or else the connection will be rejected. |
| 102 | :param string domain: The network domain. On windows, it is known as the workgroup. Usually, it is safe to leave this parameter as an empty string. |
| 103 | :param boolean use_ntlm_v2: Indicates whether pysmb should be NTLMv1 or NTLMv2 authentication algorithm for authentication. |
| 104 | The choice of NTLMv1 and NTLMv2 is configured on the remote server, and there is no mechanism to auto-detect which algorithm has been configured. |
| 105 | Hence, we can only "guess" or try both algorithms. |
| 106 | On Sambda, Windows Vista and Windows 7, NTLMv2 is enabled by default. On Windows XP, we can use NTLMv1 before NTLMv2. |
| 107 | :param int sign_options: Determines whether SMB messages will be signed. Default is *SIGN_WHEN_REQUIRED*. |
| 108 | If *SIGN_WHEN_REQUIRED* (value=2), SMB messages will only be signed when remote server requires signing. |
| 109 | If *SIGN_WHEN_SUPPORTED* (value=1), SMB messages will be signed when remote server supports signing but not requires signing. |
| 110 | If *SIGN_NEVER* (value=0), SMB messages will never be signed regardless of remote server's configurations; access errors will occur if the remote server requires signing. |
| 111 | :param boolean is_direct_tcp: Controls whether the NetBIOS over TCP/IP (is_direct_tcp=False) or the newer Direct hosting of SMB over TCP/IP (is_direct_tcp=True) will be used for the communication. |
| 112 | The default parameter is False which will use NetBIOS over TCP/IP for wider compatibility (TCP port: 139). |
| 113 | """ |
| 114 | self.username = username |
| 115 | self.password = password |
| 116 | self.my_name = my_name |
| 117 | self.remote_name = remote_name |
| 118 | self.domain = domain |
| 119 | self.use_ntlm_v2 = use_ntlm_v2 |
| 120 | self.sign_options = sign_options |
| 121 | self.is_direct_tcp = is_direct_tcp |
| 122 | self.instance = None #: The single SMBProtocol instance for each SMBProtocolFactory instance. Usually, you should not need to touch this attribute directly. |
| 123 | |
| 124 | # |
| 125 | # Public Property |
nothing calls this directly
no outgoing calls
no test coverage detected