Example #1
0
    def end(self):
        """
        This method is called when the plugin wont be used anymore.
        """
        headers = kb.kb.get('strange_headers', 'strange_headers')
        # This is how I saved the data:
        #    i['header_name'] = header_name
        #    i['header_value'] = response.get_headers()[header_name]

        # Group correctly
        tmp = []
        for i in headers:
            tmp.append((i['header_name'], i.get_url()))

        # And don't print duplicates
        tmp = list(set(tmp))

        resDict, itemIndex = group_by_min_key(tmp)
        if itemIndex == 0:
            # Grouped by header_name
            msg = 'The header: "%s" was sent by these URLs:'
        else:
            # Grouped by URL
            msg = 'The URL: "%s" sent these strange headers:'

        for k in resDict:
            om.out.information(msg % k)
            for i in resDict[k]:
                om.out.information('- ' + i)
    def end(self):
        """
        This method is called when the plugin wont be used anymore.
        """
        headers = kb.kb.get('strange_headers', 'strange_headers')
        # This is how I saved the data:
        #    i['header_name'] = header_name
        #    i['header_value'] = response.get_headers()[header_name]

        # Group correctly
        tmp = []
        for i in headers:
            tmp.append((i['header_name'], i.get_url()))

        # And don't print duplicates
        tmp = list(set(tmp))

        resDict, itemIndex = group_by_min_key(tmp)
        if itemIndex == 0:
            # Grouped by header_name
            msg = 'The header: "%s" was sent by these URLs:'
        else:
            # Grouped by URL
            msg = 'The URL: "%s" sent these strange headers:'

        for k in resDict:
            om.out.information(msg % k)
            for i in resDict[k]:
                om.out.information('- ' + i)
    def end(self):
        """
        This method is called when the plugin wont be used anymore.
        """
        cookies = kb.kb.get('analyze_cookies', 'cookies')
        tmp = list(set([(c['cookie-string'], c.get_url()) for c in cookies]))

        res_dict, item_idx = group_by_min_key(tmp)

        if item_idx:
            # Grouped by URLs
            msg = u'The URL: "%s" sent these cookies:'
        else:
            # Grouped by cookies
            msg = u'The cookie: "%s" was sent by these URLs:'

        for k in res_dict:
            to_print = msg % k

            for i in res_dict[k]:
                # Switch depending on the type of grouping returned by
                # group_by_min_key
                if isinstance(i, unicode):
                    # it's the cookie as string
                    to_print += u'\n- ' + i
                else:
                    # it's a URL
                    to_print += u'\n- ' + i.url_string.decode('utf-8',
                                                              errors='ignore')

            om.out.information(to_print)
Example #4
0
    def end(self):
        """
        This method is called when the plugin wont be used anymore.
        """
        cookies = kb.kb.get('analyze_cookies', 'cookies')
        tmp = list(set([(c['cookie-string'], c.get_url()) for c in cookies]))

        res_dict, item_idx = group_by_min_key(tmp)

        if item_idx:
            # Grouped by URLs
            msg = u'The URL: "%s" sent these cookies:'
        else:
            # Grouped by cookies
            msg = u'The cookie: "%s" was sent by these URLs:'

        for k in res_dict:
            to_print = msg % k

            for i in res_dict[k]:
                # Switch depending on the type of grouping returned by
                # group_by_min_key
                if isinstance(i, unicode):
                    # it's the cookie as string
                    to_print += u'\n- ' + i
                else:
                    # it's a URL
                    to_print += u'\n- ' + i.url_string.decode('utf-8',
                                                              errors='ignore')

            om.out.information(to_print)
Example #5
0
    def end(self):
        """
        Print the results.
        """
        # First I get the data from the kb
        all_info_obj = kb.kb.get('allowed_methods', 'methods')
        dav_info_obj = kb.kb.get('allowed_methods', 'dav-methods')

        # Now I transform it to something I can use with group_by_min_key
        allMethods = []
        for i in all_info_obj:
            allMethods.append((i.get_url(), i['methods']))

        davMethods = []

        for i in dav_info_obj:
            davMethods.append((i.get_url(), i['methods']))

        # Now I work the data...
        to_show, method_type = davMethods, ' DAV'
        if not self._report_dav_only:
            to_show, method_type = allMethods, ''

        # Make it hashable
        tmp = []
        for url, methodList in to_show:
            tmp.append((url, ', '.join(methodList)))

        result_dict, itemIndex = group_by_min_key(tmp)

        for k in result_dict:
            if itemIndex == 0:
                # Grouped by URLs
                msg = 'The URL: "%s" has the following' + \
                      method_type + ' methods enabled:'
                om.out.information(msg % k)
            else:
                # Grouped by Methods
                msg = 'The methods: ' + k + \
                      ' are enabled on the following URLs:'
                om.out.information(msg)

            for i in result_dict[k]:
                om.out.information('- ' + i)
Example #6
0
    def end(self):
        """
        Print the results.
        """
        # First I get the data from the kb
        all_info_obj = kb.kb.get('allowed_methods', 'methods')
        dav_info_obj = kb.kb.get('allowed_methods', 'dav-methods')

        # Now I transform it to something I can use with group_by_min_key
        allMethods = []
        for i in all_info_obj:
            allMethods.append((i.get_url(), i['methods']))

        davMethods = []

        for i in dav_info_obj:
            davMethods.append((i.get_url(), i['methods']))

        # Now I work the data...
        to_show, method_type = davMethods, ' DAV'
        if not self._report_dav_only:
            to_show, method_type = allMethods, ''

        # Make it hashable
        tmp = []
        for url, methodList in to_show:
            tmp.append((url, ', '.join(methodList)))

        result_dict, itemIndex = group_by_min_key(tmp)

        for k in result_dict:
            if itemIndex == 0:
                # Grouped by URLs
                msg = 'The URL: "%s" has the following' + \
                    method_type + ' methods enabled:'
                om.out.information(msg % k)
            else:
                # Grouped by Methods
                msg = 'The methods: ' + k + \
                    ' are enabled on the following URLs:'
                om.out.information(msg)

            for i in result_dict[k]:
                om.out.information('- ' + i)
Example #7
0
    def end(self):
        """
        This method is called when the plugin wont be used anymore.
        """
        cookies = kb.kb.get('analyze_cookies', 'cookies')

        tmp = list(set([(c['cookie-string'], c.get_url()) for c in cookies]))
        res_dict, item_idx = group_by_min_key(tmp)
        if item_idx:
            # Grouped by URLs
            msg = 'The URL: "%s" sent these cookies:'
        else:
            # Grouped by cookies
            msg = 'The cookie: "%s" was sent by these URLs:'

        for k in res_dict:
            to_print = msg % k

            for i in res_dict[k]:
                to_print += '\n- ' + i

            om.out.information(to_print)
Example #8
0
    def end(self):
        """
        This method is called when the plugin wont be used anymore.
        """
        cookies = kb.kb.get('analyze_cookies', 'cookies')

        tmp = list(set([(c['cookie-string'], c.get_url()) for c in cookies]))
        res_dict, item_idx = group_by_min_key(tmp)
        if not item_idx:
            # Grouped by URLs
            msg = 'The URL: "%s" sent these cookies:'
        else:
            # Grouped by cookies
            msg = 'The cookie: "%s" was sent by these URLs:'

        for k in res_dict:
            to_print = msg % k

            for i in res_dict[k]:
                to_print += '\n- ' + i

            om.out.information(to_print)