From b778197403c8d4926ba9414785ddf1c882f7cc2e Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Sun, 28 Jun 2015 14:39:10 +0400 Subject: [PATCH] Search for moduli in right place on MacosX --- cowrie/core/ssh.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cowrie/core/ssh.py b/cowrie/core/ssh.py index 190884a..371e6e6 100644 --- a/cowrie/core/ssh.py +++ b/cowrie/core/ssh.py @@ -158,7 +158,7 @@ class HoneyPotSSHFactory(factory.SSHFactory): @return: The built transport. """ - _moduli = '/etc/ssh/moduli' + _modulis = '/etc/ssh/moduli', '/private/etc/moduli' # FIXME: try to mimic something real 100% t = HoneyPotTransport() @@ -170,13 +170,15 @@ class HoneyPotSSHFactory(factory.SSHFactory): t.supportedPublicKeys = self.privateKeys.keys() - try: - self.primes = primes.parseModuliFile(_moduli) - except IOError as err: - log.err(err) + for _moduli in _modulis: + try: + self.primes = primes.parseModuliFile(_moduli) + break + except IOError as err: + pass if not self.primes: - log.msg("Disabling diffie-hellman-group-exchange-sha1") + log.msg("Moduli not found, disabling diffie-hellman-group-exchange-sha1") ske = t.supportedKeyExchanges[:] ske.remove('diffie-hellman-group-exchange-sha1') t.supportedKeyExchanges = ske