def create_bookmark(view, address): if not view.file.session_data.get('bookmarks'): view.file.session_data['bookmarks'] = OrderedDict() bookmarks = view.file.session_data['bookmarks'] bookmark_name = bn.get_text_line_input("Create new bookmark", "Enter bookmark name:") if bookmark_name: bookmarks[address] = bookmark_name
def create_bookmark(view, address): try: bookmarks = view.query_metadata('bookmarks') except KeyError: bookmarks = OrderedDict() view.store_metadata('bookmarks', bookmarks) bookmark_name = bn.get_text_line_input("Create new bookmark", "Enter bookmark name:") if bookmark_name: bookmarks[address] = bookmark_name view.store_metadata("bookmarks", bookmarks) view.modified = True
def resolve_target_base(self): if self.adapter.target_path() is None: # We cannot resolve our base if we don't know our path try: modules = list(self.adapter.mem_modules(False).keys()) choice = get_choice_input( "Cannot find binary on target... is it one of these?", "Choose Target Module", modules) return modules[choice] except: # Ignore this and we will just specify manually module = get_text_line_input( "Cannot find binary on target... Please enter path to binary on target", "Cannot find binary") # If they still give us nothing we're out of options if module is None: return None return module.decode() else: return self.modules.get_module_for_addr(self.adapter.target_base()) return None