Skip to content

Commit

Permalink
Implement renaming all loaded functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
giladreich committed Jan 27, 2020
1 parent ac9e4a2 commit e7ee17d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/ida_migrator/import_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,28 @@ def populate_function_names(self):
index += 1
print('[IDA Migrator]: Finished loading functions.')

def rename_functions(self):
row_count = self.tblFunctions.rowCount()
renamed_count = 0
for row in range(row_count):
cbx = self.tblFunctions.item(row, col_CheckBox)
if not cbx or cbx.checkState() != Qt.Checked:
continue

address_str = self.tblFunctions.item(row, col_Address).text()
address = int(address_str, 16)
name = self.tblFunctions.item(row, col_Name).text()
curr_name = idc.GetFunctionName(address)
if not name or not curr_name or name == curr_name:
continue

idaapi.set_name(address, name.encode(), idaapi.SN_NOWARN)
print("[IDA Migrator]: {} - Renamed {} to {}".format(address_str, curr_name, name))
renamed_count += 1

return renamed_count

def on_start_clicked(self):
print('started import')
count = self.rename_functions()
print("[IDA Migrator]: {} functions has been renamed.".format(count))
QMessageBox.information(self, "SUCCESS", "Successfully renamed {} functions.".format(count))

0 comments on commit e7ee17d

Please sign in to comment.