示例#1
0
def handle_exceptions(w3af_core):
    """
    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.core_helpers.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 w3af_core.exception_handler.get_unique_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 w3af_core.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 Github.
    title = _('Handled exceptions to report')
    bug_report_win = handled_bug_report.BugReportWindow(w3af_core, title)

    # Blocks waiting for user interaction
    bug_report_win.show()
示例#2
0
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.BugReportWindow(
        w3af_core, _('Bug detected!'), clean_exception, filename, plugins)

    # Blocks waiting for user interaction
    bug_report_win.show()
示例#3
0
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.BugReportWindow(w3af_core,
                                                            _('Bug detected!'),
                                                            clean_exception,
                                                            filename, plugins)

    # Blocks waiting for user interaction
    bug_report_win.show()