def do_alias(self, argv): """Define command aliases SYNOPSIS: alias [<NAME> ["<VALUE>"|None]] DESCRIPTION: Command aliases can be defined in order to ease phpsploit shell experience. Once defined, an alias can be used as if it was a standard command, and it's value is interpreted, then suffixed with arguments passed to the command line (if any). NOTE: This core command works like the unix bash `alias` command. > alias - Display all current command aliases. > alias <NAME> - Display aliases whose name starts with NAME. > alias <NAME> <VALUE> - Set NAME alias to the given VALUE. > alias <NAME> None - Unset NAME command alias. BEHAVIOR: - Unlike settings, aliases do not provide dynamic random values. Setting a value is simply interpreted as a string, apart for the special "None" value, which removes the variable. """ if len(argv) < 3: # `alias [<PATTERN>]` display concerned settings list print(session.Alias((argv + [""])[1])) else: # `alias <NAME> <VALUE>` existed = argv[1] in session.Alias session.Alias[argv[1]] = " ".join(argv[2:]) exists = argv[1] in session.Alias if existed and not exists: print("[*] `%s` alias correctly deleted." % argv[1]) elif existed and exists: print("[-] `%s` alias correctly overridden." % argv[1]) elif exists: if argv[1] in self.get_names(self, "do_"): print("[-] Warning: %r command overridden" " (run `alias %s None` to unset alias)" % (argv[1], argv[1])) elif argv[1] in plugins.keys(): print("[-] Warning: %r plugin overridden" " (run `alias %s None` to unset alias)" % (argv[1], argv[1]))
def do_alias(self, argv): """Define command aliases SYNOPSIS: alias [<NAME> ["<VALUE>"|None]] DESCRIPTION: Command aliases can be defined in order to ease phpsploit shell experience. Once defined, an alias can be used as if it was a standard command, and it's value is interpreted, then suffixed with arguments passed to the command line (if any). NOTE: This core command works like the unix bash `alias` command. > alias - Display all current command aliases. > alias <NAME> - Display aliases whose name starts with NAME. > alias <NAME> <VALUE> - Set NAME alias to the given VALUE. > alias <NAME> None - Unset NAME command alias. BEHAVIOR: - Unlike settings, aliases do not provide dynamic random values. Setting a value is simply interpreted as a string, apart for the special "None" value, which removes the variable. """ # `alias [<PATTERN>]` display concerned settings list if len(argv) < 3: return print(session.Alias((argv + [""])[1])) # `alias <NAME> <VALUE>` session.Alias[argv[1]] = " ".join(argv[2:])