MCPcopy Create free account
hub / github.com/lief-project/LIEF / print_header

Function print_header

api/python/examples/macho_reader.py:70–86  ·  view source on GitHub ↗
(binary)

Source from the content-addressed store, hash-verified

68
69@exceptions_handler(Exception)
70def print_header(binary):
71 format_str = "{:<33} {:<30}"
72 format_hex = "{:<33} 0x{:<28x}"
73 format_dec = "{:<33} {:<30d}"
74
75 print("== Header ==")
76 header = binary.header
77 flags_str = " - ".join([str(s).split(".")[-1] for s in header.flags_list])
78
79 print(format_str.format("Magic:", str(header.magic).split(".")[-1]))
80 print(format_str.format("CPU Type:", str(header.cpu_type).split(".")[-1]))
81 print(format_hex.format("CPU sub-type:", header.cpu_subtype))
82 print(format_str.format("File Type:", str(header.file_type).split(".")[-1]))
83 print(format_str.format("Flags:", flags_str))
84 print(format_dec.format("Number of commands:", header.nb_cmds))
85 print(format_hex.format("Size of commands:", header.sizeof_cmds))
86 print(format_hex.format("Reserved:", header.reserved))
87
88@exceptions_handler(Exception)
89def print_commands(binary):

Callers 1

mainFunction · 0.70

Calls 2

printFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected