MCPcopy Index your code
hub / github.com/qilingframework/qiling / hook

Function hook

qltui.py:591–658  ·  view source on GitHub ↗

Hook Function

(ql: Qiling)

Source from the content-addressed store, hash-verified

589
590
591def hook(ql: Qiling):
592 """
593 Hook Function
594 """
595
596 log("Hook", HEADING_COLOR)
597
598 hook_dictionary = {}
599
600 do_hook = want_to_hook()
601
602 if do_hook:
603 hook_type = ask_hook_type()
604 hook_dictionary["hook_type"] = hook_type
605
606 operation = ask_hook_operation()
607 hook_dictionary["operation"] = operation
608
609 args = []
610 user_data = {}
611
612 if hook_type == "hook_address":
613 hook_target_address = ask_hook_address()
614 args.append(hook_target_address)
615 hook_dictionary["hook_target_address"] = hook_target_address
616
617 if operation in ['read', 'write']:
618 where = ask_where()
619 hook_dictionary["storage"] = where
620 if where == 'mem':
621 address = ask_address()
622 user_data["address"] = address
623 hook_dictionary["address"] = address
624 if operation == 'read':
625 bytes_size = get_bytes_size()
626 user_data["bytes_size"] = bytes_size
627 hook_dictionary["bytes_size"] = bytes_size
628 operation = 'read_mem'
629 else:
630 value = ask_value()
631 user_data["value"] = value
632 hook_dictionary["value"] = value
633 operation = 'write_mem'
634 else:
635 register_name = ask_register_name()
636 user_data["register_name"] = register_name
637 hook_dictionary["register_name"] = register_name
638 if operation == 'read':
639 operation = 'read_reg'
640 else:
641 value = ask_value()
642 user_data["value"] = value
643 hook_dictionary["value"] = value
644 operation = 'write_reg'
645
646 if operation == 'emu_start':
647 start_end = ask_start_end()
648 user_data["start"] = start_end["start"]

Calls 12

logFunction · 0.85
want_to_hookFunction · 0.85
ask_hook_typeFunction · 0.85
ask_hook_operationFunction · 0.85
ask_hook_addressFunction · 0.85
ask_whereFunction · 0.85
ask_addressFunction · 0.85
get_bytes_sizeFunction · 0.85
ask_valueFunction · 0.85
ask_register_nameFunction · 0.85
ask_start_endFunction · 0.85
appendMethod · 0.45