Ejemplo n.º 1
0
    failed_rules = []
    warned_rules = []
    for name, (fail_count, warn_count) in results_by_name.items():
        if fail_count > 0:
            failed_rules.append(name)

        if warn_count > 0:
            warned_rules.append(name)

    min, sec = divmod(time.time() - time0, 60)
    logger.debug("lints ran for ~ %02d:%02dm", min, sec)

    if warned_rules:
        print(orange("rules with WARN:"))
        for warned_rule in sorted(warned_rules):
            print("  - " + warned_rule)
        print()

    if failed_rules:
        print(red("rules with FAIL:"))
        for failed_rule in sorted(failed_rules):
            print("  - " + failed_rule)
        return 1
    else:
        logger.info(green("no lints failed, nice!"))
        return 0


if __name__ == "__main__":
    sys.exit(main())
Ejemplo n.º 2
0
        self.view_tree.resize_columns_to_content()


def main():
    """ TODO: move to idaapi.plugin_t class """
    logging.basicConfig(level=logging.INFO)

    if not capa.ida.helpers.is_supported_ida_version():
        return -1

    if not capa.ida.helpers.is_supported_file_type():
        return -1

    global CAPA_EXPLORER_FORM

    try:
        # there is an instance, reload it
        CAPA_EXPLORER_FORM
        CAPA_EXPLORER_FORM.Close()
        CAPA_EXPLORER_FORM = CapaExplorerForm()
    except Exception:
        # there is no instance yet
        CAPA_EXPLORER_FORM = CapaExplorerForm()

    CAPA_EXPLORER_FORM.Show()


if __name__ == "__main__":
    main()