Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update IDA API function names #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nikhilh-20
Copy link

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
Copy link

ScyllaHide commented Aug 21, 2022

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
Copy link

mzpqnxow commented Mar 7, 2024

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