Skip to content

Commit

Permalink
Merge pull request #15 from gluesmith2021/ida_bug_fixes
Browse files Browse the repository at this point in the history
IDA Pro support bug fixes
  • Loading branch information
steven-hh-ding committed Oct 28, 2023
2 parents 2c472ef + e86375d commit b5b212b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jvd/disassembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def disassemble(
if capa and 'capa' not in res:
from jvd.capa.extractor import capa_analyze
if 'bytes' in res:
file_or_bytes = base64.decodeBase64(res['bytes'])
file_or_bytes = base64.b64decode(res['bytes'])
else:
file_or_bytes = file

Expand Down
2 changes: 2 additions & 0 deletions jvd/ida/ida.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def _process(self, file, file_type, output_file_path, decompile=False, verbose=-
with check_output_ctx(cmd, timeout=self.timeout, env=sub_env) as log:
if not log:
log = ''
if isinstance(log, bytes):
log = log.decode('ascii')

if decompile:
# assuming that IDA does not support decompilation
Expand Down
12 changes: 7 additions & 5 deletions jvd/ida/ida_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from ida_name import *
from idc import *
import idaapi
import ida_bytes
import ida_ida
import json
from collections import defaultdict
Expand Down Expand Up @@ -412,10 +413,11 @@ def get_all(function_eas: list = None, with_blocks=True, current_ea=False, inclu
'functions_src': []
}
if include_bytes:
ea_min = ida_ida.inf_get_min_ea()
ea_max = ida_ida.inf_get_max_ea()
data['bytes'] = base64.b64encode(idaapi.get_bytes(
ea_min, ea_max - ea_min
)).decode('ascii')
all_bytes = bytearray()
chunk_ea = ida_ida.inf_get_min_ea()
while chunk_ea != idaapi.BADADDR:
all_bytes.extend(idaapi.get_bytes(chunk_ea, ida_bytes.chunk_size(chunk_ea)))
chunk_ea = ida_bytes.next_chunk(chunk_ea)
data['bytes'] = base64.b64encode(all_bytes).decode('ascii')
return data

0 comments on commit b5b212b

Please sign in to comment.