def init(self): self.hexrays_inited = False self.registered_actions = [] self.registered_hx_actions = [] global ARCH global BITS ARCH = idaapi.ph_get_id() info = idaapi.get_inf_structure() if info.is_64bit(): BITS = 64 elif info.is_32bit(): BITS = 32 else: BITS = 16 print "LazyIDA (v1.0.0.3) plugin has been loaded." # Register menu actions menu_actions = ( idaapi.action_desc_t(ACTION_CONVERT[0], "Convert to string", menu_action_handler_t(ACTION_CONVERT[0]), None, None, 80), idaapi.action_desc_t(ACTION_CONVERT[1], "Convert to hex string", menu_action_handler_t(ACTION_CONVERT[1]), None, None, 8), idaapi.action_desc_t(ACTION_CONVERT[2], "Convert to C/C++ array (BYTE)", menu_action_handler_t(ACTION_CONVERT[2]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[3], "Convert to C/C++ array (WORD)", menu_action_handler_t(ACTION_CONVERT[3]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[4], "Convert to C/C++ array (DWORD)", menu_action_handler_t(ACTION_CONVERT[4]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[5], "Convert to C/C++ array (QWORD)", menu_action_handler_t(ACTION_CONVERT[5]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[6], "Convert to python list (BYTE)", menu_action_handler_t(ACTION_CONVERT[6]), None, None, 201), idaapi.action_desc_t(ACTION_CONVERT[7], "Convert to python list (WORD)", menu_action_handler_t(ACTION_CONVERT[7]), None, None, 201), idaapi.action_desc_t(ACTION_CONVERT[8], "Convert to python list (DWORD)", menu_action_handler_t(ACTION_CONVERT[8]), None, None, 201), idaapi.action_desc_t(ACTION_CONVERT[9], "Convert to python list (QWORD)", menu_action_handler_t(ACTION_CONVERT[9]), None, None, 201), idaapi.action_desc_t(ACTION_XORDATA, "Get xored data", menu_action_handler_t(ACTION_XORDATA), None, None, 9), idaapi.action_desc_t(ACTION_FILLNOP, "Fill with NOPs", menu_action_handler_t(ACTION_FILLNOP), None, None, 9), idaapi.action_desc_t(ACTION_SCANVUL, "Scan format string vulnerabilities", menu_action_handler_t(ACTION_SCANVUL), None, None, 160), ) for action in menu_actions: idaapi.register_action(action) self.registered_actions.append(action.name) # Register hotkey actions hotkey_actions = ( idaapi.action_desc_t(ACTION_COPYEA, "Copy EA", hotkey_action_handler_t(ACTION_COPYEA), "w", "Copy current EA", 0), ) for action in hotkey_actions: idaapi.register_action(action) self.registered_actions.append(action.name) # Add ui hook self.ui_hook = UI_Hook() self.ui_hook.hook() # Add hexrays ui callback if idaapi.init_hexrays_plugin(): addon = idaapi.addon_info_t() addon.id = "tw.l4ys.lazyida" addon.name = "LazyIDA" addon.producer = "Lays" addon.url = "https://github.com/L4ys/LazyIDA" addon.version = "1.0.0.3" idaapi.register_addon(addon) hx_actions = ( idaapi.action_desc_t(ACTION_HX_REMOVERETTYPE, "Remove return type", hexrays_action_handler_t(ACTION_HX_REMOVERETTYPE), "v"), idaapi.action_desc_t(ACTION_HX_COPYEA, "Copy ea", hexrays_action_handler_t(ACTION_HX_COPYEA), "w"), idaapi.action_desc_t(ACTION_HX_COPYNAME, "Copy name", hexrays_action_handler_t(ACTION_HX_COPYNAME), "c"), ) for action in hx_actions: idaapi.register_action(action) self.registered_hx_actions.append(action.name) self.hx_hook = HexRays_Hook() idaapi.install_hexrays_callback(self.hx_hook.callback) self.hexrays_inited = True return idaapi.PLUGIN_KEEP
def init(self): self.hexrays_inited = False self.registered_actions = [] self.registered_hx_actions = [] global ARCH global BITS ARCH = idaapi.ph_get_id() info = idaapi.get_inf_structure() if info.is_64bit(): BITS = 64 elif info.is_32bit(): BITS = 32 else: BITS = 16 print("LazyIDA (v1.0.0.3) plugin has been loaded.") # Register menu actions menu_actions = ( idaapi.action_desc_t(ACTION_CONVERT[0], "Convert to string", menu_action_handler_t(ACTION_CONVERT[0]), None, None, 80), idaapi.action_desc_t(ACTION_CONVERT[1], "Convert to hex string", menu_action_handler_t(ACTION_CONVERT[1]), None, None, 8), idaapi.action_desc_t(ACTION_CONVERT[2], "Convert to C/C++ array (BYTE)", menu_action_handler_t(ACTION_CONVERT[2]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[3], "Convert to C/C++ array (WORD)", menu_action_handler_t(ACTION_CONVERT[3]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[4], "Convert to C/C++ array (DWORD)", menu_action_handler_t(ACTION_CONVERT[4]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[5], "Convert to C/C++ array (QWORD)", menu_action_handler_t(ACTION_CONVERT[5]), None, None, 38), idaapi.action_desc_t(ACTION_CONVERT[6], "Convert to python list (BYTE)", menu_action_handler_t(ACTION_CONVERT[6]), None, None, 201), idaapi.action_desc_t(ACTION_CONVERT[7], "Convert to python list (WORD)", menu_action_handler_t(ACTION_CONVERT[7]), None, None, 201), idaapi.action_desc_t(ACTION_CONVERT[8], "Convert to python list (DWORD)", menu_action_handler_t(ACTION_CONVERT[8]), None, None, 201), idaapi.action_desc_t(ACTION_CONVERT[9], "Convert to python list (QWORD)", menu_action_handler_t(ACTION_CONVERT[9]), None, None, 201), idaapi.action_desc_t(ACTION_XORDATA, "Get xored data", menu_action_handler_t(ACTION_XORDATA), None, None, 9), idaapi.action_desc_t(ACTION_FILLNOP, "Fill with NOPs", menu_action_handler_t(ACTION_FILLNOP), None, None, 9), idaapi.action_desc_t(ACTION_SCANVUL, "Scan format string vulnerabilities", menu_action_handler_t(ACTION_SCANVUL), None, None, 160), ) for action in menu_actions: idaapi.register_action(action) self.registered_actions.append(action.name) # Register hotkey actions hotkey_actions = ( idaapi.action_desc_t(ACTION_COPYEA, "Copy EA", hotkey_action_handler_t(ACTION_COPYEA), "w", "Copy current EA", 0), idaapi.action_desc_t(ACTION_GOTOCLIP, "Goto clip EA", hotkey_action_handler_t(ACTION_GOTOCLIP), "Shift-G", "Goto clipboard EA", 0), ) for action in hotkey_actions: idaapi.register_action(action) self.registered_actions.append(action.name) # Add ui hook self.ui_hook = UI_Hook() self.ui_hook.hook() # Add hexrays ui callback if idaapi.init_hexrays_plugin(): addon = idaapi.addon_info_t() addon.id = "tw.l4ys.lazyida" addon.name = "LazyIDA" addon.producer = "Lays" addon.url = "https://github.com/L4ys/LazyIDA" addon.version = "1.0.0.3" idaapi.register_addon(addon) hx_actions = ( idaapi.action_desc_t( ACTION_HX_REMOVERETTYPE, "Remove return type", hexrays_action_handler_t(ACTION_HX_REMOVERETTYPE), "v"), idaapi.action_desc_t( ACTION_HX_COPYEA, "Copy ea", hexrays_action_handler_t(ACTION_HX_COPYEA), "w"), idaapi.action_desc_t( ACTION_HX_COPYNAME, "Copy name", hexrays_action_handler_t(ACTION_HX_COPYNAME), "c"), idaapi.action_desc_t( ACTION_HX_GOTOCLIP, "Goto clipboard ea", hexrays_action_handler_t(ACTION_HX_GOTOCLIP), "Shift-G"), ) for action in hx_actions: idaapi.register_action(action) self.registered_hx_actions.append(action.name) self.hx_hook = HexRays_Hook() idaapi.install_hexrays_callback(self.hx_hook.callback) self.hexrays_inited = True return idaapi.PLUGIN_KEEP