Exemplo n.º 1
0
def goto_bookmark(view):
	try:
		bookmarks = view.query_metadata('bookmarks')
	except KeyError:
		bookmarks = OrderedDict()
		view.store_metadata('bookmarks', bookmarks)

	if not bookmarks:
		bn.show_message_box(
			'Bookmark error', 'There are no bookmarks yet.',
			icon=bn.enums.MessageBoxIcon.ErrorIcon
		)
		return

	# Metadata can only store string keys in dictionaries currently.
	# Therefore, we have to convert keys to integers.
	chosen_bookmark = bn.get_choice_input(
		'Go to bookmark', 'Bookmarks:',
		['0x{:x} {}'.format(int(addr), bookmark)
		 for addr, bookmark in bookmarks.iteritems()]
	)

	# Again, we hae to convert string keys to integers.
	if chosen_bookmark is not None:
		navigate_to = int(bookmarks.keys()[chosen_bookmark])

		view.file.navigate(view.file.view, navigate_to)
Exemplo n.º 2
0
def choose_writeup(bv):
    choice = get_choice_input("Writeup:", "Open Writeup", choices) + 1

    if choice == 1:
        overflow1.render(bv)
    elif choice == 2:
        overflow2.render(bv)
    elif choice == 3:
        overflow3.render(bv)
    elif choice == 4:
        overflow4.render(bv)
    elif choice == 5:
        overflow5.render(bv)
Exemplo n.º 3
0
def find_constructor(bv):
    constructor_list = [(c.short_name, c.address) for c in bv.symbols.values()
                        if re.match(r'([A-Za-z0-9_]+)\:\:\1', c.short_name)]

    if not len(constructor_list):
        log_alert("No constructors found!")

    constructor = get_choice_input('Choose a constructor', 'Constructors:',
                                   [x[0] for x in constructor_list])

    if constructor is not None:
        return bv.get_function_at(constructor_list[constructor][1])

    return None
Exemplo n.º 4
0
def goto_bookmark(view):
    if not view.file.session_data.get('bookmarks'):
        view.file.session_data['bookmarks'] = OrderedDict()

    bookmarks = view.file.session_data['bookmarks']

    if not bookmarks:
        bn.show_message_box('Bookmark error',
                            'There are no bookmarks yet.',
                            icon=bn.enums.MessageBoxIcon.ErrorIcon)
        return

    chosen_bookmark = bn.get_choice_input('Go to bookmark', 'Bookmarks:', [
        '0x{:x} {}'.format(addr, bookmark)
        for addr, bookmark in bookmarks.iteritems()
    ])

    if chosen_bookmark is not None:
        navigate_to = bookmarks.keys()[chosen_bookmark]

        view.file.navigate(view.file.view, navigate_to)
Exemplo n.º 5
0
 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