示例#1
0
    def __do_request(self, listcmd, mode):

        cmd = listcmd
        if isinstance(listcmd, types.ListType):
            cmd = ' '.join(listcmd)

        request = CmdRequest(self.modhandler.url, self.modhandler.password,
                             self.args['proxy'])
        request.setPayload(cmd, mode)

        msg_class = self.args['debug']

        if self.args['post']:
            request.setPostData(self.args['post'])
            self.mprint("Post data values:", msg_class)
            for field in self.args['post']:
                self.mprint(
                    "  %s (%i)" % (field, len(self.args['post'][field])),
                    msg_class)

        self.mprint("Request: %s" % (cmd), msg_class)

        try:
            response = request.execute()
        except NoDataException, e:
            raise ProbeException(self.name, WARN_NO_RESPONSE)
示例#2
0
文件: php.py 项目: Carbon3/Weevely
    def __do_request(self, listcmd, mode):

        cmd = listcmd
        if isinstance(listcmd, types.ListType):
            cmd = ' '.join(listcmd)

        request = CmdRequest(
            self.modhandler.url, self.modhandler.password, self.args['proxy'])
        request.setPayload(cmd, mode)

        msg_class = self.args['debug']

        if self.args['post']:
            request.setPostData(self.args['post'])
            self.mprint("Post data values:", msg_class)
            for field in self.args['post']:
                self.mprint("  %s (%i)" %
                            (field, len(self.args['post'][field])), msg_class)

        self.mprint("Request: %s" % (cmd), msg_class)

        try:
            response = request.execute()
        except NoDataException, e:
            raise ProbeException(self.name, WARN_NO_RESPONSE)
示例#3
0
文件: php.py 项目: t3ll0/Weevely
    def run_module(self, cmd, mode = None, proxy = None, precmd= None, debug = None):

        if mode:
            self.mode = mode

        if proxy:
            if not self.proxy:
                self.mprint('[!] Proxies can break weevely requests, if possibile use proxychains')
            self.proxy = { 'http' : proxy }

        # Debug and precmd are to force also if called with None like other modules do
        if debug == None:
            debug = self.params.get_parameter_value('debug')
        if precmd == None:
            precmd = self.params.get_parameter_value('precmd')

        if self.use_current_path and self.cwd_vector and self.path:
            cmd = self.cwd_vector % (self.path, cmd)

        if precmd:
            cmd = precmd + ' ' + cmd

        cmd = cmd.strip()
        if cmd and cmd[-1] not in (';', '}'):
            self.mprint('[!] Warning: PHP command \'..%s\' doesn\'t have trailing semicolon' % (cmd[-10:]))

        request = CmdRequest( self.url, self.password, self.proxy)
        request.setPayload(cmd, self.current_mode)


        debug_level = 1
        if debug:
            debug_level = 5

        if self.post_data:
            request.setPostData(self.post_data)
            self.mprint( "Post data values:", debug_level)
            for p in self.post_data:
                self.mprint("  %s (%i)" % (p, len(self.post_data[p])), debug_level)
            self.post_data = {}


        self.mprint( "Request: %s" % (cmd), debug_level)


        try:
            resp = request.execute()
        except NoDataException, e:
            self.mprint( "Response: NoData", debug_level)
            pass
    def run_module(self, cmd, mode = None, proxy = None, debug = None):

        if mode:
            self.mode = mode
            
        if proxy:
            if not self.proxy:
                self.mprint('[!] Proxies can break weevely requests, if possibile use proxychains')
            self.proxy = { 'http' : proxy }
        
        # Debug is equal to None only if called directly by run_module
        if debug == None:
            debug = self.params.get_parameter_value('debug')

        if self.use_current_path and self.cwd_vector and self.path:
            cmd = self.cwd_vector % (self.path, cmd)
        
        if cmd.strip() and cmd.strip()[-1] not in (';', '}'):
            self.mprint('[!] Warning: PHP command with no trailing semicolon')
        
        request = CmdRequest( self.url, self.password, self.proxy)
        request.setPayload(cmd, self.current_mode)

            
    
        debug_level = 1
        if debug:
            debug_level = 5
        
        if self.post_data:
            request.setPostData(self.post_data)
            self.mprint( "Post data values:", debug_level)
            for p in self.post_data:
                self.mprint("  %s (%i)" % (p, len(self.post_data[p])), debug_level)
            self.post_data = {}

            
        self.mprint( "Request: %s" % (cmd), debug_level)
         
        
        try:
            resp = request.execute()
        except NoDataException, e:
            self.mprint( "Response: NoData", debug_level)
            pass
示例#5
0
    def run_module(self, cmd, mode=None, proxy=None, debug=None):

        if mode:
            self.mode = mode

        if proxy:
            if not self.proxy:
                self.mprint(
                    '[!] Proxies can break weevely requests, if possibile use proxychains'
                )
            self.proxy = {'http': proxy}

        # Debug is equal to None only if called directly by run_module
        if debug == None:
            debug = self.params.get_parameter_value('debug')

        if self.use_current_path and self.cwd_vector and self.path:
            cmd = self.cwd_vector % (self.path, cmd)

        if cmd.strip() and cmd.strip()[-1] not in (';', '}'):
            self.mprint('[!] Warning: PHP command with no trailing semicolon')

        request = CmdRequest(self.url, self.password, self.proxy)
        request.setPayload(cmd, self.current_mode)

        debug_level = 1
        if debug:
            debug_level = 5

        if self.post_data:
            request.setPostData(self.post_data)
            self.mprint("Post data values:", debug_level)
            for p in self.post_data:
                self.mprint("  %s (%i)" % (p, len(self.post_data[p])),
                            debug_level)
            self.post_data = {}

        self.mprint("Request: %s" % (cmd), debug_level)

        try:
            resp = request.execute()
        except NoDataException, e:
            self.mprint("Response: NoData", debug_level)
            pass