Skip to content

Commit ad1fb3d

Browse files
tbaraboschstrazzere
authored andcommitted
Made some small changes to get it work with Python3 and IDA Pro 7.4 (#10)
1 parent af32bf4 commit ad1fb3d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

golang_loader_assist.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@
2222
# Utility functions
2323
#
2424
def info(formatted_string):
25-
print formatted_string
25+
print(formatted_string)
2626

2727
def error(formatted_string):
28-
print 'ERROR - %s' % formatted_string
28+
print(f'ERROR - {formatted_string}')
2929

3030
def debug(formatted_string):
3131
if DEBUG:
32-
print 'DEBUG - %s' % formatted_string
33-
32+
print(f'DEBUG - {formatted_string}')
3433
#
3534
# String defining fuctionality
3635
#
@@ -344,17 +343,20 @@ def create_pointer(addr, force_size=None):
344343

345344
STRIP_CHARS = [ '(', ')', '[', ']', '{', '}', ' ', '"' ]
346345
REPLACE_CHARS = ['.', '*', '-', ',', ';', ':', '/', '\xb7' ]
347-
def clean_function_name(str):
346+
def clean_function_name(in_str):
348347
# Kill generic 'bad' characters
349-
str = filter(lambda x: x in string.printable, str)
348+
s = ""
349+
for c in in_str.decode():
350+
if c in string.printable:
351+
s += c
350352

351353
for c in STRIP_CHARS:
352-
str = str.replace(c, '')
354+
s = s.replace(c, '')
353355

354356
for c in REPLACE_CHARS:
355-
str = str.replace(c, '_')
357+
s = s.replace(c, '_')
356358

357-
return str
359+
return s
358360

359361
def renamer_init():
360362
renamed = 0
@@ -363,7 +365,7 @@ def renamer_init():
363365
if gopclntab is not None:
364366
info('type : %s' % type(gopclntab))
365367
start_ea = 0
366-
if isinstance(gopclntab, long):
368+
if isinstance(gopclntab, int):
367369
start_ea = gopclntab
368370
else:
369371
start_ea = gopclntab.start_ea

0 commit comments

Comments
 (0)