[Python/IDA] PyIDAWow (function renaming) menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    Xartrick's Avatar Active Member
    Reputation
    24
    Join Date
    May 2011
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Python/IDA] PyIDAWow (function renaming)

    Hello.

    I created this script (pronounced PiDaWo) to learn how to use IDA API using Python.
    For this, I used IDAPython.

    This script is signature based (pattern), and is based on a XML file structure.
    This only rename functions defined by hand, and will work on small updates.
    Signature are based on the function start to the function end.
    You can modify this script to work differently, to work with symbols.

    Here is the script itself:

    Code:
    # Product : PyIDAWow
    # Version : 0.1a
    # Author  : Xartrick
    
    import os
    import idaapi
    from xml.dom.minidom import parseString
    
    def StartPyIDAWow(file):
    	print '[?] Parsing signature list...'
    	signatures = ParseSignatureList(file)
    	if signatures['success'] == False:
    		print '[-]', signatures['message']
    		return
    	print '[+] Parsed', len(signatures['data']), 'signature(s)!'
    	print '[?] PyIDAWow process started...'
    	for signature in signatures['data']:
    		functions = GetFunctionAddresses(signature['pattern'])
    		if len(functions) == 0:
    			print '[-] No match for', signature['name']
    		elif len(functions) > 1:
    			print '[-] Too much matches for', signature['name'], '(' + str(len(functions)), 'matches)'
    		else:
    			print '[+] Rename function at', hex(functions[0]), 'to', signature['name']
    			MakeNameEx(functions[0], signature['name'], idaapi.SN_NOWARN)
    	print '[?] PyIDAWow process finished!'
    
    def ParseSignatureList(file):
    	if not os.path.isfile(file):
    		return { 'success' : False, 'message' : 'Signature file list not found.' }
    	signatures = []
    	f    = open(file, 'r')
    	data = f.read()
    	f.close()
    	xml = parseString(data)
    	for node in xml.getElementsByTagName('Signature'):
    		name    = node.getElementsByTagName('Name')[0].getAttribute('value')
    		pattern = node.getElementsByTagName('Pattern')[0].getAttribute('value')
    		signatures.append({ 'name' : str(name), 'pattern' : str(pattern) })
    	return { 'success' : True, 'data' : signatures }
    
    def GetFunctionAddresses(signature):
    	addr      = 0
    	addresses = []
    	while True:
    		addr = FindBinary(addr, SEARCH_DOWN, signature)
    		if addr == idaapi.BADADDR:
    			break
    		addresses.append(addr)
    		addr += 1
    	return addresses
    
    print '[?] PyIDAWow loaded.'
    And here is a signatures file example:

    Code:
    <?xml version="1.0"?>
    <Signatures>
    	<Signature>
    		<Name    value="ClntObjMgrGetActivePlayer" />
    		<Pattern value="8B 0D ?? ?? ?? ?? 85 C9 75 05 33 C0 33 D2 C3 8B 81 ?? ?? ?? ?? 8B 91 ?? ?? ?? ?? C3" />
    	</Signature>
    	<Signature>
    		<Name    value="ClntObjMgrGetActivePlayerObj" />
    		<Pattern value="E8 ?? ?? ?? ?? 68 ?? ?? ?? ?? 68 ?? ?? ?? ?? 6A 10 52 50 E8 ?? ?? ?? ?? 83 C4 14 C3" />
    	</Signature>
    	<!--Signature>
    		<Name    value="" />
    		<Pattern value="" />
    	</Signature-->
    </Signatures>
    I tested it with (and it worked):

    • 5.2.0 (16769) (Live)
    • 5.3.0 (1712 (Live)
    • 5.4.0 (17205) (PTR)


    Here is an IDA session example:

    Code:
    [?] PyIDAWow loaded.
    Python>StartPyIDAWow("C:\\Users\\Xartrick\\Desktop\\PyIDAWow\\Signatures.xml")
    [?] Parsing signature list...
    [+] Parsed 2 signature(s)!
    [?] PyIDAWow process started...
    [+] Rename function at 0x84ad00 to ClntObjMgrGetActivePlayer
    [+] Rename function at 0x403290 to ClntObjMgrGetActivePlayerObj
    [?] PyIDAWow process finished!
    I don't know if I will update this script, but I publish my work.

    I hope this will be useful to someone.

    [Python/IDA] PyIDAWow (function renaming)
  2. #2
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Kool stuff, I have anyways wanted to get into scripts for IDA, looks like a good place to start

  3. #3
    Xartrick's Avatar Active Member
    Reputation
    24
    Join Date
    May 2011
    Posts
    29
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want to improve it, add an index entry to the signature's structure and then, subtract or add this index to get the correct place to the symbol.
    With my (current) code, you have to start by the start of your symbol.

Similar Threads

  1. IDA how to rename lua function ?
    By windhuan in forum WoW Memory Editing
    Replies: 3
    Last Post: 12-16-2016, 03:23 PM
  2. [Tool] Ida script for rename lua functions (wow 64)
    By RivaLfr in forum WoW Memory Editing
    Replies: 0
    Last Post: 03-27-2013, 02:12 PM
  3. [IDA] Updating function names/offsets in b/t versions?
    By Tanaris4 in forum WoW Memory Editing
    Replies: 15
    Last Post: 04-09-2010, 01:15 PM
  4. [IDA][mac] Finding lua functions - why the difference?
    By Tanaris4 in forum WoW Memory Editing
    Replies: 12
    Last Post: 04-09-2010, 10:15 AM
  5. [wow][mac] Reversing a mount list function (IDA)
    By Tanaris4 in forum WoW Memory Editing
    Replies: 2
    Last Post: 01-06-2010, 02:36 PM
All times are GMT -5. The time now is 06:52 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search