view python/readelf.py @ 118:db8aafe00d27

Added elf file read scripts
author Windel Bouwman
date Sat, 12 Jan 2013 09:39:23 +0100
parents
children bbf4c9b138d4
line wrap: on
line source

#!/usr/bin/python

import elffile, argparse

parser = argparse.ArgumentParser()
parser.add_argument('file', type=argparse.FileType('rb'))
parser.add_argument('-l', action='store_const', const=True, default=False, dest='list_program_headers')

args = parser.parse_args()
print(args)
ef = elffile.ElfFile(args.file)
print(ef)

if args.list_program_headers:
   print('program headers')
   ef.printProgramHeaders()