def onecmd(self, line): """Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop. """ cmd, arg, line = self.parseline(line) if not line: return self.emptyline() if cmd is None: return self.default(line) self.lastcmd = line if line == 'EOF' : #self.lastcmd = '' raise EOFError() if cmd == '': return self.default(line) if cmd: try: func = getattr(self, 'do_' + cmd.lstrip(':')) except AttributeError: return self.default(line) return func(arg, cmd) else: return self.default(line)
def onecmd(self, line): """Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop. """ cmd, arg, line = self.parseline(line) if not line: return self.emptyline() if cmd is None: return self.default(line) self.lastcmd = line if line == 'EOF': #self.lastcmd = '' raise EOFError() if cmd == '': return self.default(line) if cmd: try: func = getattr(self, 'do_' + cmd.lstrip(':')) except AttributeError: return self.default(line) return func(arg, cmd) else: return self.default(line)
def onecmd(self, line): """Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop. """ cmd, arg, line = self.parseline(line) if not line: return self.emptyline() if cmd in (None, ''): return self.default(line) self.lastcmd = line if line == 'EOF': #self.lastcmd = '' raise EOFError() if cmd: # Try running module command try: func = getattr(self, 'do_' + cmd.lstrip(':')) except AttributeError: # If there is no module command, check if we have a PHP shelli # And in case try running alias command if self.session.get( 'default_shell') == 'shell_php' or cmd.lstrip( ':') == 'cd': try: func = getattr(self, 'do_alias_' + cmd.lstrip(':')) except AttributeError: pass else: return func(arg, cmd) else: return func(arg, cmd) return self.default(line)