コード例 #1
0
ファイル: bug_report.py プロジェクト: Adastra-thw/w3af
    def _report_exception(self, edata, eid, num, total):
        '''
        Report one or more bugs to w3af's Github, submit data to server.
        '''
        gh = GithubIssues(OAUTH_TOKEN)
        if not gh.login():
            msg = 'Failed to contact github.com. Please try again later.'
            om.out.console(msg)
        else:
            traceback_str = edata.traceback_str
            desc = edata.get_summary()
            plugins = edata.enabled_plugins
            summary = str(edata.exception)

            ticket_id, ticket_url = gh.report_bug(summary, desc,
                                                  tback=traceback_str,
                                                  plugins=plugins)

            if ticket_id is None:
                msg = '    [%s/%s] Failed to report bug with id %s.' % (
                    num, total, eid)
            else:
                msg = '    [%s/%s] Bug with id %s reported at %s' % (
                    num, total, eid, ticket_url)

            om.out.console(str(msg))
コード例 #2
0
    def _report_exception(self, edata, eid, num, total):
        '''
        Report one or more bugs to w3af's Github, submit data to server.
        '''
        gh = GithubIssues(OAUTH_TOKEN)
        if not gh.login():
            msg = 'Failed to contact github.com. Please try again later.'
            om.out.console(msg)
        else:
            traceback_str = edata.traceback_str
            desc = edata.get_summary()
            plugins = edata.enabled_plugins
            summary = str(edata.exception)

            ticket_id, ticket_url = gh.report_bug(summary,
                                                  desc,
                                                  tback=traceback_str,
                                                  plugins=plugins)

            if ticket_id is None:
                msg = '    [%s/%s] Failed to report bug with id %s.' % (
                    num, total, eid)
            else:
                msg = '    [%s/%s] Bug with id %s reported at %s' % (
                    num, total, eid, ticket_url)

            om.out.console(str(msg))
コード例 #3
0
    def test_report(self):
        gh = GithubIssues(OAUTH_TOKEN)
        gh.login()
        
        summary = 'Unittest bug report'
        userdesc = 'Please remove this ticket'

        ticket_id, ticket_url = gh.report_bug(summary, userdesc)
        self.assertIsInstance(ticket_id, int)
        self.assertTrue(ticket_url.startswith(
            'https://github.com/andresriancho/w3af/issues/'))
        
        # Remove the ticket I've just created
        gh = Github(OAUTH_TOKEN)
        repo = gh.get_user('andresriancho').get_repo('w3af')
        issue = repo.get_issue(ticket_id)
        issue.edit(state='closed')
コード例 #4
0
ファイル: test_github_issues.py プロジェクト: weisst/w3af
    def test_report(self):
        gh = GithubIssues(OAUTH_TOKEN)
        gh.login()

        summary = 'Unittest bug report'
        userdesc = 'Please remove this ticket'

        ticket_id, ticket_url = gh.report_bug(summary, userdesc)
        self.assertIsInstance(ticket_id, int)
        self.assertTrue(
            ticket_url.startswith(
                'https://github.com/andresriancho/w3af/issues/'))

        # Remove the ticket I've just created
        gh = Github(OAUTH_TOKEN)
        repo = gh.get_user('andresriancho').get_repo('w3af')
        issue = repo.get_issue(ticket_id)
        issue.edit(state='closed')