Skip to content

Instantly share code, notes, and snippets.

@idiom
Created April 20, 2021 21:36
Show Gist options
  • Save idiom/74114d745d6c427333ac237f91eee414 to your computer and use it in GitHub Desktop.
Save idiom/74114d745d6c427333ac237f91eee414 to your computer and use it in GitHub Desktop.
Add bookmark in Ida and optionally check if it is a duplicate
def add_bookmark(offset, comment, check_duplicate=True):
"""
:param offset:
:param comment:
:param check_duplicate:
:return:
"""
for bslot in range(0, 1024, 1):
slotval = idc.get_bookmark(bslot)
if check_duplicate:
if slotval == offset:
break
if slotval == 0xffffffffffffffff:
idc.put_bookmark(offset, 0, 0, 0, bslot, comment)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment