Last active
April 20, 2017 17:51
-
-
Save lallousx86/129b27f18e9fc1b941171facc6b1d1a2 to your computer and use it in GitHub Desktop.
Export marked locations in IDA Pro with IDAPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Export marked location sorted by their address | |
# | |
# Get marked locations | |
Locs = [] | |
idx = 0 | |
while True: | |
s = idc.GetMarkComment(idx) | |
if s is None: | |
break | |
ea = idc.GetMarkedPos(idx) | |
Locs.append((ea, s)) | |
idx += 1 | |
# Sort them by address | |
Locs.sort(lambda x, y: -1 if x[0] - y[0] < 0 else 1) | |
# Emit insertion code | |
idx = 0 | |
for ea, s in Locs: | |
print 'idc.MarkPosition(0x%x, 0, 0, 0, %d, "%s")' % (ea, idx, s) | |
idx += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment