def hook_native_callback(self, hook): if self.columnCount() == 0: self.setColumnCount(2) self.setHorizontalHeaderLabels(['input', 'address']) self.insertRow(self.rowCount()) q = HookWidget(hook.get_input()) q.set_hook_data(hook) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.gray) self.setItem(self.rowCount() - 1, 0, q) q = MemoryAddressWidget(hex(hook.get_ptr())) self.setItem(self.rowCount() - 1, 1, q) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)
def hook_java_callback(self, hook): if self.columnCount() == 0: self.setColumnCount(2) self.setHorizontalHeaderLabels(['input', 'address']) self.insertRow(self.rowCount()) parts = hook.get_input().split('.') q = HookWidget('.'.join(parts[:len(parts) - 1])) q.set_hook_data(hook) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.darkYellow) self.setItem(self.rowCount() - 1, 0, q) q = NotEditableTableWidgetItem(parts[len(parts) - 1]) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.white) self.setItem(self.rowCount() - 1, 1, q) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)
def hook_onload_callback(self, input=None): if self.columnCount() == 0: self.setColumnCount(2) self.setHorizontalHeaderLabels(['input', 'address']) h = self.app.get_dwarf().hook_onload(input) self.insertRow(self.rowCount()) q = HookWidget(h.get_input()) q.set_hook_data(h) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.darkGreen) self.setItem(self.rowCount() - 1, 0, q) q = NotEditableTableWidgetItem(hex(0)) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.gray) self.setItem(self.rowCount() - 1, 1, q) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)
def hook_native_callback(self, ptr): self.insertRow(self.rowCount()) h = Hook(Hook.HOOK_NATIVE) h.set_ptr(ptr) h.set_input(self.temporary_input) self.temporary_input = '' if self.native_pending_args: h.set_condition(self.native_pending_args['condition']) h.set_logic(self.native_pending_args['logic']) self.native_pending_args = {} self.hooks[ptr] = h q = HookWidget(h.get_input()) q.set_hook_data(h) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.gray) self.setItem(self.rowCount() - 1, 0, q) q = MemoryAddressWidget(hex(ptr)) self.setItem(self.rowCount() - 1, 1, q) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)
def hook_onload(self, input=None): if input is None or not isinstance(input, str): input = InputDialog.input(self.app, hint='insert module name', placeholder='libtarget.so') if not input[0]: return input = input[1] if len(input) == 0: return if not input.endswith('.so'): input += '.so' if input in self.app.get_dwarf().on_loads: return if self.columnCount() == 0: self.setColumnCount(2) self.setHorizontalHeaderLabels(['input', 'address']) h = self.app.get_dwarf().hook_onload(input) self.insertRow(self.rowCount()) q = HookWidget(h.get_input()) q.set_hook_data(h) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.darkGreen) self.setItem(self.rowCount() - 1, 0, q) q = NotEditableTableWidgetItem(hex(0)) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.gray) self.setItem(self.rowCount() - 1, 1, q) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)
def hook_java_callback(self, class_method): self.insertRow(self.rowCount()) h = Hook(Hook.HOOK_JAVA) h.set_ptr(1) h.set_input(class_method) if self.java_pending_args: h.set_condition(self.java_pending_args['condition']) h.set_logic(self.java_pending_args['logic']) parts = class_method.split('.') self.java_hooks[class_method] = h q = HookWidget('.'.join(parts[:len(parts) - 1])) q.set_hook_data(h) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.darkYellow) self.setItem(self.rowCount() - 1, 0, q) q = NotEditableTableWidgetItem(parts[len(parts) - 1]) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.white) self.setItem(self.rowCount() - 1, 1, q) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)
def hook_onload(self, input=None): if input is None or not isinstance(input, str): input = InputDialog.input(hint='insert module name') if not input[0]: return input = input[1] if len(input) == 0: return if not input.endswith('.so'): input += '.so' if input in self.onloads: return self.insertRow(self.rowCount()) h = Hook(Hook.HOOK_ONLOAD) h.set_ptr(0) h.set_input(input) self.onloads[input] = h q = HookWidget(h.get_input()) q.set_hook_data(h) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.darkGreen) self.setItem(self.rowCount() - 1, 0, q) q = NotEditableTableWidgetItem(hex(0)) q.setFlags(Qt.NoItemFlags) q.setForeground(Qt.gray) self.setItem(self.rowCount() - 1, 1, q) self.app.dwarf_api('hookOnLoad', input) self.resizeRowsToContents() self.horizontalHeader().setStretchLastSection(True)