コード例 #1
0
def pluginMain():
    """Run the Karta (identifier) plugin."""
    global logger, disas

    # Use the basic logger on the init phase
    init_logger = Logger(LIBRARY_NAME)
    init_logger.linkHandler(logging.FileHandler(constructInitLogPath(), "w"))
    disas = createDisassemblerHandler(init_logger)
    # In case of a dependency issue, disas will be None
    if disas is None:
        return

    # Can now safely continue on
    logger = Logger(LIBRARY_NAME, [],
                    use_stdout=False,
                    min_log_level=logging.INFO)
    initUtils(logger, disas)
    logger.info("Started the Script")

    # Init the strings list (Only once, because it's heavy to calculate)
    logger.info("Building a list of all of the strings in the binary")

    # Start identifying the libraries
    logger.info("Going to identify the open (and closed) source libraries")
    identifyLibraries()

    # Finished successfully
    logger.info("Finished Successfully")
コード例 #2
0
def main():
    """Start Thumbs Up IDA plugin - Firmware version."""
    # Init the logger
    logger = Logger("Thumbs Up Logger",
                    [("thumbs_up.log", "w", logging.DEBUG)],
                    use_stdout=False,
                    min_log_level=logging.INFO)
    logger.linkHandler(IdaLogHandler())
    # Locate the segments
    code_segments = list(filter(lambda x: x.type == 2, sark.segments()))
    data_segments = list(filter(lambda x: x.type in [0, 3], sark.segments()))
    # Sanity checks
    if len(code_segments) == 0:
        logger.error("Failed to find any code segment, can't continue...")
        return
    if len(data_segments) == 0:
        logger.error("Failed to find any data segment, can't continue...")
        return
    # Notify the user about our segment decisions
    logger.info("Segments, as marked by the disassembler:")
    for sc in code_segments:
        logger.info("Code Segment: 0x%x - 0x%x", sc.start_ea, sc.end_ea)
    for sd in data_segments:
        logger.info("Data Segment: 0x%x - 0x%x", sd.start_ea, sd.end_ea)

    # Build up the analyzer
    analyzer = createAnalyzer(logger, False)
    # Sanity check
    if analyzer is None:
        logger.error("Exiting")
        return
    # Finish building the analyzer
    analyzer.linkFunctionClassifier()
    analyzer.linkFptrIdentifier()
    analyzer.linkStringIdentifier()
    analyzer.linkLocalsIdentifier()
    analyzer.linkSwitchIdentifier()

    # Notify the user about the code types
    analyzer.presentCodeTypes()

    # Start the analysis
    logger.info("Starting the analysis")
    result = analysisStart(analyzer, code_segments, data_segments)
    if result:
        logger.info("Successfully finished the analysis")
    else:
        logger.error("Encountered an error during the analysis")
コード例 #3
0
ファイル: karta_matcher.py プロジェクト: mcgrady1/Karta
def pluginMain():
    """Run the Karta (matcher) plugin."""
    global disas, logger, config_path

    # Use the basic logger on the init phase
    init_logger = Logger(LIBRARY_NAME)
    init_logger.linkHandler(logging.FileHandler(constructInitLogPath(), "w"))
    disas = createDisassemblerHandler(init_logger)
    # In case of a dependency issue, disas will be None
    if disas is None:
        return

    # Get the configuration values from the user
    config_values = disas.configForm()
    if config_values is None:
        return

    # store them / use them now for initialization
    config_path = config_values["config_path"]
    if config_values["is_windows"]:
        setWindowsMode()

    working_path = os.path.split(disas.databaseFile())[0]

    log_files = []
    #    log_files += [(os.path.join(working_path, "%s_debug.log"   % (LIBRARY_NAME)), "w", logging.DEBUG)]
    log_files += [(os.path.join(working_path, "%s_info.log" % (LIBRARY_NAME)),
                   "w", logging.INFO)]
    log_files += [(os.path.join(working_path,
                                "%s_warning.log" % (LIBRARY_NAME)), "w",
                   logging.WARNING)]
    logger = Logger(LIBRARY_NAME,
                    log_files,
                    use_stdout=False,
                    min_log_level=logging.INFO)
    initUtils(logger, disas)
    logger.info("Started the Script")

    # Active the matching mode
    setMatchingMode()

    # Init the strings list (Only once, because it's heavy to calculate)
    logger.info("Building a list of all of the strings in the binary")

    # Start matching the libraries
    logger.info("Going to locate and match the open source libraries")
    matchLibraries()

    # Finished successfully
    logger.info("Finished Successfully")

    # Notify the user about the logs
    disas.messageBox("Saved the logs to directory: %s" % (working_path))
コード例 #4
0
def pluginMain():
    """Run the Karta (identifier) plugin."""
    global logger, disas

    logger = Logger(LIBRARY_NAME, [],
                    use_stdout=False,
                    min_log_level=logging.INFO)
    initUtils(logger, createDisassemblerHandler(logger))
    disas = getDisas()
    logger.info("Started the Script")

    # Init the strings list (Only once, because it's heavy to calculate)
    logger.info("Building a list of all of the strings in the binary")

    # Start identifying the libraries
    logger.info("Going to identify the open (and closed) source libraries")
    identifyLibraries()

    # Finished successfully
    logger.info("Finished Successfully")