2013-11-27 15:53:20 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import sys
|
2013-11-29 14:11:01 -05:00
|
|
|
import time
|
2013-11-27 15:53:20 -05:00
|
|
|
import pepy
|
2013-11-29 14:11:01 -05:00
|
|
|
|
2013-11-27 15:53:20 -05:00
|
|
|
p = pepy.parse(sys.argv[1])
|
|
|
|
ep = p.get_entry_point()
|
|
|
|
byts = p.get_bytes(ep, 8)
|
2013-11-29 14:28:39 -05:00
|
|
|
print "Signature: %s" % hex(p.signature)
|
|
|
|
print "Machine: %s" % hex(p.machine)
|
2013-11-29 21:56:12 -05:00
|
|
|
print "Number of sections: %s" % p.numberofsections
|
|
|
|
print "Number of symbols: %s" % p.numberofsymbols
|
|
|
|
print "Characteristics: %s" % hex(p.characteristics)
|
2013-11-29 14:11:01 -05:00
|
|
|
print "Timedatestamp: %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(p.timedatestamp))
|
2013-11-27 15:53:20 -05:00
|
|
|
print "Bytes at 0x%x: %s" % (ep, byts)
|
2013-11-30 21:36:05 -05:00
|
|
|
sections = p.get_sections()
|
|
|
|
print "Sections: (%i)" % len(sections)
|
|
|
|
for sect in sections:
|
2013-11-29 23:32:32 -05:00
|
|
|
print "[+] %s" % sect.name
|
|
|
|
print "\tBase: %s" % hex(sect.base)
|
2013-11-30 21:36:05 -05:00
|
|
|
print "\tLength: %s" % sect.length
|
|
|
|
print "\tVirtual address: %s" % hex(sect.virtaddr)
|
|
|
|
print "\tVirtual size: %i" % sect.virtsize
|
|
|
|
print "\tNumber of Relocations: %i" % sect.numrelocs
|
|
|
|
print "\tNumber of Line Numbers: %i" % sect.numlinenums
|
|
|
|
print "\tCharacteristics: %s" % hex(sect.characteristics)
|
|
|
|
imports = p.get_imports()
|
|
|
|
print "Imports: (%i)" % len(imports)
|
|
|
|
for imp in imports:
|
|
|
|
print "[+] Symbol: %s (%s %s)" % (imp.sym, imp.name, hex(imp.addr))
|
|
|
|
exports = p.get_exports()
|
|
|
|
print "Exports: (%i)" % len(exports)
|
|
|
|
for exp in exports:
|
|
|
|
print "[+] Module: %s (%s %s)" % (exp.mod, exp.func, hex(exp.addr))
|