Last active
December 19, 2023 04:59
-
-
Save landonepps/6be05dc2a2487a07d915f18c27ce33de to your computer and use it in GitHub Desktop.
Import ETSymbolication Symbols into Hopper
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
import csv | |
doc = Document.getCurrentDocument() | |
path = Document.askFile("Symbols CSV file", None, False) | |
if path is not None: | |
with open(path) as csvfile: | |
csvreader = csv.reader(csvfile, delimiter=",", quotechar="\"") | |
for i, parts in enumerate(csvreader): | |
if len(parts) > 2: | |
address = int(parts[1].split(",")[0].lstrip("[0x"), 16) | |
name = parts[2] | |
seg = doc.getSegmentAtAddress(address) | |
if seg is not None: | |
seg.setNameAtAddress(address, name) | |
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