mirror of
https://github.com/androguard/androguard.git
synced 2024-10-07 18:23:25 +00:00
adding disasm test output
This commit is contained in:
parent
39a996467a
commit
2235d082a8
@ -490,7 +490,6 @@ def androsign_main(args_apk, args_hash, args_all, show):
|
||||
except ValueError as ve:
|
||||
# RSA pkey does not have an hash algorithm
|
||||
pass
|
||||
|
||||
print()
|
||||
|
||||
|
||||
@ -509,6 +508,18 @@ def androdis_main(offset, size, dex):
|
||||
buf = fp.read()
|
||||
d = dvm.DalvikVMFormat(buf)
|
||||
|
||||
if size == 0 and offset == 0:
|
||||
# Assume you want to just get a disassembly of all classes and methods
|
||||
for cls in d.get_classes():
|
||||
print("# CLASS: {}".format(cls.get_name()))
|
||||
for m in cls.get_methods():
|
||||
print("## METHOD: {} {} {}".format(m.get_access_flags_string(), m.get_name(), m.get_descriptor()))
|
||||
for idx, ins in m.get_instructions_idx():
|
||||
print('{:08x} {}'.format(idx, ins.disasm()))
|
||||
|
||||
print()
|
||||
print()
|
||||
|
||||
if size == 0:
|
||||
size = len(buf)
|
||||
|
||||
|
@ -4357,6 +4357,10 @@ class FillArrayData:
|
||||
s = binascii.hexlify(self.get_raw()).decode("ascii")
|
||||
return " ".join(s[i:i + 2] for i in range(0, len(s), 2))
|
||||
|
||||
def disasm(self):
|
||||
# FIXME:
|
||||
return self.show_buff(None)
|
||||
|
||||
|
||||
class SparseSwitch:
|
||||
"""
|
||||
@ -4489,6 +4493,10 @@ class SparseSwitch:
|
||||
s = binascii.hexlify(self.get_raw()).decode('ascii')
|
||||
return " ".join(s[i:i + 2] for i in range(0, len(s), 2))
|
||||
|
||||
def disasm(self):
|
||||
# FIXME:
|
||||
return self.show_buff(None)
|
||||
|
||||
|
||||
class PackedSwitch:
|
||||
"""
|
||||
@ -4627,6 +4635,10 @@ class PackedSwitch:
|
||||
s = binascii.hexlify(self.get_raw()).decode('ascii')
|
||||
return " ".join(s[i:i + 2] for i in range(0, len(s), 2))
|
||||
|
||||
def disasm(self):
|
||||
# FIXME:
|
||||
return self.show_buff(None)
|
||||
|
||||
|
||||
class Instruction35c(Instruction):
|
||||
"""
|
||||
@ -4794,6 +4806,8 @@ class Instruction21c(Instruction):
|
||||
|
||||
def get_output(self, idx=-1):
|
||||
kind = get_kind(self.cm, self.get_kind(), self.BBBB)
|
||||
if self.get_kind() == Kind.STRING:
|
||||
kind = '"{}"'.format(kind)
|
||||
return "v{}, {}".format(self.AA, kind)
|
||||
|
||||
def get_operands(self, idx=-1):
|
||||
|
Loading…
Reference in New Issue
Block a user