about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--example/disasm/full.py5
-rw-r--r--example/expression/simplification_add.py5
-rw-r--r--example/expression/simplification_tools.py5
-rw-r--r--example/expression/solve_condition_stp.py6
-rw-r--r--example/jitter/sandbox_elf_aarch64l.py9
-rw-r--r--example/jitter/sandbox_pe_x86_32.py6
-rw-r--r--example/jitter/sandbox_pe_x86_64.py6
-rw-r--r--example/jitter/unpack_upx.py6
-rw-r--r--example/jitter/x86_32.py6
-rw-r--r--miasm2/jitter/arch/JitCore_aarch64.c12
-rw-r--r--miasm2/jitter/arch/JitCore_arm.c8
-rw-r--r--miasm2/jitter/arch/JitCore_mips32.c8
-rw-r--r--miasm2/jitter/arch/JitCore_msp430.c8
-rw-r--r--miasm2/jitter/arch/JitCore_x86.c14
-rw-r--r--miasm2/jitter/vm_mngr_py.c53
-rw-r--r--test/arch/aarch64/arch.py7
-rw-r--r--test/arch/arm/arch.py5
-rw-r--r--test/arch/mips32/arch.py10
-rw-r--r--test/arch/msp430/arch.py6
-rw-r--r--test/arch/sh4/arch.py6
-rw-r--r--test/arch/x86/arch.py4
21 files changed, 52 insertions, 143 deletions
diff --git a/example/disasm/full.py b/example/disasm/full.py
index 33903282..3bfb7658 100644
--- a/example/disasm/full.py
+++ b/example/disasm/full.py
@@ -1,4 +1,3 @@
-import os
 import logging
 from argparse import ArgumentParser
 from pdb import pm
@@ -17,10 +16,6 @@ console_handler.setFormatter(logging.Formatter("%(levelname)-5s: %(message)s"))
 log.addHandler(console_handler)
 log.setLevel(logging.INFO)
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
 
 parser = ArgumentParser("Disassemble a binary")
 parser.add_argument('filename', help="File to disassemble")
diff --git a/example/expression/simplification_add.py b/example/expression/simplification_add.py
index 06b683fe..41720f3a 100644
--- a/example/expression/simplification_add.py
+++ b/example/expression/simplification_add.py
@@ -1,11 +1,6 @@
 import miasm2.expression.expression as m2_expr
 from miasm2.expression.simplifications import expr_simp
 from pdb import pm
-import os
-
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
 
 print """
 Expression simplification demo: Adding a simplification:
diff --git a/example/expression/simplification_tools.py b/example/expression/simplification_tools.py
index 6a4ff715..258b5ce4 100644
--- a/example/expression/simplification_tools.py
+++ b/example/expression/simplification_tools.py
@@ -1,10 +1,5 @@
 from miasm2.expression.expression import *
 from pdb import pm
-import os
-
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
 
 print """
 Expression simplification demo.
diff --git a/example/expression/solve_condition_stp.py b/example/expression/solve_condition_stp.py
index 0ca17faa..27b0512f 100644
--- a/example/expression/solve_condition_stp.py
+++ b/example/expression/solve_condition_stp.py
@@ -1,4 +1,3 @@
-import os
 import sys
 import subprocess
 from collections import defaultdict
@@ -19,11 +18,6 @@ from miasm2.core import parse_asm
 from miasm2.arch.x86.disasm import dis_x86_32 as dis_engine
 
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
-
 mn = mn_x86
 
 parser = OptionParser(usage="usage: %prog [options] file")
diff --git a/example/jitter/sandbox_elf_aarch64l.py b/example/jitter/sandbox_elf_aarch64l.py
index 0a4c88db..0f028876 100644
--- a/example/jitter/sandbox_elf_aarch64l.py
+++ b/example/jitter/sandbox_elf_aarch64l.py
@@ -1,14 +1,7 @@
-import os
+import logging
 from pdb import pm
 from miasm2.analysis.sandbox import Sandbox_Linux_aarch64l
 from miasm2.jitter.jitload import log_func
-import logging
-
-
-# Python auto completion
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
 
 # Insert here user defined methods
 
diff --git a/example/jitter/sandbox_pe_x86_32.py b/example/jitter/sandbox_pe_x86_32.py
index 738e0778..3a627b19 100644
--- a/example/jitter/sandbox_pe_x86_32.py
+++ b/example/jitter/sandbox_pe_x86_32.py
@@ -1,12 +1,6 @@
-import os
 from pdb import pm
 from miasm2.analysis.sandbox import Sandbox_Win_x86_32
 
-# Python auto completion
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
 # Insert here user defined methods
 
 # Parse arguments
diff --git a/example/jitter/sandbox_pe_x86_64.py b/example/jitter/sandbox_pe_x86_64.py
index 8d9db88e..773c54b9 100644
--- a/example/jitter/sandbox_pe_x86_64.py
+++ b/example/jitter/sandbox_pe_x86_64.py
@@ -1,12 +1,6 @@
-import os
 from pdb import pm
 from miasm2.analysis.sandbox import Sandbox_Win_x86_64
 
-# Python auto completion
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
 # Insert here user defined methods
 
 # Parse arguments
diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py
index d95c5a18..8160e51b 100644
--- a/example/jitter/unpack_upx.py
+++ b/example/jitter/unpack_upx.py
@@ -4,12 +4,6 @@ from pdb import pm
 from elfesteem import pe
 from miasm2.analysis.sandbox import Sandbox_Win_x86_32
 
-
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
-
 # User defined methods
 
 def kernel32_GetProcAddress(jitter):
diff --git a/example/jitter/x86_32.py b/example/jitter/x86_32.py
index 91244bf6..1409d7aa 100644
--- a/example/jitter/x86_32.py
+++ b/example/jitter/x86_32.py
@@ -1,15 +1,9 @@
-import os
 from argparse import ArgumentParser
 from miasm2.jitter.csts import PAGE_READ, PAGE_WRITE
 from miasm2.analysis.machine import Machine
 
 from pdb import pm
 
-
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
 parser = ArgumentParser(description="x86 32 basic Jitter")
 parser.add_argument("filename", help="x86 32 shellcode filename")
 parser.add_argument("-j", "--jitter",
diff --git a/miasm2/jitter/arch/JitCore_aarch64.c b/miasm2/jitter/arch/JitCore_aarch64.c
index 8674b684..03113d30 100644
--- a/miasm2/jitter/arch/JitCore_aarch64.c
+++ b/miasm2/jitter/arch/JitCore_aarch64.c
@@ -115,7 +115,7 @@ PyObject* cpu_set_gpreg(JitCpu* self, PyObject *args)
     unsigned int i, found;
 
     if (!PyArg_ParseTuple(args, "O", &dict))
-	    return NULL;
+	    RAISE(PyExc_TypeError,"Cannot parse arguments");
     if(!PyDict_Check(dict))
 	    RAISE(PyExc_TypeError, "arg must be dict");
     while(PyDict_Next(dict, &pos, &d_key, &d_value)){
@@ -194,7 +194,7 @@ PyObject* cpu_set_exception(JitCpu* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -248,10 +248,6 @@ void MEM_WRITE_64(JitCpu* jitcpu, uint64_t addr, uint64_t src)
 }
 
 
-
-
-
-
 PyObject* vm_set_mem(JitCpu *self, PyObject* args)
 {
        PyObject *py_addr;
@@ -261,10 +257,10 @@ PyObject* vm_set_mem(JitCpu *self, PyObject* args)
        char * buffer;
        uint64_t size;
        uint64_t addr;
-       int ret = 0x1337;
+       int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_buffer))
-	       return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
 
diff --git a/miasm2/jitter/arch/JitCore_arm.c b/miasm2/jitter/arch/JitCore_arm.c
index 869a9a7c..d6e27acc 100644
--- a/miasm2/jitter/arch/JitCore_arm.c
+++ b/miasm2/jitter/arch/JitCore_arm.c
@@ -79,7 +79,7 @@ PyObject* cpu_set_gpreg(JitCpu* self, PyObject *args)
     unsigned int i, found;
 
     if (!PyArg_ParseTuple(args, "O", &dict))
-	    return NULL;
+	    RAISE(PyExc_TypeError,"Cannot parse arguments");
     if(!PyDict_Check(dict))
 	    RAISE(PyExc_TypeError, "arg must be dict");
     while(PyDict_Next(dict, &pos, &d_key, &d_value)){
@@ -147,7 +147,7 @@ PyObject* cpu_set_exception(JitCpu* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -225,10 +225,10 @@ PyObject* vm_set_mem(JitCpu *self, PyObject* args)
        char * buffer;
        uint64_t size;
        uint64_t addr;
-       int ret = 0x1337;
+       int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_buffer))
-	       return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
 
diff --git a/miasm2/jitter/arch/JitCore_mips32.c b/miasm2/jitter/arch/JitCore_mips32.c
index fc5589ff..04e4d883 100644
--- a/miasm2/jitter/arch/JitCore_mips32.c
+++ b/miasm2/jitter/arch/JitCore_mips32.c
@@ -109,7 +109,7 @@ PyObject* cpu_set_gpreg(JitCpu* self, PyObject *args)
     unsigned int i, found;
 
     if (!PyArg_ParseTuple(args, "O", &dict))
-	    return NULL;
+	    RAISE(PyExc_TypeError,"Cannot parse arguments");
     if(!PyDict_Check(dict))
 	    RAISE(PyExc_TypeError, "arg must be dict");
     while(PyDict_Next(dict, &pos, &d_key, &d_value)){
@@ -190,7 +190,7 @@ PyObject* cpu_set_exception(JitCpu* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -254,10 +254,10 @@ PyObject* vm_set_mem(JitCpu *self, PyObject* args)
        char * buffer;
        uint64_t size;
        uint64_t addr;
-       int ret = 0x1337;
+       int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_buffer))
-	       return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
 
diff --git a/miasm2/jitter/arch/JitCore_msp430.c b/miasm2/jitter/arch/JitCore_msp430.c
index bfa35926..d30655dd 100644
--- a/miasm2/jitter/arch/JitCore_msp430.c
+++ b/miasm2/jitter/arch/JitCore_msp430.c
@@ -92,7 +92,7 @@ PyObject* cpu_set_gpreg(JitCpu* self, PyObject *args)
     unsigned int i, found;
 
     if (!PyArg_ParseTuple(args, "O", &dict))
-	    return NULL;
+	    RAISE(PyExc_TypeError,"Cannot parse arguments");
     if(!PyDict_Check(dict))
 	    RAISE(PyExc_TypeError, "arg must be dict");
     while(PyDict_Next(dict, &pos, &d_key, &d_value)){
@@ -164,7 +164,7 @@ PyObject* cpu_set_exception(JitCpu* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -227,10 +227,10 @@ PyObject* vm_set_mem(JitCpu *self, PyObject* args)
        char * buffer;
        uint64_t size;
        uint64_t addr;
-       int ret = 0x1337;
+       int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_buffer))
-	       return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
 
diff --git a/miasm2/jitter/arch/JitCore_x86.c b/miasm2/jitter/arch/JitCore_x86.c
index 461e2224..95cb18bd 100644
--- a/miasm2/jitter/arch/JitCore_x86.c
+++ b/miasm2/jitter/arch/JitCore_x86.c
@@ -138,7 +138,7 @@ PyObject* cpu_set_gpreg(JitCpu* self, PyObject *args)
     unsigned int i, found;
 
     if (!PyArg_ParseTuple(args, "O", &dict))
-	    return NULL;
+	    RAISE(PyExc_TypeError,"Cannot parse arguments");
     if(!PyDict_Check(dict))
 	    RAISE(PyExc_TypeError, "arg must be dict");
     while(PyDict_Next(dict, &pos, &d_key, &d_value)){
@@ -238,7 +238,7 @@ PyObject* cpu_set_exception(JitCpu* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -258,7 +258,7 @@ PyObject* cpu_set_interrupt_num(JitCpu* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -278,7 +278,7 @@ PyObject* cpu_set_segm_base(JitCpu* self, PyObject* args)
 	uint64_t segm_num, segm_base;
 
 	if (!PyArg_ParseTuple(args, "OO", &item1, &item2))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, segm_num);
 	PyGetInt(item2, segm_base);
@@ -295,7 +295,7 @@ PyObject* cpu_get_segm_base(JitCpu* self, PyObject* args)
 	PyObject* v;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 	PyGetInt(item1, segm_num);
 	v = PyInt_FromLong((long)(((vm_cpu_t*)self->cpu)->segm_base[segm_num]));
 	return v;
@@ -355,10 +355,10 @@ PyObject* vm_set_mem(JitCpu *self, PyObject* args)
        char * buffer;
        uint64_t size;
        uint64_t addr;
-       int ret = 0x1337;
+       int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_buffer))
-	       return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
 
diff --git a/miasm2/jitter/vm_mngr_py.c b/miasm2/jitter/vm_mngr_py.c
index 4436add2..5f25b707 100644
--- a/miasm2/jitter/vm_mngr_py.c
+++ b/miasm2/jitter/vm_mngr_py.c
@@ -76,7 +76,9 @@ PyObject* set_alarm(VmMngr* self)
 {
 	global_vmmngr = self;
 	signal(SIGALRM, sig_alarm);
-	return PyLong_FromUnsignedLongLong((uint64_t)0);
+
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 
@@ -90,7 +92,6 @@ PyObject* vm_add_memory_page(VmMngr* self, PyObject* args)
 	uint64_t buf_size;
 	char* buf_data;
 	Py_ssize_t length;
-	uint64_t ret = 0x1337beef;
 	uint64_t page_addr;
 	uint64_t page_access;
 	char* name_ptr;
@@ -98,7 +99,7 @@ PyObject* vm_add_memory_page(VmMngr* self, PyObject* args)
 	struct memory_page_node * mpn;
 
 	if (!PyArg_ParseTuple(args, "OOO|O", &addr, &access, &item_str, &name))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(addr, page_addr);
 	PyGetInt(access, page_access);
@@ -128,8 +129,8 @@ PyObject* vm_add_memory_page(VmMngr* self, PyObject* args)
 	memcpy(mpn->ad_hp, buf_data, buf_size);
 	add_memory_page(&self->vm_mngr, mpn);
 
-	return PyLong_FromUnsignedLongLong((uint64_t)ret);
-
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 
@@ -138,14 +139,12 @@ PyObject* vm_set_mem_access(VmMngr* self, PyObject* args)
 {
 	PyObject *addr;
 	PyObject *access;
-
-	uint64_t ret = 0x1337beef;
 	uint64_t page_addr;
 	uint64_t page_access;
 	struct memory_page_node * mpn;
 
 	if (!PyArg_ParseTuple(args, "OO", &addr, &access))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(addr, page_addr);
 	PyGetInt(access, page_access);
@@ -157,7 +156,9 @@ PyObject* vm_set_mem_access(VmMngr* self, PyObject* args)
 	}
 
 	mpn->access = page_access;
-	return PyLong_FromUnsignedLongLong((uint64_t)ret);
+
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 PyObject* vm_set_mem(VmMngr* self, PyObject* args)
@@ -169,15 +170,15 @@ PyObject* vm_set_mem(VmMngr* self, PyObject* args)
        char * buffer;
        uint64_t size;
        uint64_t addr;
-       int ret = 0x1337;
+       int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_buffer))
-	      return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
 
-       if(!PyString_Check(py_buffer))
-	      RAISE(PyExc_TypeError,"arg must be str");
+       if (!PyString_Check(py_buffer))
+	       RAISE(PyExc_TypeError,"arg must be str");
 
        size = PyString_Size(py_buffer);
        PyString_AsStringAndSize(py_buffer, &buffer, &py_length);
@@ -202,7 +203,7 @@ PyObject* vm_get_mem_access(VmMngr* self, PyObject* args)
 	struct memory_page_node * mpn;
 
 	if (!PyArg_ParseTuple(args, "O", &py_addr))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(py_addr, page_addr);
 
@@ -227,15 +228,14 @@ PyObject* vm_get_mem(VmMngr* self, PyObject* args)
        int ret;
 
        if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_len))
-	      return NULL;
+	       RAISE(PyExc_TypeError,"Cannot parse arguments");
 
        PyGetInt(py_addr, addr);
        PyGetInt(py_len, size);
 
        ret = vm_read_mem(&self->vm_mngr, addr, &buf_out, size);
        if (ret < 0) {
-	      PyErr_SetString(PyExc_RuntimeError, "cannot find address");
-	      return NULL;
+	       RAISE(PyExc_TypeError,"Cannot find address");
        }
 
        obj_out = PyString_FromStringAndSize(buf_out, size);
@@ -255,7 +255,7 @@ PyObject* vm_add_memory_breakpoint(VmMngr* self, PyObject* args)
 	uint64_t b_access;
 
 	if (!PyArg_ParseTuple(args, "OOO", &ad, &size, &access))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(ad, b_ad);
 	PyGetInt(size, b_size);
@@ -283,7 +283,7 @@ PyObject* vm_remove_memory_breakpoint(VmMngr* self, PyObject* args)
 	uint64_t b_access;
 
 	if (!PyArg_ParseTuple(args, "OO", &ad, &access))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(ad, b_ad);
 	PyGetInt(access, b_access);
@@ -300,7 +300,7 @@ PyObject* vm_set_exception(VmMngr* self, PyObject* args)
 	uint64_t i;
 
 	if (!PyArg_ParseTuple(args, "O", &item1))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, i);
 
@@ -363,7 +363,7 @@ PyObject* py_add_mem_read(VmMngr* self, PyObject* args)
 	uint64_t size;
 
 	if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_size))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(py_addr, addr);
 	PyGetInt(py_size, size);
@@ -381,7 +381,7 @@ PyObject* py_add_mem_write(VmMngr* self, PyObject* args)
 	uint64_t size;
 
 	if (!PyArg_ParseTuple(args, "OO", &py_addr, &py_size))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(py_addr, addr);
 	PyGetInt(py_size, size);
@@ -482,13 +482,12 @@ PyObject* vm_add_code_bloc(VmMngr *self, PyObject *args)
 {
 	PyObject *item1;
 	PyObject *item2;
-	uint64_t ret = 0x1337beef;
 	uint64_t ad_start, ad_stop, ad_code = 0;
 
 	struct code_bloc_node * cbp;
 
 	if (!PyArg_ParseTuple(args, "OO", &item1, &item2))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(item1, ad_start);
 	PyGetInt(item2, ad_stop);
@@ -498,7 +497,9 @@ PyObject* vm_add_code_bloc(VmMngr *self, PyObject *args)
 	cbp->ad_stop = ad_stop;
 	cbp->ad_code = ad_code;
 	add_code_bloc(&self->vm_mngr, cbp);
-	return PyLong_FromUnsignedLongLong((uint64_t)ret);
+
+	Py_INCREF(Py_None);
+	return Py_None;
 }
 
 PyObject* vm_dump_code_bloc_pool(VmMngr* self)
@@ -520,7 +521,7 @@ PyObject* vm_is_mapped(VmMngr* self, PyObject* args)
 	int ret;
 
 	if (!PyArg_ParseTuple(args, "OO", &ad, &size))
-		return NULL;
+		RAISE(PyExc_TypeError,"Cannot parse arguments");
 
 	PyGetInt(ad, b_ad);
 	PyGetInt(size, b_size);
diff --git a/test/arch/aarch64/arch.py b/test/arch/aarch64/arch.py
index 4fc9a3c4..ec978024 100644
--- a/test/arch/aarch64/arch.py
+++ b/test/arch/aarch64/arch.py
@@ -1,12 +1,7 @@
-import os, sys
+import sys
 import time
 from miasm2.arch.aarch64.arch import *
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
-
 reg_tests_aarch64 = [
     ("XXXXXXXX    MOV        W1, WZR",
      "E1031F2A"),
diff --git a/test/arch/arm/arch.py b/test/arch/arm/arch.py
index d2022238..cb0e56fe 100644
--- a/test/arch/arm/arch.py
+++ b/test/arch/arm/arch.py
@@ -1,11 +1,6 @@
-import os
 import time
 from miasm2.arch.arm.arch import *
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
 if 0:
     a = bs('00')
     b = bs('01')
diff --git a/test/arch/mips32/arch.py b/test/arch/mips32/arch.py
index 0fb12e1b..b28e2583 100644
--- a/test/arch/mips32/arch.py
+++ b/test/arch/mips32/arch.py
@@ -1,18 +1,8 @@
-import os, sys
 import time
 from pdb import pm
 
-sys.path.append('/home/serpilliere/projet/m2_devel')
 from miasm2.arch.mips32.arch import *
 
-import sys
-
-
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
-
 reg_tests_mips32 = [
     ("004496D8    ADDU       GP, GP, T9",
      "0399E021"),
diff --git a/test/arch/msp430/arch.py b/test/arch/msp430/arch.py
index 613af385..b3dbac82 100644
--- a/test/arch/msp430/arch.py
+++ b/test/arch/msp430/arch.py
@@ -1,12 +1,6 @@
-
-import os
 import time
 from miasm2.arch.msp430.arch import *
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
 
 def h2i(s):
     return s.replace(' ', '').decode('hex')
diff --git a/test/arch/sh4/arch.py b/test/arch/sh4/arch.py
index b7e79d30..7d3d890e 100644
--- a/test/arch/sh4/arch.py
+++ b/test/arch/sh4/arch.py
@@ -1,13 +1,7 @@
-import os
 import time
 from sys import stderr
 from miasm2.arch.sh4.arch import *
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
-
-
 def h2i(s):
     return s.replace(' ', '').decode('hex')
 
diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py
index 83039368..72884f7e 100644
--- a/test/arch/x86/arch.py
+++ b/test/arch/x86/arch.py
@@ -1,4 +1,3 @@
-import os
 import time
 import miasm2.expression.expression as m2_expr
 from miasm2.arch.x86.arch import mn_x86, deref_mem_ad, ParseAst, ast_int2expr, \
@@ -6,9 +5,6 @@ from miasm2.arch.x86.arch import mn_x86, deref_mem_ad, ParseAst, ast_int2expr, \
 from miasm2.arch.x86.sem import ir_x86_16, ir_x86_32, ir_x86_64
 from miasm2.core.bin_stream import bin_stream_str
 
-filename = os.environ.get('PYTHONSTARTUP')
-if filename and os.path.isfile(filename):
-    execfile(filename)
 for s in ["[EAX]",
           "[0x10]",
           "[EBX + 0x10]",