(self, username, password, my_name, remote_name, domain = '', use_ntlm_v2 = True, sign_options = SIGN_WHEN_REQUIRED, is_direct_tcp = False)
| 55 | SIGN_WHEN_REQUIRED = 2 |
| 56 | |
| 57 | def __init__(self, username, password, my_name, remote_name, domain = '', use_ntlm_v2 = True, sign_options = SIGN_WHEN_REQUIRED, is_direct_tcp = False): |
| 58 | NMBSession.__init__(self, my_name, remote_name, is_direct_tcp = is_direct_tcp) |
| 59 | self.username = username |
| 60 | self._password = password |
| 61 | self.domain = domain |
| 62 | self.sign_options = sign_options |
| 63 | self.is_direct_tcp = is_direct_tcp |
| 64 | self.use_ntlm_v2 = use_ntlm_v2 #: Similar to LMAuthenticationPolicy and NTAuthenticationPolicy as described in [MS-CIFS] 3.2.1.1 |
| 65 | self.smb_message = SMBMessage() |
| 66 | self.is_using_smb2 = False #: Are we communicating using SMB2 protocol? self.smb_message will be a SMB2Message instance if this flag is True |
| 67 | self.async_requests = { } #: AsyncID mapped to _PendingRequest instance |
| 68 | self.pending_requests = { } #: MID mapped to _PendingRequest instance |
| 69 | self.connected_trees = { } #: Share name mapped to TID |
| 70 | self.next_rpc_call_id = 1 #: Next RPC callID value. Not used directly in SMB message. Usually encapsulated in sub-commands under SMB_COM_TRANSACTION or SMB_COM_TRANSACTION2 messages |
| 71 | |
| 72 | self.has_negotiated = False |
| 73 | self.has_authenticated = False |
| 74 | self.is_signing_active = False #: True if the remote server accepts message signing. All outgoing messages will be signed. Simiar to IsSigningActive as described in [MS-CIFS] 3.2.1.2 |
| 75 | self.signing_session_key = None #: Session key for signing packets, if signing is active. Similar to SigningSessionKey as described in [MS-CIFS] 3.2.1.2 |
| 76 | self.signing_challenge_response = None #: Contains the challenge response for signing, if signing is active. Similar to SigningChallengeResponse as described in [MS-CIFS] 3.2.1.2 |
| 77 | self.mid = 0 |
| 78 | self.uid = 0 |
| 79 | self.next_signing_id = 2 #: Similar to ClientNextSendSequenceNumber as described in [MS-CIFS] 3.2.1.2 |
| 80 | |
| 81 | # SMB1 and SMB2 attributes |
| 82 | # Note that the interpretations of the values may differ between SMB1 and SMB2 protocols |
| 83 | self.capabilities = 0 |
| 84 | self.security_mode = 0 #: Initialized from the SecurityMode field of the SMB_COM_NEGOTIATE message |
| 85 | |
| 86 | # SMB1 attributes |
| 87 | # Most of the following attributes will be initialized upon receipt of SMB_COM_NEGOTIATE message from server (via self._updateServerInfo_SMB1 method) |
| 88 | self.use_plaintext_authentication = False #: Similar to PlaintextAuthenticationPolicy in in [MS-CIFS] 3.2.1.1 |
| 89 | self.max_raw_size = 0 |
| 90 | self.max_buffer_size = 0 #: Similar to MaxBufferSize as described in [MS-CIFS] 3.2.1.1 |
| 91 | self.max_mpx_count = 0 #: Similar to MaxMpxCount as described in [MS-CIFS] 3.2.1.1 |
| 92 | |
| 93 | # SMB2 attributes |
| 94 | self.max_read_size = 0 #: Similar to MaxReadSize as described in [MS-SMB2] 2.2.4 |
| 95 | self.max_write_size = 0 #: Similar to MaxWriteSize as described in [MS-SMB2] 2.2.4 |
| 96 | self.max_transact_size = 0 #: Similar to MaxTransactSize as described in [MS-SMB2] 2.2.4 |
| 97 | self.session_id = 0 #: Similar to SessionID as described in [MS-SMB2] 2.2.4. This will be set in _updateState_SMB2 method |
| 98 | |
| 99 | # tqdm attributes for tracking progress |
| 100 | self.pbar = None #: If not None, it means there is an active tqdm progress bar being shown |
| 101 | |
| 102 | self._setupSMB1Methods() |
| 103 | |
| 104 | self.log.info('Authentication with remote machine "%s" for user "%s" will be using NTLM %s authentication (%s extended security)', |
| 105 | self.remote_name, self.username, |
| 106 | (self.use_ntlm_v2 and 'v2') or 'v1', |
| 107 | (SUPPORT_EXTENDED_SECURITY and 'with') or 'without') |
| 108 | |
| 109 | @property |
| 110 | def password(self): |
nothing calls this directly
no test coverage detected