def execCommand(self, protocol, cmd): cfg = config() # default is enabled if cfg.has_option('honeypot', 'exec_enabled'): if ( cfg.get('honeypot', 'exec_enabled') != "true" ): print 'exec disabled not executing command: "%s"' % cmd raise os.OSError print 'Executing command' serverProtocol = cowrie.core.protocol.LoggingServerProtocol( cowrie.core.protocol.HoneyPotExecProtocol, self, cmd) serverProtocol.makeConnection(protocol) protocol.makeConnection(session.wrapProtocol(serverProtocol))
def openShell(self, protocol): serverProtocol = cowrie.core.protocol.LoggingServerProtocol( cowrie.core.protocol.HoneyPotInteractiveProtocol, self) serverProtocol.makeConnection(protocol) protocol.makeConnection(session.wrapProtocol(serverProtocol))