firmflaws
firmflaws copied to clipboard
Use r2.cmdj and json !
Stop using that kind of syntax😧:
imports = "\n".join([_ for _ in r2.cmd("ii").split("\n") if "name=" in _])
or
def is_elf(file):
with open(file.filepath, "rb") as fd:
head = fd.read(4)
return (b"\x7FELF" == head)
This is useless iIj will return information in json, just scrap "bintype".
Every command in r2 world can be expressed in json by appending j it's one of the fundamental of @radare.
Use r2.cmdj to retrieve the result.