コード例 #1
0
ファイル: handled.py プロジェクト: 1d3df9903ad/w3af
def handle_exceptions():
    '''
    In w3af's new exception handling method, some exceptions raising from
    plugins are "allowed" and the scan is NOT stopped because of them.
    
    At the same time, developers still want users to report their bugs.
    
    Because of that, we need to have a handler that at the end of the scan
    will allow the user to report the exceptions that were found during the
    scan.
    
    The main class in this game is core.controllers.coreHelpers.exception_handler
    and you should read it before this one.
    ''' 
    # Save the info to a file for later analysis by the user   
    for edata in exception_handler.get_all_exceptions():
        edata_str = edata.get_details()
        create_crash_file(edata_str)

    msg = 'Complete information related to the exceptions is available at "%s"'
    print msg  % gettempdir()
    
    # We do this because it would be both awful and useless to simply
    # print all exceptions one below the other in the console
    print exception_handler.generate_summary_str()
    
    # Create the dialog that allows the user to send the bugs, potentially more
    # than one since we captured all of them during the scan using the new
    # exception_handler, to Trac.
    title = _('Handled exceptions to report')
    bug_report_win = handled_bug_report.bug_report_window( title )
    
    # Blocks waiting for user interaction
    bug_report_win.show()
コード例 #2
0
ファイル: unhandled.py プロジェクト: sanzomaldini/w3af
def handle_crash(type, value, tb, plugins=""):
    """Function to handle any exception that is not addressed explicitly."""
    if issubclass(type, KeyboardInterrupt):
        helpers.endThreads()
        import core.controllers.outputManager as om

        om.out.console(_("Thanks for using w3af."))
        om.out.console(_("Bye!"))
        sys.exit(0)
        return

    # Print the information to the console so everyone can see it
    exception = traceback.format_exception(type, value, tb)
    exception = "".join(exception)
    print exception

    # Do not disclose user information in bug reports
    clean_exception = cleanup_bug_report(exception)

    # Save the info to a file for later analysis
    filename = create_crash_file(clean_exception)

    # Create the dialog that allows the user to send the bug to Trac
    bug_report_win = unhandled_bug_report.bug_report_window(_("Bug detected!"), clean_exception, filename, plugins)

    # Blocks waiting for user interaction
    bug_report_win.show()
コード例 #3
0
ファイル: unhandled.py プロジェクト: weisst/w3af
def handle_crash(w3af_core, _type, value, tb, plugins=''):
    '''Function to handle any exception that is not addressed explicitly.'''
    if issubclass(_type, KeyboardInterrupt):
        handle_keyboardinterrupt(w3af_core)

    # Print the information to the console so everyone can see it
    exception = traceback.format_exception(_type, value, tb)
    exception = "".join(exception)
    print exception

    # Do not disclose user information in bug reports
    clean_exception = cleanup_bug_report(exception)

    # Save the info to a file for later analysis
    filename = create_crash_file(clean_exception)

    # Create the dialog that allows the user to send the bug to github
    bug_report_win = unhandled_bug_report.bug_report_window(
        w3af_core, _('Bug detected!'), clean_exception, filename, plugins)

    # Blocks waiting for user interaction
    bug_report_win.show()
コード例 #4
0
ファイル: unhandled.py プロジェクト: zhuyue1314/w3af
def handle_crash(w3af_core, _type, value, tb, plugins=""):
    """Function to handle any exception that is not addressed explicitly."""
    if issubclass(_type, KeyboardInterrupt):
        handle_keyboardinterrupt(w3af_core)

    # Print the information to the console so everyone can see it
    exception = traceback.format_exception(_type, value, tb)
    exception = "".join(exception)
    print exception

    # Do not disclose user information in bug reports
    clean_exception = cleanup_bug_report(exception)

    # Save the info to a file for later analysis
    filename = create_crash_file(clean_exception)

    # Create the dialog that allows the user to send the bug to github
    bug_report_win = unhandled_bug_report.bug_report_window(
        w3af_core, _("Bug detected!"), clean_exception, filename, plugins
    )

    # Blocks waiting for user interaction
    bug_report_win.show()