|
1 | | -from binaryninja import BinaryView, log_info, log_error, Symbol, SymbolType |
2 | | -from reait.api import RE_authentication, RE_search, RE_nearest_symbols_batch, RE_analyze_functions, RE_name_score, RE_functions_data_types, RE_functions_data_types_poll |
3 | | -from concurrent.futures import ThreadPoolExecutor, as_completed |
4 | | -from typing import List, Dict, Tuple |
5 | | -import math |
6 | | -from revengai.utils.datatypes import apply_data_types as apply_data_types_util |
7 | 1 | import time |
8 | | -from revengai.utils import rename_function as rename_function_util |
| 2 | +from typing import List, Dict, Tuple |
9 | 3 | from libbs.api import DecompilerInterface |
| 4 | +from libbs.artifacts import _art_from_dict, Function |
| 5 | +from binaryninja import BinaryView, log_info, log_error |
10 | 6 | from libbs.decompilers.binja.interface import BinjaInterface |
11 | | -from libbs.artifacts import _art_from_dict |
12 | | -from libbs.artifacts import ( |
13 | | - Function, |
14 | | - FunctionArgument, |
15 | | - GlobalVariable, |
16 | | - Enum, |
17 | | - Struct, |
18 | | - Typedef, |
19 | | -) |
| 7 | +from concurrent.futures import ThreadPoolExecutor, as_completed |
| 8 | +from revengai.utils import rename_function as rename_function_util, apply_data_types as apply_data_types_util |
| 9 | +from reait.api import RE_search, RE_nearest_symbols_batch, RE_analyze_functions, RE_name_score, RE_functions_data_types, RE_functions_data_types_poll |
20 | 10 |
|
21 | 11 | class AutoUnstrip: |
22 | 12 | def __init__(self, config): |
@@ -117,7 +107,8 @@ def _process_batch(self, function_ids: List[int], id_to_addr: Dict[int, int], bv |
117 | 107 | break |
118 | 108 | else: |
119 | 109 | log_info(f"RevEng.AI | Function {function['function_id']} has a score of {function['box_plot']['average']:.2f} for name {new_name_mangled}, renaming") |
120 | | - to_datatypes.append(result) |
| 110 | + if data_types: |
| 111 | + to_datatypes.append(result) |
121 | 112 | if rename_function_util(bv, func_addr, new_name_mangled): |
122 | 113 | renamed_count += 1 |
123 | 114 | break |
@@ -193,8 +184,10 @@ def auto_unstrip(self, bv: BinaryView, options: Dict): |
193 | 184 | else: |
194 | 185 | message = "After analyzing the binary, no functions were found to be renamed." |
195 | 186 |
|
| 187 | + """ |
196 | 188 | if all_errors: |
197 | 189 | message += f"\nEncountered {len(all_errors)} errors during processing." |
| 190 | + """ |
198 | 191 |
|
199 | 192 | log_info(f"RevEng.AI | {message}") |
200 | 193 | return True, message |
|
0 commit comments