about summary refs log tree commit diff stats
path: root/example/disasm/full.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-01-12 12:54:06 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2017-01-12 12:54:06 +0100
commitc1a9a801dc2bf90e98deb02b045322228b976fa6 (patch)
tree12ac8d4e9aec2d4b68935a0d607165e67cf1775b /example/disasm/full.py
parentfd1f440961b24872a5a9c0da19cfc94d1d955386 (diff)
downloadmiasm-c1a9a801dc2bf90e98deb02b045322228b976fa6.tar.gz
miasm-c1a9a801dc2bf90e98deb02b045322228b976fa6.zip
Example: add raw disasm to full.py
Diffstat (limited to 'example/disasm/full.py')
-rw-r--r--example/disasm/full.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/example/disasm/full.py b/example/disasm/full.py
index 7ff60d3b..f15b59eb 100644
--- a/example/disasm/full.py
+++ b/example/disasm/full.py
@@ -50,6 +50,8 @@ parser.add_argument('-a', "--try-disasm-all", action="store_true",
                     help="Try to disassemble the whole binary")
 parser.add_argument('-i', "--image", action="store_true",
                     help="Display image representation of disasm")
+parser.add_argument('-c', "--rawbinary", default=False, action="store_true",
+                    help="Don't interpret input as ELF/PE/...")
 
 args = parser.parse_args()
 
@@ -57,8 +59,13 @@ if args.verbose:
     log_asmbloc.setLevel(logging.DEBUG)
 
 log.info('Load binary')
-with open(args.filename) as fdesc:
-    cont = Container.from_stream(fdesc, addr=args.shiftoffset)
+if args.rawbinary:
+    shift = args.shiftoffset if args.shiftoffset is not None else 0
+    cont = Container.fallback_container(open(args.filename).read(),
+                                        None, addr=shift)
+else:
+    with open(args.filename) as fdesc:
+        cont = Container.from_stream(fdesc, addr=args.shiftoffset)
 
 default_addr = cont.entry_point
 bs = cont.bin_stream