예제 #1
0
파일: console_ui.py 프로젝트: HamzaKo/w3af
    def sh(self, name='w3af', callback=None):
        '''
        Main cycle
        '''
        try:
            if callback:
                if hasattr(self, '_context'):
                    ctx = self._context
                else:
                    ctx = None
                self._context = callbackMenu(
                    name, self, self._w3af, ctx, callback)
            else:
                self._context = rootMenu(name, self, self._w3af)

            self._lastWasArrow = False
            self._showPrompt()
            self._active = True
            term.setRawInputMode(True)

            self._executePending()

            while self._active:
                try:
                    c = term.getch()
                    self._handleKey(c)
                except Exception, e:
                    om.out.console(str(e))

            term.setRawInputMode(False)
예제 #2
0
파일: console_ui.py 프로젝트: daemon13/w3af
    def sh(self, name='w3af', callback=None):
        '''
        Main cycle
        '''
        try:
            if callback:
                if hasattr(self, '_context'):
                    ctx = self._context
                else:
                    ctx = None
                self._context = callbackMenu(name, self, self._w3af, ctx,
                                             callback)
            else:
                self._context = rootMenu(name, self, self._w3af)

            self._lastWasArrow = False
            self._showPrompt()
            self._active = True
            term.setRawInputMode(True)

            self._executePending()

            while self._active:
                try:
                    c = term.getch()
                    self._handleKey(c)
                except Exception, e:
                    om.out.console(str(e))

            term.setRawInputMode(False)
예제 #3
0
    def _cmd_interact(self, parameters):
        '''
        Show the available shells and interact with them.
        '''
        if len(parameters) not in (0, 1):
            self._cmd_help(['interact'])
            return

        if len(parameters) == 0:
            om.out.console('No shell objects available; please use the exploit'
                           ' plugins to create them.')
            self._show()
            return

        try:
            self._selected_shell = int(parameters[0])
        except ValueError:
            self._cmd_help(['interact'])
            return

        # Do we have shells?
        if not len(self._exploit_results):
            msg = 'No shells available.'
            om.out.error(msg)
            return

        # Check that the user selected a valid shell
        if self._selected_shell not in range(len(self._exploit_results)):
            msg = 'Please select a shell in range [0-%s].'
            srange = len(self._exploit_results) - 1
            om.out.error(msg % srange)
            return

        # And now check that the "shell" is actually a shell
        # because maybe the user want's to interact with a proxy :S
        # TODO: I should use different variables to store shells and proxies
        if not isinstance(self._exploit_results[self._selected_shell], Shell):
            msg = 'You can only interact with shell objects.'\
                  ' To interact with proxy objects, please use'\
                  ' your browser.'
            om.out.error(msg)
            return

        # Everything ok!
        prompt = self._exploit_results[self._selected_shell].get_name()

        msg = 'Execute "exit" to get out of the remote shell.'\
              ' Commands typed in this menu will be run through the %s shell.'
        om.out.console(msg % prompt)
        prompt = prompt + '-' + str(self._selected_shell)
        return callbackMenu(prompt, self._console, self._w3af, self,
                            self._callback)
예제 #4
0
파일: exploit.py 프로젝트: HamzaKo/w3af
    def _cmd_interact(self, parameters):
        '''
        Show the available shells and interact with them.
        '''
        if len(parameters) not in (0, 1):
            self._cmd_help(['interact'])
            return

        if len(parameters) == 0:
            om.out.console('No shell objects available; please use the exploit'
                           ' plugins to create them.')
            self._show()
            return
        
        try:
            self._selected_shell = int(parameters[0])
        except ValueError:
            self._cmd_help(['interact'])
            return

        # Do we have shells?
        if not len(self._exploit_results):
            msg = 'No shells available.'
            om.out.error(msg)
            return
        
        # Check that the user selected a valid shell
        if self._selected_shell not in range(len(self._exploit_results)):
            msg = 'Please select a shell in range [0-%s].'
            srange = len(self._exploit_results) - 1
            om.out.error(msg % srange)
            return

        # And now check that the "shell" is actually a shell
        # because maybe the user want's to interact with a proxy :S
        # TODO: I should use different variables to store shells and proxies
        if not isinstance(self._exploit_results[self._selected_shell], Shell):
            msg = 'You can only interact with shell objects.'\
                  ' To interact with proxy objects, please use'\
                  ' your browser.'
            om.out.error(msg)
            return
        
        # Everything ok!
        prompt = self._exploit_results[self._selected_shell].get_name()

        msg = 'Execute "exit" to get out of the remote shell.'\
              ' Commands typed in this menu will be run through the %s shell.'
        om.out.console(msg % prompt)
        prompt = prompt + '-' + str(self._selected_shell)
        return callbackMenu(prompt, self._console, self._w3af, self, self._callback)