in HexForge.py [0:0]
def inject_actions(form, popup, form_type) -> int:
"""
Inject actions to popup menu(s) based on context.
"""
if is_ida_9_or_later:
valid_form_types = (idaapi.BWN_DISASM, idaapi.BWN_HEXVIEW, idaapi.BWN_PSEUDOCODE)
else:
valid_form_types = (idaapi.BWN_DISASMS, idaapi.BWN_DUMP, idaapi.BWN_PSEUDOCODE)
if form_type in valid_form_types:
for module in g_crypto_modules:
idaapi.attach_action_to_popup(
form,
popup,
module.ACTION_NAME,
CRYPTO_MODULE_PATH,
idaapi.SETMENU_APP,
)
for module in g_misc_modules:
idaapi.attach_action_to_popup(
form,
popup,
module.ACTION_NAME,
MISC_MODULE_PATH,
idaapi.SETMENU_APP,
)
for module in g_encoding_modules:
idaapi.attach_action_to_popup(
form,
popup,
module.ACTION_NAME,
ENCODING_MODULE_PATH,
idaapi.SETMENU_APP,
)
for module in g_search_modules:
# Exclude byte searches in decompiler
if form_type == idaapi.BWN_PSEUDOCODE and isinstance(module, SearchVirustotalBytes):
continue
# Exclude string searches in disassembler
if is_ida_9_or_later:
if form_type == idaapi.BWN_DISASM and isinstance(module, (SearchGoogle, SearchGrepApp,SearchGitHub,SearchVirustotalString)):
continue
idaapi.attach_action_to_popup(
form,
popup,
module.ACTION_NAME,
SEARCH_MODULE_PATH,
idaapi.SETMENU_APP,
)
else:
if form_type == idaapi.BWN_DISASMS and isinstance(module, (SearchGoogle, SearchGrepApp,SearchGitHub,SearchVirustotalString)):
continue
idaapi.attach_action_to_popup(
form,
popup,
module.ACTION_NAME,
SEARCH_MODULE_PATH,
idaapi.SETMENU_APP,
)
return 0