def to_credential(self): if self.domain: return Credential('plaintext', domain=self.domain, username=self.username, password=self.password, fullhash='%s:%s:%s' % (self.domain, self.username, self.password)) else: return Credential('plaintext', username=self.username, password=self.password, fullhash='%s:%s' % (self.username, self.password))
def to_credential(self): cred = Credential( 'netNTLMv1-ESS', username = self.username, fullhash = '%s::%s:%s:%s:%s' % (self.username, self.domain, self.ChallengeFromClinet, self.ClientResponse, self.ServerChallenge) ) return cred
def to_credential(self): cred = Credential( 'netLMv2', username = self.username, fullhash = '$NETLMv2$%s$%s$%s$%s' % (self.username, self.ServerChallenge, self.ClientResponse, self.ChallengeFromClinet) ) return cred
def verify_creds(self, method=None, body_data=None): """ Verifyies user creds, returns a tuple with (verification_result, credential) currently it products SIP hash, sorry also it doesnt variy creds, todo """ #print(self.authorize.username) #print(n2e(self.authorize.username)) fullhash = '$sip$*%s' % ( '*'.join([ n2e(self.authenticate.uri), #[URI_SERVER] n2e(self.authorize.uri), #[URI_CLIENT] n2e(self.authorize.username), #[USERNAME] n2e(self.authorize.realm), #[REALM] n2e(method), #[METHOD] n2e(''), #[URI_PREFIX] n2e(''), #[URI_RESOURCE] n2e(''), #[URI_SUFFIX] n2e(self.authenticate.nonce), #[NONCE_SERVER] n2e(self.authorize.cnonce), #[NONCE_CLIENT] n2e(self.authorize.nonce_count), #[NONCE_COUNT] n2e(self.authorize.qop), #[QOP] n2e(self.authenticate.algorithm.name), #DIRECTIVE n2e(self.authorize.response) #[MD5] ])) credential = Credential('DIGEST', domain=self.authorize.realm, username=self.authorize.username, fullhash=fullhash) return AuthResult.FAIL, credential
def to_credential(self): cred = Credential( 'Cleartext', username = self.username, password = self.password, fullhash = '%s:%s' % (self.username, self.password) ) return cred
def to_credential(self): cred = Credential('netLM', username = self.username, fullhash = '%s:$NETLM$%s$%s' % (self.username, self.ServerChallenge, self.ClientResponse) ) return cred
def toCredential(self): return Credential('PLAIN', username=self.username, password=self.password, fullhash='%s:%s' % (self.username, self.password))
def toCredential(self): return Credential('APOP', username=self.username, fullhash='%s:%s:%s' % (self.username, self.digest, self.salt))
def to_credential(self): return Credential('PLAIN', username=self.user_name, fullhash='%s:%s' % (self.user_name, ''))
async def run(self): # main loop while not self.shutdown_evt.is_set(): try: result = await asyncio.gather( *[TDSPacket.from_streamreader(self.creader, timeout=None)], return_exceptions=True) except asyncio.CancelledError as e: raise e if isinstance(result[0], R3ConnectionClosed): return elif isinstance(result[0], Exception): raise result[0] else: packet = result[0] #print(str(packet)) if self.session.status == SessionStatus.START: if packet.type != PacketType.PRELOGIN: raise Exception('Unexpected packet type! %s ' % packet.type) self.session.status = SessionStatus.PREAUTH_SENT data = PRELOGIN() data.version = b'\x11\x02\x00\x00\x00\x00' data.encryption = Encryption.NOT_SUP data.instvalidity = '' data.thread_id = 0 data.mars = False data.fedauthrequired = False data.traceid = os.urandom(32) rp = TDSPacket() rp.type = PacketType.TABULAR_RESULT rp.status = PacketStatus.EOM rp.spid = 0 rp.packet_id = 1 rp.window = 0 rp.data = data await self.send_data(rp.to_bytes()) continue elif self.session.status == SessionStatus.PREAUTH_SENT: if packet.type == PacketType.LOGIN7: cred = Credential( 'plaintext', username=packet.data.username, password=packet.data.password, fullhash='%s:%s' % (packet.data.username, packet.data.password)) await self.logger.credential(cred) return elif packet.type == PacketType.SSPI: self.session.status = SessionStatus.SSPI_AUTH #TODO return #raise Exception('Not implemented!') #elif #TODO: implement SSPI and SSL auth (latter is encryption on flag set) #elif self.session.status == SessionStatus.SSPI_AUTH: else: raise Exception('Unexpected packet at this stage!')