Пример #1
0
 def auth_publickey(self, packet):
     NS = userauth.NS
     hasSig = ord(packet[0])
     algName, blob, rest = userauth.getNS(packet[1:], 2)
     pubKey = userauth.keys.getPublicKeyObject(data=blob)
     b = NS(self.transport.sessionID) + chr(userauth.MSG_USERAUTH_REQUEST) + \
         NS(self.user) + NS(self.nextService) + NS('publickey') + \
         chr(hasSig) +  NS(keys.objectType(pubKey)) + NS(blob)
     signature = hasSig and userauth.getNS(rest)[0] or None
     c = credentials.SSHPrivateKey(self.user, blob, b, signature)
     c.peer = self.transport.transport.getPeer().host
     return self.portal.login(c, None, self.USERCLASS).addErrback(
         self._ebCheckKey, packet[1:])
Пример #2
0
 def auth_publickey(self, packet):
     NS = userauth.NS
     hasSig = ord(packet[0])
     algName, blob, rest = userauth.getNS(packet[1:], 2)
     pubKey = userauth.keys.getPublicKeyObject(data = blob)
     b = NS(self.transport.sessionID) + chr(userauth.MSG_USERAUTH_REQUEST) + \
         NS(self.user) + NS(self.nextService) + NS('publickey') + \
         chr(hasSig) +  NS(keys.objectType(pubKey)) + NS(blob)
     signature = hasSig and userauth.getNS(rest)[0] or None
     c = credentials.SSHPrivateKey(self.user, blob, b, signature)
     c.peer = self.transport.transport.getPeer().host
     return self.portal.login(c, None, self.USERCLASS).addErrback(
                                                 self._ebCheckKey,
                                                 packet[1:])
Пример #3
0
 def auth_password(self, packet):
     password = userauth.getNS(packet[1:])[0]
     c = userauth.credentials.UsernamePassword(self.user, password)
     c.peer = self.transport.transport.getPeer().host
     return self.portal.login(c, None, self.USERCLASS).addErrback(
                                                 self._ebPassword)
Пример #4
0
 def auth_password(self, packet):
     password = userauth.getNS(packet[1:])[0]
     c = userauth.credentials.UsernamePassword(self.user, password)
     c.peer = self.transport.transport.getPeer().host
     return self.portal.login(c, None,
                              self.USERCLASS).addErrback(self._ebPassword)