about summary refs log tree commit diff stats
path: root/miasm2/analysis/binary.py
diff options
context:
space:
mode:
authorCamille Mougey <camille.mougey@cea.fr>2014-11-03 18:04:20 +0100
committerCamille Mougey <camille.mougey@cea.fr>2014-11-03 18:04:20 +0100
commit1c6b959a3a73580a74186f25e66d4844185f98d8 (patch)
tree45604d01f2cb36d38b9de817192dc760fba22ddd /miasm2/analysis/binary.py
parent7d0bdbcafda15a48b56669c978225f60f9ca80c9 (diff)
downloadmiasm-1c6b959a3a73580a74186f25e66d4844185f98d8.tar.gz
miasm-1c6b959a3a73580a74186f25e66d4844185f98d8.zip
Container: Fix import, refactor file reading
Diffstat (limited to 'miasm2/analysis/binary.py')
-rw-r--r--miasm2/analysis/binary.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/miasm2/analysis/binary.py b/miasm2/analysis/binary.py
index 7ea2ecc4..5c506280 100644
--- a/miasm2/analysis/binary.py
+++ b/miasm2/analysis/binary.py
@@ -1,6 +1,7 @@
 import logging
 
 from miasm2.core.bin_stream import *
+from elfesteem import pe_init, elf_init
 from miasm2.jitter.jitload import vm_load_pe, vm_load_elf
 from miasm2.jitter.csts import PAGE_READ
 
@@ -23,7 +24,8 @@ class Container(object):
         "Instanciate a container and parse the binary"
 
         # Initialisation
-        data = open(filename).read()
+        with open(filename) as fdesc:
+            data = fdesc.read()
         log.info('load binary')
         e, bs, ep = None, None, None