diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/readelf.py	Sat Jan 12 09:39:23 2013 +0100
@@ -0,0 +1,17 @@
+#!/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()
+