mirror of https://github.com/desaster/kippo.git
work around #194 - couldn't match all kex parts
merge micheloosterhof/cowrie@fd4ca2bcf6 from cowrie to work around the "couldn't match all kex parts" error
This commit is contained in:
parent
d46174524e
commit
4999618f47
|
@ -5,6 +5,7 @@ import twisted
|
||||||
from twisted.cred import portal
|
from twisted.cred import portal
|
||||||
from twisted.conch import avatar, interfaces as conchinterfaces
|
from twisted.conch import avatar, interfaces as conchinterfaces
|
||||||
from twisted.conch.ssh import factory, userauth, connection, keys, session, transport
|
from twisted.conch.ssh import factory, userauth, connection, keys, session, transport
|
||||||
|
from twisted.conch.openssh_compat import primes
|
||||||
from twisted.python import log
|
from twisted.python import log
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
||||||
|
@ -92,6 +93,18 @@ class HoneyPotSSHFactory(factory.SSHFactory):
|
||||||
self.dbloggers.append(dblogger)
|
self.dbloggers.append(dblogger)
|
||||||
|
|
||||||
def buildProtocol(self, addr):
|
def buildProtocol(self, addr):
|
||||||
|
"""
|
||||||
|
Create an instance of the server side of the SSH protocol.
|
||||||
|
|
||||||
|
@type addr: L{twisted.internet.interfaces.IAddress} provider
|
||||||
|
@param addr: The address at which the server will listen.
|
||||||
|
|
||||||
|
@rtype: L{twisted.conch.ssh.SSHServerTransport}
|
||||||
|
@return: The built transport.
|
||||||
|
"""
|
||||||
|
|
||||||
|
_modulis = '/etc/ssh/moduli', '/private/etc/moduli'
|
||||||
|
|
||||||
cfg = config()
|
cfg = config()
|
||||||
|
|
||||||
# FIXME: try to mimic something real 100%
|
# FIXME: try to mimic something real 100%
|
||||||
|
@ -104,6 +117,13 @@ class HoneyPotSSHFactory(factory.SSHFactory):
|
||||||
|
|
||||||
t.supportedPublicKeys = self.privateKeys.keys()
|
t.supportedPublicKeys = self.privateKeys.keys()
|
||||||
|
|
||||||
|
for _moduli in _modulis:
|
||||||
|
try:
|
||||||
|
self.primes = primes.parseModuliFile(_moduli)
|
||||||
|
break
|
||||||
|
except IOError as err:
|
||||||
|
pass
|
||||||
|
|
||||||
if not self.primes:
|
if not self.primes:
|
||||||
ske = t.supportedKeyExchanges[:]
|
ske = t.supportedKeyExchanges[:]
|
||||||
ske.remove('diffie-hellman-group-exchange-sha1')
|
ske.remove('diffie-hellman-group-exchange-sha1')
|
||||||
|
|
Loading…
Reference in New Issue