-
Notifications
You must be signed in to change notification settings - Fork 43
/
Hyara_Cutter.py
60 lines (48 loc) · 1.91 KB
/
Hyara_Cutter.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
48
49
50
51
52
53
54
55
56
57
58
59
60
from .hyara_lib.integration.cutter_api import HyaraCutter
import PySide2.QtWidgets as QtWidgets
import cutter
class HyaraWidget(cutter.CutterDockWidget):
def __init__(self, parent):
super(HyaraWidget, self).__init__(parent)
self.main = parent
self.setObjectName("Hyara")
self.setWindowTitle("Hyara")
self.HyaraCutter = HyaraCutter()
content = QtWidgets.QWidget()
self.setWidget(content)
content.setLayout(self.HyaraCutter.layout)
class HyaraPlugin(cutter.CutterPlugin):
name = "Hyara Plugin"
description = "Hyara"
version = "2.3"
author = "Hyun Yi @hyuunnn"
hyaraWidget = None
def setupPlugin(self):
pass
def setStartAddress(self):
offset = int(self.startAddrAction.data())
if offset:
self.hyaraWidget.HyaraCutter._start_address.setText(hex(offset))
self.hyaraWidget.HyaraCutter._variable_name.setText(f"str_{hex(offset)}")
def setEndAddress(self):
offset = int(self.endAddrAction.data())
if offset:
self.hyaraWidget.HyaraCutter._end_address.setText(hex(offset))
def setupActions(self):
self.startAddrAction = QtWidgets.QAction("Hyara - Select Start Address")
self.endAddrAction = QtWidgets.QAction("Hyara - Select End Address")
# Disassembly menu actions
menu = self.hyaraWidget.main.getContextMenuExtensions(
cutter.MainWindow.ContextMenuType.Disassembly
)
menu.addSeparator()
menu.addAction(self.startAddrAction)
menu.addAction(self.endAddrAction)
self.startAddrAction.triggered.connect(self.setStartAddress)
self.endAddrAction.triggered.connect(self.setEndAddress)
def setupInterface(self, main):
self.hyaraWidget = HyaraWidget(main)
self.setupActions()
main.addPluginDockWidget(self.hyaraWidget)
def terminate(self):
pass