Пример #1
0
 def do_disconnect(argv):
     """Disconnect from target server."""
     if tunnel:
         tunnel.close()
         return True
     else:
         print("[-] Not connected to target server!")
Пример #2
0
    def do_exit(self, argv):
        """Quit current shell interface

        SYNOPSIS:
            exit [--force]

        OPTIONS:
            --force
                When called to leave the framework, this
                option forces exit, avoiding warning message
                if current session has not been saved to a file,
                or has changed since last save.

        DESCRIPTION:
            If current phpsploit session is connected to $TARGET,
            this command disconnects the user from remote session.
            Otherwise, if the interface is not connected, this
            command leaves the phpsploit framework.
        """
        if len(argv) == 2 and argv[1] == "--force":
            force_exit = True
        elif len(argv) == 1:
            force_exit = False
        else:
            self.interpret("help exit")
            return False
        if not self.stdout.isatty() and not self.stdin.isatty():
            force_exit = True

        if self.bind_command:
            self.bind_command = None
        elif tunnel:
            tunnel.close()
        else:
            if not force_exit:
                try:
                    session_changed = session.diff(None)
                except OSError:
                    session_changed = bool(tunnel.has_been_active())
                if session_changed:
                    msg = "Do you really want to exit without saving session ?"
                    if ui.input.Expect(False)(msg):
                        return False
            exit()
        return True  # make pylint happy
Пример #3
0
    def do_exit(self, argv):
        """Quit current shell interface

        SYNOPSIS:
            exit [--force]

        OPTIONS:
            --force
                When called to leave the framework, this
                option forces exit, avoiding warning message
                if current session has not been saved to a file,
                or has changed since last save.

        DESCRIPTION:
            If current phpsploit session is connected to $TARGET,
            this command disconnects the user from remote session.
            Otherwise, if the interface is not connected, this
            command leaves the phpsploit framework.
        """
        if len(argv) == 2 and argv[1] == "--force":
            force_exit = True
        elif len(argv) == 1:
            force_exit = False
        else:
            self.interpret("help exit")

        if self.binded_command:
            self.binded_command = None
        elif tunnel:
            tunnel.close()
        else:
            if force_exit is False:
                try:
                    session_changed = session.diff(None)
                except OSError:
                    if tunnel.has_been_active():
                        session_changed = True
                    else:
                        session_changed = False
                if session_changed:
                    msg = "Do you really want to exit without saving session ?"
                    if ui.input.Expect(False)(msg):
                        return False
            exit()
Пример #4
0
    def do_exit(self, argv):
        """Exit Omega Framework.

        USAGE:
            exit

        OPTIONS:
            --force
                When called to leave the framework, this
                option forces exit, avoiding warning message
                if current session has not been saved to a file,
                or has changed since last save.

        DESCRIPTION:
            If current Omega session is connected to target,
            this command disconnects the user from remote session.
            Otherwise, if the interface is not connected, this
            command leaves the Omega Framework.
        """
        if len(argv) == 2 and argv[1] == "--force":
            force_exit = True
        elif len(argv) == 1:
            force_exit = False
        else:
            self.interpret("help exit")
            return False

        if self.bind_command:
            self.bind_command = None
        elif tunnel:
            tunnel.close()
        else:
            if not force_exit:
                try:
                    session_changed = session.diff(None)
                except OSError:
                    session_changed = bool(tunnel.has_been_active())
            exit()
        return True # make pylint happy
Пример #5
0
 def do_exit(self, argv):
     """Exit Omega Framework."""
     if tunnel:
         tunnel.close()
     exit()