Skip to content

Update IDA API function names - #3

Open
nikhilh-20 wants to merge 1 commit into
Comsecuris:masterfrom
nikhilh-20:func_name_update
Open

Update IDA API function names#3
nikhilh-20 wants to merge 1 commit into
Comsecuris:masterfrom
nikhilh-20:func_name_update

Conversation

@nikhilh-20

Copy link
Copy Markdown

I found some function names used in strcluster.py to be outdated. I referred to this page for updated function names: https://www.hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml

I'm running IDA Pro 7.5.200619 with Python 2.7.18.

The only testing I've done is run the script in IDA Pro and I could see the subview having strings clustered by function and I could jump to those functions with a double-click.

@ScyllaHide

ScyllaHide commented Aug 21, 2022

Copy link
Copy Markdown

not working, displays

image.loadFromData(QtCore.QByteArray.fromHex(icon))
TypeError: fromHex(Union[QByteArray, bytes, bytearray]): argument 1 has unexpected type 'str'

in 7.7SP1 220118
python 3.10.6 - python 2 is no longer supported anyway.

@mzpqnxow

mzpqnxow commented Mar 7, 2024

Copy link
Copy Markdown

There are only a few changes you need to support Python3 and IDA 7.5 (including the original exception in this issue)

I can send a PR later, I don't have time to do the proper check to ensure backwards compatibility

For Python 3, change all occurrences of xrange to range and all occurrences of iteritems to items. A simple find and replace works well enough

Also, change this to fix your immediate issue:

	image.loadFromData(QtCore.QByteArray.fromHex(icon))

To:

	image.loadFromData(QtCore.QByteArray.fromHex(icon.encode('utf-8')))

Finally, for IDA ~7.6:

These two lines:

			f_name = idc.GetFunctionName(fs_ea)
			f_ea = idc.GetFunctionAttr(fs_ea, idc.FUNCATTR_START)

Become:

			f_ea = ida_shims.get_func_attr(fs_ea, idc.FUNCATTR_START)
			f_name = ida_funcs.get_func_name(fs_ea)

EDIT: It may make the most sense to fix this using the approach used by idashims - it helps to avoid breaking backwards compatibility and makes future changes to IDA interfaces easier. There's a performance cost but for a project like this it shouldn't be significant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants