Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from mnrkbys/fix-tiny-warnings
Browse files Browse the repository at this point in the history
Update flare_emu_ida.py
  • Loading branch information
williballenthin authored Feb 20, 2023
2 parents 2c23fa8 + 0fb163d commit c6983cd
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions flare_emu_ida.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import idc
import re

import idaapi
import idautils
import idc

import flare_emu
import logging
import re


class IdaProAnalysisHelper(flare_emu.AnalysisHelper):
def __init__(self, eh):
super(IdaProAnalysisHelper, self).__init__()
self.eh = eh
info = idaapi.get_inf_structure()
if info.procName == "metapc":
if info.procname == "metapc":
self.arch = "X86"
else:
self.arch = info.procName
self.arch = info.procname
if info.is_64bit():
self.bitness = 64
elif info.is_32bit():
elif info.is_32bit():
self.bitness = 32
else:
self.bitness = None
Expand Down Expand Up @@ -61,9 +63,6 @@ def getBlockEndInsnAddr(self, addr, flowchart):
bb = self._getBlockByAddr(addr, flowchart)
return idc.prev_head(bb.end_ea, idc.get_inf_attr(idc.INF_MIN_EA))

def skipJumpTable(self, addr):
pass

def getMinimumAddr(self):
return idc.get_inf_attr(idc.INF_MIN_EA)

Expand Down Expand Up @@ -118,10 +117,10 @@ def getSegmentDefinedSize(self, addr):

def getSegments(self):
return idautils.Segments()

def getSegmentSize(self, addr):
return self.getSegmentEnd(addr) - self.getSegmentStart(addr)

def getSectionName(self, addr):
return self.getSegmentName(addr)

Expand Down Expand Up @@ -169,7 +168,6 @@ def getFlowChart(self, addr):
function = idaapi.get_func(addr)
return list(idaapi.FlowChart(function))


def getSpDelta(self, addr):
f = idaapi.get_func(addr)
return idaapi.get_sp_delta(f, addr)
Expand Down Expand Up @@ -198,18 +196,18 @@ def isTerminatingBB(self, bb):
return True

return False

def skipJumpTable(self, addr):
while idc.print_insn_mnem(addr) == "":
addr = idc.next_head(addr, idc.get_inf_attr(idc.INF_MAX_EA))
return addr

def setName(self, addr, name, size=0):
idc.set_name(addr, name, idc.SN_NOCHECK)

def setComment(self, addr, comment, repeatable=False):
idc.set_cmt(addr, comment, repeatable)

def normalizeFuncName(self, funcName):
# remove appended _n from IDA Pro names
funcName = re.sub(r"_[\d]+$", "", funcName)
Expand Down

0 comments on commit c6983cd

Please sign in to comment.