-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendesia-plugin.py
47 lines (39 loc) · 1.31 KB
/
endesia-plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- encoding: utf8 -*-
#
# IDA plugin definition.
import idaapi
from libendesia.console import Console, is_using_pyqt5
from PyQt5.QtWidgets import QApplication
class Endesia(idaapi.plugin_t):
wanted_name = "Endesia"
wanted_hotkey = "Shift-F2"
flags = idaapi.PLUGIN_FIX
comment = ""
help = "Starts an Endesia qtconsole in IDA Pro"
def init(self):
self.widget = None
return idaapi.PLUGIN_KEEP
def run(self, args):
if self.widget is None:
self.widget = Console()
self.widget.Show()
def term(self):
if self.widget:
self.widget.Close(0)
self.widget = None
def PLUGIN_ENTRY():
return Endesia()
# Links Qt's event loop with asyncio's event loop. This allows asyncio to
# work properly, which is required for ipykernel >= 5 (more specifically,
# because ipykernel uses tornado, which is backed by asyncio).
def _setup_asyncio_event_loop():
import qasync
import asyncio
if isinstance(asyncio.get_event_loop(), qasync.QEventLoop):
print("Note: qasync event loop already set up.")
else:
qapp = QApplication.instance()
loop = qasync.QEventLoop(qapp, already_running=True)
asyncio.set_event_loop(loop)
if QApplication.instance() and is_using_pyqt5():
_setup_asyncio_event_loop()