Run the Karta (matcher) plugin.
()
| 145 | logger.removeIndent() |
| 146 | |
| 147 | def pluginMain(): |
| 148 | """Run the Karta (matcher) plugin.""" |
| 149 | global disas, logger, config_path |
| 150 | |
| 151 | # Use the basic logger on the init phase |
| 152 | init_logger = Logger(LIBRARY_NAME) |
| 153 | init_logger.linkHandler(logging.FileHandler(constructInitLogPath(), "w")) |
| 154 | disas = createDisassemblerHandler(init_logger) |
| 155 | # In case of a dependency issue, disas will be None |
| 156 | if disas is None: |
| 157 | return |
| 158 | |
| 159 | # Get the configuration values from the user |
| 160 | config_values = disas.configForm() |
| 161 | if config_values is None: |
| 162 | return |
| 163 | |
| 164 | # store them / use them now for initialization |
| 165 | config_path = config_values["config_path"] |
| 166 | if config_values["is_windows"]: |
| 167 | setWindowsMode() |
| 168 | |
| 169 | working_path = os.path.split(disas.databaseFile())[0] |
| 170 | |
| 171 | log_files = [] |
| 172 | # log_files += [(os.path.join(working_path, LIBRARY_NAME + "_debug.log"), "w", logging.DEBUG)] |
| 173 | log_files += [(os.path.join(working_path, LIBRARY_NAME + "_info.log"), "w", logging.INFO)] |
| 174 | log_files += [(os.path.join(working_path, LIBRARY_NAME + "_warning.log"), "w", logging.WARNING)] |
| 175 | logger = Logger(LIBRARY_NAME, log_files, use_stdout=False, min_log_level=logging.INFO) |
| 176 | initUtils(logger, disas) |
| 177 | logger.info("Started the Script") |
| 178 | |
| 179 | # Active the matching mode |
| 180 | setMatchingMode() |
| 181 | |
| 182 | # Init the strings list (Only once, because it's heavy to calculate) |
| 183 | logger.info("Building a list of all of the strings in the binary") |
| 184 | |
| 185 | # Start matching the libraries |
| 186 | logger.info("Going to locate and match the open source libraries") |
| 187 | matchLibraries() |
| 188 | |
| 189 | # Finished successfully |
| 190 | logger.info("Finished Successfully") |
| 191 | |
| 192 | # Notify the user about the logs |
| 193 | disas.messageBox(f"Saved the logs to directory: {working_path}") |
| 194 | |
| 195 | |
| 196 | # Start to analyze the file |
no test coverage detected