sibears/IDAGolangHelper

how to fix it?

Opened this issue · 4 comments

IDA 7.5

File "Z:/tools/reverse/ida/IDAGolangHelper\GO_Utils\Utils.py", line 30, in relaxName
    name = name.replace('.', '_').replace("<-", '_chan_left_').replace('*', '_ptr_').replace('-', '_').replace(';','').replace('"', '').replace('\\', '')
TypeError: a bytes-like object is required, not 'str's

Modify it to "name = name.decode().replace('.','_')...."

Modify it to "name = name.decode().replace('.','_')...."

It still have error:
name = name.decode().replace('(', '').replace(')', '').replace('/', '').replace(' ', '').replace(',', 'comma').replace('{','').replace('}', '').replace('[', '').replace(']', '')
AttributeError: 'str' object has no attribute 'decode'

The situation seems to be different between different versions. Is the sample you analyzed compiled with go1.16? After some testing, I found that in __init__.py renameFunctions, there is a variable self.is116 that will decide whether to use Gopclntab.rename16 or Gopclntab.rename when renaming the function. go1.16 should be rename16. But self.is116 is False by default, and will be assigned to True only in the tryFindGoVersion function. So before clicking Rename Functions, you should first click Try to detemine go version based on moduledata.

There may be a problem with Parse types by moduledata, but that should be another issue.

good job,man