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

Function print_sections

api/python/examples/pe_reader.py:147–160  ·  view source on GitHub ↗
(binary)

Source from the content-addressed store, hash-verified

145
146@exceptions_handler(Exception)
147def print_sections(binary):
148 sections = binary.sections
149
150 print("== Sections ==")
151 f_title = "|{:<10} | {:<16} | {:<16} | {:<18} | {:<16} | {:<9} | {:<9}"
152 f_value = "|{:<10} | 0x{:<14x} | 0x{:<14x} | 0x{:<16x} | 0x{:<14x} | {:<9.2f} | {:<9}"
153 print(f_title.format("Name", "Offset", "Size", "Virtual Address", "Virtual size", "Entropy", "Flags"))
154
155 for section in sections:
156 flags = ""
157 for flag in section.characteristics_lists:
158 flags += str(flag).split(".")[-1] + " "
159 print(f_value.format(section.name, section.offset, section.size, section.virtual_address, section.virtual_size, section.entropy, flags))
160 print("")
161
162
163@exceptions_handler(Exception)

Callers 1

mainFunction · 0.70

Calls 2

printFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected