1+ from reai_toolkit .utils import BaseAuthFeature
2+ from binaryninja import PluginCommand , log_info , BinaryView
3+ from PySide6 .QtWidgets import QMessageBox
4+
5+ class DetachAnalysisFeature (BaseAuthFeature ):
6+ def __init__ (self , config = None ):
7+ super ().__init__ (config )
8+ log_info ("RevEng.AI | DetachAnalysis Feature initialized" )
9+
10+ def register (self ):
11+ PluginCommand .register (
12+ "RevEng.AI\\ Analysis\\ \u200b \u200b Detach Analysis" ,
13+ "Detach from the current RevEng.AI analysis" ,
14+ self .verify_detach ,
15+ self .is_valid
16+ )
17+ log_info ("RevEng.AI | DetachAnalysis Feature registered" )
18+
19+ def verify_detach (self , bv : BinaryView ):
20+ log_info ("RevEng.AI | Requesting detach confirmation" )
21+
22+ reply = QMessageBox .question (
23+ None ,
24+ "RevEng.AI - Detach Analysis" ,
25+ "Are you sure you want to detach from the current RevEng.AI analysis?\n \n "
26+ "This will disconnect this binary from its analysis on the RevEng.AI platform. "
27+ "You can reconnect later by choosing a source again." ,
28+ QMessageBox .Yes | QMessageBox .No ,
29+ QMessageBox .No
30+ )
31+
32+ if reply == QMessageBox .Yes :
33+ log_info ("RevEng.AI | User confirmed detach" )
34+ self .config .reset_analysis_data (bv )
35+
36+ QMessageBox .information (
37+ None ,
38+ "RevEng.AI - Analysis Detached" ,
39+ "Successfully detached from the RevEng.AI analysis.\n \n "
40+ "You can process a new binary or choose a different source." ,
41+ QMessageBox .Ok
42+ )
43+ else :
44+ log_info ("RevEng.AI | User cancelled detach" )
45+
46+ def is_valid (self , bv : BinaryView ):
47+ return self .config .is_configured == True and self .config .analysis_id is not None
0 commit comments