Пример #1
0
    def _build_summary_and_desc(self, summary, desc, tback, fname, plugins,
                                autogen, email):
        """
        Build the formatted summary and description that will be
        part of the reported bug.
        """
        #
        #    Define which summary to use
        #
        if summary:
            bug_summary = summary
        else:
            # Try to extract the last line from the traceback:
            if tback:
                bug_summary = tback.split('\n')[-2]
            else:
                # Failed... lets generate something random!
                m = hashlib.md5()
                m.update(time.ctime())
                bug_summary = m.hexdigest()

        # Generate the summary string. Concat 'user_title'
        summary = '%sBug Report - %s' % (autogen and '[Auto-Generated] '
                                         or '', bug_summary)

        if desc.strip() == DEFAULT_BUG_QUERY_TEXT.strip():
            desc = ''

        #
        # Define which description to use (depending on the availability of an
        # email provided by the user or not).
        #
        if email is not None:
            email_fmt = '\n\nThe user provided the following email address for'\
                        'contact: %s'
            desc += email_fmt % email

        # Build details string
        details = ''
        if desc:
            details += desc
            details += '\n'

        details += '## Version Information\n'
        details += '```\n'
        details += get_versions()
        details += '\n```\n'

        details += '## Traceback\n'
        details += '```pytb\n'
        details += tback
        details += '\n```\n'

        if plugins:
            details += '## Enabled Plugins\n'
            details += '```python\n'
            details += plugins
            details += '\n```\n'

        return summary, details
Пример #2
0
    def _build_summary_and_desc(self, summary, desc, tback, fname, plugins,
                                autogen, email):
        """
        Build the formatted summary and description that will be
        part of the reported bug.
        """
        #
        #    Define which summary to use
        #
        if summary:
            bug_summary = summary
        else:
            # Try to extract the last line from the traceback:
            if tback:
                bug_summary = tback.split('\n')[-2]
            else:
                # Failed... lets generate something random!
                m = hashlib.md5()
                m.update(time.ctime())
                bug_summary = m.hexdigest()

        # Generate the summary string. Concat 'user_title'. If empty, append a
        # random token to avoid the double click protection added by sourceforge.
        summary = '%sBug Report - %s' % (autogen and '[Auto-Generated] '
                                         or '', bug_summary)

        #
        #    Define which description to use (depending on the availability of an
        #    email provided by the user or not).
        #
        if email is not None:
            email_fmt = '\n\nThe user provided the following email address for'\
                        'contact: %s'
            desc += email_fmt % email

        #
        #    Apply all the info
        #
        bdata = {
            'plugins': plugins,
            't_back': tback,
            'user_desc': desc,
            'w3af_v': get_versions()
        }

        # Build details string
        details = TICKET_TEMPLATE.safe_substitute(bdata)

        return summary, details
Пример #3
0
    def _build_summary_and_desc(self, summary, desc, tback,
                                fname, plugins, autogen, email):
        """
        Build the formatted summary and description that will be
        part of the reported bug.
        """
        #
        #    Define which summary to use
        #
        if summary:
            bug_summary = summary
        else:
            # Try to extract the last line from the traceback:
            if tback:
                bug_summary = tback.split('\n')[-2]
            else:
                # Failed... lets generate something random!
                m = hashlib.md5()
                m.update(time.ctime())
                bug_summary = m.hexdigest()

        # Generate the summary string. Concat 'user_title'. If empty, append a
        # random token to avoid the double click protection added by sourceforge.
        summary = '%sBug Report - %s' % (
            autogen and '[Auto-Generated] ' or '',
            bug_summary)

        #
        #    Define which description to use (depending on the availability of an
        #    email provided by the user or not).
        #
        if email is not None:
            email_fmt = '\n\nThe user provided the following email address for'\
                        'contact: %s'
            desc += email_fmt % email

        #
        #    Apply all the info
        #
        bdata = {'plugins': plugins, 't_back': tback,
                 'user_desc': desc, 'w3af_v': get_versions()}

        # Build details string
        details = TICKET_TEMPLATE.safe_substitute(bdata)

        return summary, details
Пример #4
0
    def _build_summary_and_desc(self, summary, desc, tback,
                                fname, plugins, autogen, email):
        """
        Build the formatted summary and description that will be
        part of the reported bug.
        """
        #
        #    Define which summary to use
        #
        if summary:
            bug_summary = summary
        else:
            # Try to extract the last line from the traceback:
            if tback:
                bug_summary = tback.split('\n')[-2]
            else:
                # Failed... lets generate something random!
                m = hashlib.md5()
                m.update(time.ctime())
                bug_summary = m.hexdigest()

        # Generate the summary string. Concat 'user_title'
        summary = '%sBug Report - %s' % (
            autogen and '[Auto-Generated] ' or '',
            bug_summary)

        if desc.strip() == DEFAULT_BUG_QUERY_TEXT.strip():
            desc = ''

        #
        #    Define which description to use (depending on the availability of an
        #    email provided by the user or not).
        #
        if email is not None:
            email_fmt = '\n\nThe user provided the following email address for'\
                        'contact: %s'
            desc += email_fmt % email

        # Build details string
        details = ''
        if desc:
            details += desc
            details += '\n'

        details += '## Version Information\n'
        details += '```\n'
        details += get_versions()
        details += '\n```\n'

        details += '## Traceback\n'
        details += '```pytb\n'
        details += tback
        details += '\n```\n'

        if plugins:
            details += '## Enabled Plugins\n'
            details += '```python\n'
            details += plugins
            details += '\n```\n'

        return summary, details