(self, message)
| 1815 | return self.mid |
| 1816 | |
| 1817 | def _updateState_SMB1(self, message): |
| 1818 | if message.isReply: |
| 1819 | if message.command == SMB_COM_NEGOTIATE: |
| 1820 | if not message.status.hasError: |
| 1821 | self.has_negotiated = True |
| 1822 | self.log.info('SMB dialect negotiation successful (ExtendedSecurity:%s)', message.hasExtendedSecurity) |
| 1823 | self._updateServerInfo(message.payload) |
| 1824 | self._handleNegotiateResponse(message) |
| 1825 | else: |
| 1826 | raise ProtocolError('Unknown status value (0x%08X) in SMB_COM_NEGOTIATE' % message.status.internal_value, |
| 1827 | message.raw_data, message) |
| 1828 | elif message.command == SMB_COM_SESSION_SETUP_ANDX: |
| 1829 | if message.hasExtendedSecurity: |
| 1830 | if not message.status.hasError: |
| 1831 | try: |
| 1832 | result = securityblob.decodeAuthResponseSecurityBlob(message.payload.security_blob) |
| 1833 | if result == securityblob.RESULT_ACCEPT_COMPLETED: |
| 1834 | self.log.debug('SMB uid is now %d', message.uid) |
| 1835 | self.uid = message.uid |
| 1836 | self.has_authenticated = True |
| 1837 | self.log.info('Authentication (with extended security) successful!') |
| 1838 | self.onAuthOK() |
| 1839 | else: |
| 1840 | raise ProtocolError('SMB_COM_SESSION_SETUP_ANDX status is 0 but security blob negResult value is %d' % result, message.raw_data, message) |
| 1841 | except securityblob.BadSecurityBlobError as ex: |
| 1842 | raise ProtocolError(str(ex), message.raw_data, message) |
| 1843 | elif message.status.internal_value == 0xc0000016: # STATUS_MORE_PROCESSING_REQUIRED |
| 1844 | try: |
| 1845 | result, ntlm_token = securityblob.decodeChallengeSecurityBlob(message.payload.security_blob) |
| 1846 | if result == securityblob.RESULT_ACCEPT_INCOMPLETE: |
| 1847 | self._handleSessionChallenge(message, ntlm_token) |
| 1848 | except ( securityblob.BadSecurityBlobError, securityblob.UnsupportedSecurityProvider ) as ex: |
| 1849 | raise ProtocolError(str(ex), message.raw_data, message) |
| 1850 | elif (message.status.internal_value == 0xc000006d # STATUS_LOGON_FAILURE |
| 1851 | or message.status.internal_value == 0xc0000064 # STATUS_NO_SUCH_USER |
| 1852 | or message.status.internal_value == 0xc000006a): # STATUS_WRONG_PASSWORD |
| 1853 | self.has_authenticated = False |
| 1854 | self.log.info('Authentication (with extended security) failed. Please check username and password.') |
| 1855 | self.onAuthFailed() |
| 1856 | elif (message.status.internal_value == 0xc0000193 # STATUS_ACCOUNT_EXPIRED |
| 1857 | or message.status.internal_value == 0xC0000071): # STATUS_PASSWORD_EXPIRED |
| 1858 | self.has_authenticated = False |
| 1859 | self.log.info('Authentication (with extended security) failed. Account or password has expired.') |
| 1860 | self.onAuthFailed() |
| 1861 | elif message.status.internal_value == 0xc0000234: # STATUS_ACCOUNT_LOCKED_OUT |
| 1862 | self.has_authenticated = False |
| 1863 | self.log.info('Authentication (with extended security) failed. Account has been locked due to too many invalid logon attempts.') |
| 1864 | self.onAuthFailed() |
| 1865 | elif message.status.internal_value == 0xc0000072: # STATUS_ACCOUNT_DISABLED |
| 1866 | self.has_authenticated = False |
| 1867 | self.log.info('Authentication (with extended security) failed. Account has been disabled.') |
| 1868 | self.onAuthFailed() |
| 1869 | elif (message.status.internal_value == 0xc000006f # STATUS_INVALID_LOGON_HOURS |
| 1870 | or message.status.internal_value == 0xc000015b # STATUS_LOGON_TYPE_NOT_GRANTED |
| 1871 | or message.status.internal_value == 0xc0000070): # STATUS_INVALID_WORKSTATION |
| 1872 | self.has_authenticated = False |
| 1873 | self.log.info('Authentication (with extended security) failed. Not allowed.') |
| 1874 | self.onAuthFailed() |
nothing calls this directly
no test coverage detected