pe-parse/python/test.py
Wesley Shields b4ad87819e Support section, symbols and characteristics.
While here, make it easier to extend by providing macros to eliminate
the mundane that goes into writing getset members.
2013-11-29 21:56:12 -05:00

20 lines
570 B
Python
Executable File

#!/usr/bin/env python
import sys
import time
import pepy
p = pepy.parse(sys.argv[1])
ep = p.get_entry_point()
byts = p.get_bytes(ep, 8)
print "Signature: %s" % hex(p.signature)
print "Machine: %s" % hex(p.machine)
print "Number of sections: %s" % p.numberofsections
print "Number of symbols: %s" % p.numberofsymbols
print "Characteristics: %s" % hex(p.characteristics)
print "Timedatestamp: %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(p.timedatestamp))
print "Bytes at 0x%x: %s" % (ep, byts)
print "Sections:"
for sect in p.get_sections():
print(sect)