SHARE
TWEET

Untitled

a guest May 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import idautils
  2. import idc
  3. from idaapi import *
  4. strings = idautils.Strings()
  5. invalidStrings = [",", "/", "\\", ".", "(", ")", "-", "<", ">", " "]
  6.  
  7.  
  8. for string in strings:
  9.     programString = str(string)
  10.     if '::' in programString:
  11.         programString = programString.split(" ", 1)[0]
  12.         programString = programString.replace("~", "_")
  13.         for invalidString in invalidStrings:
  14.             programString = programString.translate(None, invalidString)
  15.         if programString.count("[") == 1 and programString.count("]") == 1:
  16.             programString = programString[programString.find("[")+1:programString.find("]")]
  17.         xrefs = idautils.XrefsTo(string.ea)
  18.         count = sum(1 for _ in xrefs)
  19.         if count == 1:
  20.             xrefsNew = idautils.XrefsTo(string.ea)
  21.             for xref in xrefsNew:
  22.                     func = idaapi.get_func(xref.frm)
  23.                     name = get_func_name(xref.frm)
  24.                     if 'None' not in str(name):
  25.                         print("RandomName: {}, ActualName: {}".format(name, programString))
  26.                         address = (GetFunctionAttr(xref.frm, FUNCATTR_START))
  27.                         print(address)
  28.                        # idc.MakeNameEx(address, programString, 0x00)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top