def requestAvatar(self, avatarId, mind, *interfaces): try: backend = CONFIG.get('honeypot', 'backend') except: backend = 'shell' if backend == 'shell': if conchinterfaces.IConchUser in interfaces: serv = shellserver.CowrieServer(self) user = shellavatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: serv = shellserver.CowrieServer(self) user = session.HoneyPotTelnetSession(avatarId, serv) return interfaces[0], user, user.logout raise NotImplementedError("No supported interfaces found.") elif backend == 'proxy': if conchinterfaces.IConchUser in interfaces: serv = proxyserver.CowrieServer(self) user = proxyavatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: raise NotImplementedError( "Telnet not yet supported for proxy mode.") log.msg('No supported interfaces found.') raise NotImplementedError("No supported interfaces found.") else: raise NotImplementedError("No supported backend found.")
def requestAvatar(self, avatarId, mind, *interfaces): """ """ # if mind in self.servers: # log.msg( "Using existing server for mind %s" % mind ) # for i in self.servers[mind].avatars: # log.msg( "attached avatar: %s" % repr(i) ) #else: # log.msg( "Starting new server for mind %s" % mind ) # self.servers[mind] = server.CowrieServer(self.cfg) # for i in list(self.servers.keys()): # log.msg( "REFCOUNT: key: %s, refcount %d" % ( i, sys.getrefcount(self.servers[i]))) # log.msg( "Refer: %s" % repr( gc.get_referrers(self.servers[i]))) if conchinterfaces.IConchUser in interfaces: serv = server.CowrieServer(self) user = avatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: serv = server.CowrieServer(self) user = session.HoneyPotTelnetSession(avatarId, serv) return interfaces[0], user, user.logout log.msg('No supported interfaces found.') # TODO: this exception doesn't raise for a reason I don't understand raise NotImplementedError("No supported interfaces found.")
def requestAvatar(self, avatarId, mind, *interfaces): if conchinterfaces.IConchUser in interfaces: serv = shellserver.CowrieServer(self) user = shellavatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: serv = shellserver.CowrieServer(self) user = session.HoneyPotTelnetSession(avatarId, serv) return interfaces[0], user, user.logout
def requestAvatar(self, avatarId, mind, *interfaces): """ """ # if mind in self.servers: # log.msg( "Using existing server for mind %s" % mind ) # for i in self.servers[mind].avatars: # log.msg( "attached avatar: %s" % repr(i) ) #else: # log.msg( "Starting new server for mind %s" % mind ) # self.servers[mind] = server.CowrieServer(self.cfg) # for i in list(self.servers.keys()): # log.msg( "REFCOUNT: key: %s, refcount %d" % ( i, sys.getrefcount(self.servers[i]))) # log.msg( "Refer: %s" % repr( gc.get_referrers(self.servers[i]))) try: backend = CONFIG.get('honeypot', 'backend') except: backend = 'shell' if backend == 'shell': if conchinterfaces.IConchUser in interfaces: serv = shellserver.CowrieServer(self) user = shellavatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: serv = shellserver.CowrieServer(self) user = session.HoneyPotTelnetSession(avatarId, serv) return interfaces[0], user, user.logout raise NotImplementedError("No supported interfaces found.") elif backend == 'proxy': if conchinterfaces.IConchUser in interfaces: serv = proxyserver.CowrieServer(self) user = proxyavatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: raise NotImplementedError( "Telnet not yet supported for proxy mode.") log.msg('No supported interfaces found.') raise NotImplementedError("No supported interfaces found.") else: raise NotImplementedError("No supported backend found.")
def requestAvatar(self, avatarId, mind, *interfaces): backend = CowrieConfig().get('honeypot', 'backend', fallback='shell') if backend == 'shell': if conchinterfaces.IConchUser in interfaces: serv = shellserver.CowrieServer(self) user = shellavatar.CowrieUser(avatarId, serv) return interfaces[0], user, user.logout elif ITelnetProtocol in interfaces: serv = shellserver.CowrieServer(self) user = session.HoneyPotTelnetSession(avatarId, serv) return interfaces[0], user, user.logout log.msg('No supported interfaces found.') raise NotImplementedError("No supported interfaces found.") elif backend == 'proxy': # not used in proxies, as they operate on a lower level pass else: raise NotImplementedError("No supported backend found.")