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

Function print_debug

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

Source from the content-addressed store, hash-verified

255
256@exceptions_handler(Exception)
257def print_debug(binary):
258 format_str = "{:<33} {:<30}"
259 format_hex = "{:<33} 0x{:<28x}"
260 format_dec = "{:<33} {:<30d}"
261
262 debugs = binary.debug
263 print("== Debug ({}) ==".format(len(debugs)))
264 for debug in debugs:
265 print(format_hex.format("Characteristics:", debug.characteristics))
266 print(format_hex.format("Timestamp:", debug.timestamp))
267 print(format_dec.format("Major version:", debug.major_version))
268 print(format_dec.format("Minor version:", debug.minor_version))
269 print(format_str.format("type:", str(debug.type).split(".")[-1]))
270 print(format_hex.format("Size of data:", debug.sizeof_data))
271 print(format_hex.format("Address of raw data:", debug.addressof_rawdata))
272 print(format_hex.format("Pointer to raw data:", debug.pointerto_rawdata))
273
274 if isinstance(debug, lief.PE.CodeViewPDB):
275 code_view: lief.PE.CodeViewPDB = debug
276 cv_signature = code_view.cv_signature
277 sig_str = " ".join(map(lambda e : "{:02x}".format(e), code_view.signature))
278 print(format_str.format("Code View Signature:", str(cv_signature).split(".")[-1]))
279 print(format_str.format("Signature:", sig_str))
280 print(format_dec.format("Age:", code_view.age))
281 print(format_str.format("Filename:", code_view.filename))
282 elif isinstance(debug, lief.PE.CodeView):
283 code_view: lief.PE.CodeView = debug
284 cv_signature = code_view.cv_signature
285 print(format_str.format("Code View Signature:", str(cv_signature).split(".")[-1]))
286 elif isinstance(debug, lief.PE.Pogo):
287 pogo: lief.PE.Pogo = debug
288 sig_str = str(pogo.signature).split(".")[-1]
289 print(format_str.format("Signature:", sig_str))
290 print("Entries:")
291 for entry in pogo.entries:
292 print(" {:<20} 0x{:x} ({:d})".format(entry.name, entry.start_rva, entry.size))
293
294 print("\n")
295
296@exceptions_handler(Exception)
297def print_signature(binary):

Callers 1

mainFunction · 0.85

Calls 3

mapClass · 0.85
printFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected