diff options
| -rwxr-xr-x | example/disas_and_graph.py | 1 | ||||
| -rw-r--r-- | miasm/arch/ia32_sem.py | 1 | ||||
| -rw-r--r-- | miasm/tools/pe_helper.py | 5 | ||||
| -rwxr-xr-x | setup.py | 83 |
4 files changed, 63 insertions, 27 deletions
diff --git a/example/disas_and_graph.py b/example/disas_and_graph.py index c7ec26aa..03519a70 100755 --- a/example/disas_and_graph.py +++ b/example/disas_and_graph.py @@ -2,7 +2,6 @@ import os from elfesteem import * from miasm.tools.pe_helper import * -from miasm.tools import seh_helper from miasm.core import bin_stream import inspect from miasm.core import asmbloc diff --git a/miasm/arch/ia32_sem.py b/miasm/arch/ia32_sem.py index 8738d264..ae0acca3 100644 --- a/miasm/arch/ia32_sem.py +++ b/miasm/arch/ia32_sem.py @@ -20,6 +20,7 @@ from miasm.arch.ia32_reg import * from miasm.arch.ia32_arch import * import math +EXCEPT_SOFT_BP = (1<<1) EXCEPT_PRIV_INSN = 1<<7 reg_eax = 'eax' reg_ebx = 'ebx' diff --git a/miasm/tools/pe_helper.py b/miasm/tools/pe_helper.py index 8d912e24..ef46e4d9 100644 --- a/miasm/tools/pe_helper.py +++ b/miasm/tools/pe_helper.py @@ -27,7 +27,10 @@ import miasm.core.asmbloc import miasm.core.bin_stream import os import re -from miasm.tools import to_c_helper +try: + from miasm.tools import to_c_helper +except ImportError: + print "WARNING: cannot import to_c_helper, skipping" from miasm.core import bin_stream from collections import defaultdict diff --git a/setup.py b/setup.py index f3a2be16..03adc925 100755 --- a/setup.py +++ b/setup.py @@ -2,28 +2,61 @@ from distutils.core import setup,Extension -setup( - name = 'Miasm', - version = '0.1', - packages=['miasm', 'miasm/tools', - 'miasm/expression', 'miasm/graph', 'miasm/arch', - 'miasm/core', 'miasm/tools/emul_lib' ], - package_data = {'miasm':['tools/emul_lib/*.h']}, -# data_files = [('toto', ['miasm/tools/emul_lib/queue.h'])], - ext_modules = [ - Extension("miasm.tools.emul_lib.libcodenat_interface", - ["miasm/tools/emul_lib/libcodenat_interface.c", - "miasm/tools/emul_lib/libcodenat.c"]), - Extension("miasm.tools.emul_lib.libcodenat_tcc", - ["miasm/tools/emul_lib/libcodenat_tcc.c"], - libraries=["tcc"]) - ], - - # Metadata - author = 'Fabrice Desclaux', - author_email = 'serpilliere@droid-corp.org', - description = 'Machine code manipulation library', - license = 'GPLv2', - # keywords = '', - # url = '', -) +def buil_all(): + setup( + name = 'Miasm', + version = '0.1', + packages=['miasm', 'miasm/tools', + 'miasm/expression', 'miasm/graph', 'miasm/arch', + 'miasm/core', 'miasm/tools/emul_lib' ], + package_data = {'miasm':['tools/emul_lib/*.h']}, + # data_files = [('toto', ['miasm/tools/emul_lib/queue.h'])], + ext_modules = [ + Extension("miasm.tools.emul_lib.libcodenat_interface", + ["miasm/tools/emul_lib/libcodenat_interface.c", + "miasm/tools/emul_lib/libcodenat.c"]), + Extension("miasm.tools.emul_lib.libcodenat_tcc", + ["miasm/tools/emul_lib/libcodenat_tcc.c"], + libraries=["tcc"]) + ], + # Metadata + author = 'Fabrice Desclaux', + author_email = 'serpilliere@droid-corp.org', + description = 'Machine code manipulation library', + license = 'GPLv2', + # keywords = '', + # url = '', + ) + + + +def buil_no_tcc(): + setup( + name = 'Miasm', + version = '0.1', + packages=['miasm', 'miasm/tools', + 'miasm/expression', 'miasm/graph', 'miasm/arch', + 'miasm/core', 'miasm/tools/emul_lib' ], + package_data = {'miasm':['tools/emul_lib/*.h']}, + # data_files = [('toto', ['miasm/tools/emul_lib/queue.h'])], + # Metadata + author = 'Fabrice Desclaux', + author_email = 'serpilliere@droid-corp.org', + description = 'Machine code manipulation library', + license = 'GPLv2', + # keywords = '', + # url = '', + ) + + +def try_build(): + try: + buil_all() + return + except: + print "WARNING cannot build with libtcc!, trying without it" + print "Miasm will not be able to emulate code" + buil_no_tcc() + + +try_build() |