Skip to content

Commit 1cb17f9

Browse files
committed
fix: fix import in features
1 parent 7f91d53 commit 1cb17f9

41 files changed

Lines changed: 198 additions & 224 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

revengai/features/ai_decompiler/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from binaryninja import PluginCommand, log_info, BinaryView, log_error
2-
from PySide6.QtWidgets import QDockWidget
3-
from .ai_decompiler import AIDecompiler
4-
from binaryninjaui import UIContext
51
from PySide6.QtCore import Qt
6-
from .ai_decompiler_dialog import AIDecompilerDialog
2+
from binaryninjaui import UIContext
3+
from .ai_decompiler import AIDecompiler
4+
from PySide6.QtWidgets import QDockWidget
75
from revengai.utils import BaseAuthFeature
6+
from .ai_decompiler_dialog import AIDecompilerDialog
7+
from binaryninja import PluginCommand, log_info, BinaryView, log_error
88

99
class AIDecompilerFeature(BaseAuthFeature):
1010
def __init__(self, config=None):

revengai/features/ai_decompiler/ai_decompiler.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
from typing import Dict, Optional, Callable
12
from binaryninja import BinaryView, log_info, log_error
23
from reait.api import RE_poll_ai_decompilation, RE_begin_ai_decompilation
3-
from typing import Dict, Optional, Callable
4-
from revengai.utils import get_function_id_by_addr as get_function_id_by_addr_util
5-
from revengai.utils.periodic_check_ai_decompiler import PeriodicChecker
6-
from revengai.utils.address_change_monitor import AddressChangeMonitor
4+
from revengai.utils import get_function_id_by_addr as get_function_id_by_addr_util, AddressChangeMonitor, AIDecompilerChecker
75

86
class AIDecompiler:
97
def __init__(self, config):
@@ -119,7 +117,7 @@ def start_ai_decompiler(self, bv: BinaryView, options: Dict) -> None:
119117
return
120118

121119
log_info("RevEng.AI | AI Decompilation started")
122-
periodic_checker = PeriodicChecker()
120+
periodic_checker = AIDecompilerChecker()
123121
periodic_checker.start_ai_decompiler_checking(function_id, callback, editor, tab_name)
124122
self._current_checker = periodic_checker
125123

revengai/features/ai_decompiler/ai_decompiler_dialog.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
from PySide6.QtCore import QCoreApplication
12
from binaryninja import log_error, log_info
3+
from revengai.utils import create_progress_dialog, get_function_by_addr, CHighlighter
24
from PySide6.QtWidgets import QVBoxLayout, QCheckBox, QWidget, QTabWidget, QPlainTextEdit
3-
from PySide6.QtCore import QCoreApplication
4-
from revengai.utils import create_progress_dialog, get_function_by_addr
5-
from revengai.utils.c_highlighter import CHighlighter
65

76
class AIDecompilerDialog(QWidget):
87
def __init__(self, config, ai_decompiler, bv, func):

revengai/features/auto_unstrip/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from binaryninja import PluginCommand, log_info, BinaryView
21
from .auto_unstrip import AutoUnstrip
3-
from .auto_unstrip_dialog import AutoUnstripDialog
42
from revengai.utils import BaseAuthFeature
3+
from .auto_unstrip_dialog import AutoUnstripDialog
4+
from binaryninja import PluginCommand, log_info, BinaryView
55

66
class AutoUnstripFeature(BaseAuthFeature):
77
def __init__(self, config=None):

revengai/features/auto_unstrip/auto_unstrip.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
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
71
import time
8-
from revengai.utils import rename_function as rename_function_util
2+
from typing import List, Dict, Tuple
93
from libbs.api import DecompilerInterface
4+
from libbs.artifacts import _art_from_dict, Function
5+
from binaryninja import BinaryView, log_info, log_error
106
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
2010

2111
class AutoUnstrip:
2212
def __init__(self, config):
@@ -117,7 +107,8 @@ def _process_batch(self, function_ids: List[int], id_to_addr: Dict[int, int], bv
117107
break
118108
else:
119109
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)
121112
if rename_function_util(bv, func_addr, new_name_mangled):
122113
renamed_count += 1
123114
break
@@ -193,8 +184,10 @@ def auto_unstrip(self, bv: BinaryView, options: Dict):
193184
else:
194185
message = "After analyzing the binary, no functions were found to be renamed."
195186

187+
"""
196188
if all_errors:
197189
message += f"\nEncountered {len(all_errors)} errors during processing."
190+
"""
198191

199192
log_info(f"RevEng.AI | {message}")
200193
return True, message

revengai/features/auto_unstrip/auto_unstrip_dialog.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
import os
12
from binaryninja import log_error
2-
from PySide6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout,
3-
QPushButton, QLabel, QCheckBox)
4-
from PySide6.QtCore import Qt
53
from PySide6.QtGui import QPixmap
6-
from PySide6.QtCore import QCoreApplication
7-
from PySide6.QtWidgets import QMessageBox
8-
from revengai.utils import create_progress_dialog
9-
from revengai.utils.data_thread import DataThread
10-
import os
4+
from PySide6.QtCore import Qt, QCoreApplication
5+
from revengai.utils import create_progress_dialog, DataThread
6+
from PySide6.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QCheckBox, QMessageBox
117

128
class AutoUnstripDialog(QDialog):
139
def __init__(self, config, auto_unstrip, bv):

revengai/features/choose_source/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from binaryninja import PluginCommand, log_info, BinaryView
21
from .choose_source import ChooseSource
3-
from .choose_source_dialog import ChooseSourceDialog
42
from revengai.utils import BaseAuthFeature
3+
from .choose_source_dialog import ChooseSourceDialog
4+
from binaryninja import PluginCommand, log_info, BinaryView
55

66
class ChooseSourceFeature(BaseAuthFeature):
77
def __init__(self, config=None):

revengai/features/choose_source/choose_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from binaryninja import BinaryView, log_info, log_error
21
from reait.api import RE_search
2+
from binaryninja import BinaryView, log_info, log_error
33

44
class ChooseSource:
55
def __init__(self, config):

revengai/features/choose_source/choose_source_dialog.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from PySide6.QtWidgets import QDialog, QVBoxLayout, QLabel, QComboBox, QPushButton, QHBoxLayout
2-
from PySide6.QtGui import QPixmap
3-
from PySide6.QtCore import Qt, QCoreApplication
4-
from revengai.utils.data_thread import DataThread
1+
import os
52
from binaryninja import log_error
3+
from PySide6.QtGui import QPixmap
64
from PySide6.QtWidgets import QMessageBox
7-
from revengai.utils import create_progress_dialog
8-
import os
5+
from PySide6.QtCore import Qt, QCoreApplication
6+
from revengai.utils import create_progress_dialog, DataThread
7+
from PySide6.QtWidgets import QDialog, QVBoxLayout, QLabel, QComboBox, QPushButton, QHBoxLayout
8+
99

1010
class ChooseSourceDialog(QDialog):
1111
def __init__(self, config, choose_source, bv):

revengai/features/configuration/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from binaryninja import PluginCommand, log_info, BinaryViewType, log_error
21
from .config import Config
32
from .config_dialog import ConfigDialog
43
from PySide6.QtWidgets import QMessageBox
4+
from binaryninja import PluginCommand, log_info, BinaryViewType, log_error
55

66
class ConfigurationFeature():
77
def __init__(self):

0 commit comments

Comments
 (0)