Mercurial > lcfOS
annotate 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 |
rev | line source |
---|---|
118 | 1 #!/usr/bin/python |
2 | |
3 import elffile, argparse | |
4 | |
5 parser = argparse.ArgumentParser() | |
6 parser.add_argument('file', type=argparse.FileType('rb')) | |
7 parser.add_argument('-l', action='store_const', const=True, default=False, dest='list_program_headers') | |
8 | |
9 args = parser.parse_args() | |
10 print(args) | |
11 ef = elffile.ElfFile(args.file) | |
12 print(ef) | |
13 | |
14 if args.list_program_headers: | |
15 print('program headers') | |
16 ef.printProgramHeaders() | |
17 |