Skip to content

Commit

Permalink
Merge pull request #39 from gitoleg/fix-loader
Browse files Browse the repository at this point in the history
fixes loader  IDA-7 compatibility
  • Loading branch information
gitoleg authored Apr 5, 2019
2 parents 3a64cf9 + 5ead27e commit 2bd0cde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
6 changes: 5 additions & 1 deletion plugins/bap/utils/ida.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from ._comment_handler import CommentHandlers
from ._ctyperewriter import Rewriter

try:
from idc import get_segm_name
except ImportError:
from idaapi import get_segm_name

service = Service()
comment = CommentHandlers()
Expand All @@ -30,7 +34,7 @@ def output_segments(out):
out.writelines(('(', info.get_proc_name()[1], ' ', size, ' ('))
for seg in idautils.Segments():
out.write("\n({} {} {:d} ({:#x} {:d}))".format(
idaapi.get_segm_name(seg),
get_segm_name(seg),
"code" if idaapi.segtype(seg) == idaapi.SEG_CODE else "data",
idaapi.get_fileregion_offset(seg),
seg, idaapi.getseg(seg).size()))
Expand Down
17 changes: 9 additions & 8 deletions tests/mockidaapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
PLUGIN_DRAW = NotImplemented
PLUGIN_HIDE = NotImplemented
PLUGIN_KEEP = NotImplemented
class plugin_t(object): NotImplemented
class text_sink_t(object): NotImplemented
class Choose2(object): NotImplemented
def idadir(sub): NotImplemented
def get_cmt(ea, off): NotImplemented
def set_cmt(ea, off): NotImplemented
def askyn_c(dflt, title): NotImplemented
def get_input_file_path() : NotImplemented
class plugin_t(object): pass
class text_sink_t(object): pass
class Choose2(object): pass
def idadir(sub): return NotImplemented
def get_cmt(ea, off): return NotImplemented
def set_cmt(ea, off): return NotImplemented
def askyn_c(dflt, title): return NotImplemented
def get_input_file_path() : return NotImplemented
def get_segm_name(ea): return NotImplemented

0 comments on commit 2bd0cde

Please sign in to comment.