помогите найти ошибку "tuple indices must be integer" в плагине для IDA в строке №32:
regs = re.findall(regs_pattern, match['last_line'])
Весь код для python 2.7:
сам файл здесь: https://disk.yandex.ru/d/9XSeJzunyZ6bZg
regs = re.findall(regs_pattern, match['last_line'])
Весь код для python 2.7:
Код:
from sys import exit, argv
import re
import idaapi
import idc
import struct
class myplugin_t(idaapi.plugin_t):
flags = idaapi.PLUGIN_UNL
comment = "This is a comment"
help = "This is help"
wanted_name = "_windbg2ida6"
wanted_hotkey = "Alt-2"
def init(self):
idaapi.msg("plugin load\n")
return idaapi.PLUGIN_OK
def run(self, arg):
pattern = "eax=([0-9a-z]{8}) ebx=([0-9a-z]{8}) ecx=([0-9a-z]{8}) edx=([0-9a-z]{8}) esi=([0-9a-z]{8}) edi=([0-9a-z]{8})[^\n]*\neip=([0-9a-z]{8}) esp=([0-9a-z]{8}) ebp=([0-9a-z]{8})[^\n]*\n[^\n]*\n[^\n]*\n(.*)"
pattern = re.compile(pattern)
filepath = idaapi.askfile_c(False, "*.*", "Pin log file");
f = open(filepath,"rb" )
text = f.read()
matches = re.findall(pattern, text)
ret = []
for match in matches:
eax, ebx, ecx, edx, esi, edi, eip, esp, ebp, last_line = match
ret.append( {'eax':eax, 'ebx':ebx, 'ecx':ecx, 'edx':edx, 'esi':esi, 'edi':edi, 'esp':esp, 'ebp':ebp, 'last_line':last_line} )
regs_pattern = '(eax|ebx|ecx|edx|esi|edi|esp|ebp)'
regs_pattern = re.compile(regs_pattern)
for match in matches:
comment = []
idaapi.msg("fillInGraph\n")
regs = re.findall(regs_pattern, match['last_line'])
for reg in regs:
comment.append( "%s=%s;" % (reg, match[reg]) )
last_line = match['last_line'].split()
addr = int(last_line[0], 16)
if len(last_line) > 4:
if comment:
comment.append('*'+last_line[-1].split(':')[-1])
else:
comment.append(last_line[-1].split(':')[-1])
SetColor(addr, CIC_ITEM, 0x7fff00) # blue
if comment:
MakeComm(addr, '\n'.join(comment))
def term(self):
idaapi.msg("term() called!\n")
def PLUGIN_ENTRY():
return myplugin_t()
сам файл здесь: https://disk.yandex.ru/d/9XSeJzunyZ6bZg