From 07eda9506d0e1ae183335596d2ab9ee9113565d2 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Wed, 2 Sep 2015 19:22:33 +0000 Subject: [PATCH] fall back to old style implements support instead of @implementer --- cowrie/core/auth.py | 8 ++++---- cowrie/core/credentials.py | 6 +++--- cowrie/core/ssh.py | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cowrie/core/auth.py b/cowrie/core/auth.py index 204f150..b8a544e 100644 --- a/cowrie/core/auth.py +++ b/cowrie/core/auth.py @@ -7,7 +7,7 @@ from os import path from sys import modules from random import randint -from zope.interface import implementer +from zope.interface import implements from twisted.cred.checkers import ICredentialsChecker from twisted.cred.credentials import ISSHPrivateKey @@ -240,8 +240,8 @@ class AuthRandom(object): self.savevars() return auth -@implementer(ICredentialsChecker) class HoneypotPublicKeyChecker: + implements(ICredentialsChecker) """ Checker that accepts, logs and denies public key authentication attempts """ @@ -258,8 +258,8 @@ class HoneypotPublicKeyChecker: fingerprint=_pubKey.fingerprint()) return failure.Failure(error.ConchError('Incorrect signature')) -@implementer(ICredentialsChecker) class HoneypotNoneChecker: + implements(ICredentialsChecker) """ Checker that does no authentication check """ @@ -272,8 +272,8 @@ class HoneypotNoneChecker: def requestAvatarId(self, credentials): return defer.succeed(credentials.username) -@implementer(ICredentialsChecker) class HoneypotPasswordChecker: + implements(ICredentialsChecker) """ Checker that accepts "keyboard-interactive" and "password" """ diff --git a/cowrie/core/credentials.py b/cowrie/core/credentials.py index d969d59..130c11b 100644 --- a/cowrie/core/credentials.py +++ b/cowrie/core/credentials.py @@ -26,7 +26,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -from zope.interface import implementer +from zope.interface import implements from twisted.cred.credentials import IUsernamePassword, \ ICredentials @@ -53,8 +53,8 @@ class IUsernamePasswordIP(IUsernamePassword): @ivar ip: The source ip address associated with these credentials. """ -@implementer(IUsername) class Username: + implements(IUsername) """ """ @@ -62,8 +62,8 @@ class Username: self.username = username # This credential interface also provides an IP address -@implementer(IUsernamePasswordIP) class UsernamePasswordIP: + implements(IUsernamePasswordIP) """ """ diff --git a/cowrie/core/ssh.py b/cowrie/core/ssh.py index 49c7b66..94eda38 100644 --- a/cowrie/core/ssh.py +++ b/cowrie/core/ssh.py @@ -6,7 +6,7 @@ import copy import time import uuid -from zope.interface import implementer +from zope.interface import implements import twisted from twisted.conch import avatar, interfaces as conchinterfaces @@ -187,9 +187,9 @@ class HoneyPotSSHFactory(factory.SSHFactory): t.factory = self return t -@implementer(twisted.cred.portal.IRealm) class HoneyPotRealm: - + implements(twisted.cred.portal.IRealm) + def __init__(self, cfg): self.cfg = cfg self.env = honeypot.HoneyPotEnvironment(cfg) @@ -358,9 +358,9 @@ class HoneyPotSSHSession(session.SSHSession): def channelClosed(self): log.msg("Called channelClosed in SSHSession") -# FIXME: recent twisted conch avatar.py uses IConchuser here -@implementer(conchinterfaces.ISession) class HoneyPotAvatar(avatar.ConchUser): + # FIXME: recent twisted conch avatar.py uses IConchuser here + implements(conchinterfaces.ISession) def __init__(self, username, env): avatar.ConchUser.__init__(self) @@ -465,8 +465,8 @@ def getDSAKeys(cfg): privateKeyString = f.read() return publicKeyString, privateKeyString -@implementer(conchinterfaces.ISFTPFile) class CowrieSFTPFile: + implements(conchinterfaces.ISFTPFile) def __init__(self, server, filename, flags, attrs): self.server = server @@ -546,8 +546,8 @@ class CowrieSFTPDirectory: def close(self): self.files = [] -@implementer(conchinterfaces.ISFTPServer) class CowrieSFTPServer: + implements(conchinterfaces.ISFTPServer) def __init__(self, avatar): self.avatar = avatar