示例#1
0
 def completenames(self, text, *ignored):
     """Add aliases and plugins for completion"""
     result = super().completenames(text, ignored)
     result += session.Alias.keys()
     if tunnel:
         result += plugins.keys()
     return ([x for x in list(set(result)) if x.startswith(text)])
示例#2
0
 def default(self, argv):
     """Fallback to plugin command (if any)"""
     if argv[0] in plugins.keys():
         if tunnel:
             return plugins.run(argv)
         self.nocmd = "[-] Must connect to run `%s` plugin (`help exploit`)"
     return super().default(argv)
示例#3
0
 def completenames(self, text, *ignored):
     """Add aliases and plugins for completion"""
     result = super().completenames(text, ignored)
     result += session.Alias.keys()
     if tunnel:
         result += plugins.keys()
     return ([x for x in list(set(result)) if x.startswith(text)])
示例#4
0
 def complete_bind(self, text, *ignored):
     """autocompletion for `bind` command"""
     result = super().completenames(text, ignored)
     result = [x for x in result if x != "bind"]
     if tunnel:
         result += plugins.keys()
     return [x for x in list(set(result)) if x.startswith(text)]
示例#5
0
 def default(self, argv):
     """Fallback to plugin command (if any)"""
     if argv[0] in plugins.keys():
         if tunnel:
             return plugins.run(argv)
         self.nocmd = "[-] Must connect to run `%s` plugin (`help exploit`)"
     return super().default(argv)
示例#6
0
 def complete_bind(self, text, line, *_):
     """autocompletion for `bind` command"""
     result = self.completenames(text, line, *_)
     if not result:
         return []
     result = [x for x in result if x != "bind"]
     if tunnel:
         result += plugins.keys()
     return [x for x in list(set(result)) if x.startswith(text)]
示例#7
0
 def complete_bind(self, text, line, *_):
     """autocompletion for `bind` command"""
     result = self.completenames(text, line, *_)
     if not result:
         return []
     result = [x for x in result if x != "bind"]
     if tunnel:
         result += plugins.keys()
     return [x for x in list(set(result)) if x.startswith(text)]
示例#8
0
    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]))
示例#9
0
    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]))
示例#10
0
 def complete_bind(self, text, *ignored):
     result = super().completenames(text, ignored)
     result = [x for x in result if x != "bind"]
     if tunnel:
         result += plugins.keys()
     return ([x for x in list(set(result)) if x.startswith(text)])
示例#11
0
 def default(self, argv):
     """Fallback to plugin command (if any)"""
     if tunnel and argv[0] in plugins.keys():
         return plugins.run(argv)
     else:
         return super().default(argv)
示例#12
0
 def default(self, argv):
     """Fallback to plugin command (if any)"""
     if tunnel and argv[0] in plugins.keys():
         plugins.run(argv)
     else:
         return super().default(argv)