Created
February 14, 2019 16:39
-
-
Save rpetrich/39c25fed14a17987c27828583b93e83a to your computer and use it in GitHub Desktop.
Hopper script to import symbols that were later stripped (for example, from Symbol.map on linux kernels)
This file contains hidden or 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
doc = Document.getCurrentDocument() | |
path = Document.askFile("Symbols file", None, False) | |
if path != None: | |
with open(path) as fp: | |
for i, line in enumerate(fp): | |
parts = line.split(" ") | |
if len(parts) > 2: | |
address = long(parts[0], 16) | |
name = parts[2] | |
seg = doc.getSegmentAtAddress(address) | |
if seg != None: | |
seg.setNameAtAddress(address, name.replace("\n", "")) | |
else: | |
print "No segment for 0x" + str(address) + "; unable to set name for " + name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment