LIEF/examples/python/abstract_json.py
Romain Thomas 3b17aba10e Refactor some parts of the Architecture:
* JSON visitor are located in the format namespace
  * Visitor are *real* visitor
  * Visitable class has been renamed to Object
  * Due to a bug in Visual Studio 2015, we move to VS2017
2018-03-13 16:49:02 +01:00

26 lines
554 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description
# -----------
# Dump abstract informations in a JSON format
# see: abstract_reader.py
import argparse
import sys
import lief
import json
def main():
parser = argparse.ArgumentParser()
parser.add_argument('binary', help = 'A binary')
args = parser.parse_args()
binary = lief.parse(args.binary)
json_data = json.loads(lief.to_json_from_abstract(binary))
print(json.dumps(json_data, sort_keys = True, indent = 4))
if __name__ == "__main__":
sys.exit(main())