From 26c1075723a02984da6d3bc7423c5c0c43082dc3 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Mon, 4 Mar 2019 12:22:16 +0100 Subject: [PATCH] Rename elfesteem loader --- example/asm/shellcode.py | 4 ++-- example/elfesteem/minidump_to_pe.py | 4 ++-- example/elfesteem/test_pe.py | 4 ++-- example/jitter/arm_sc.py | 2 +- example/jitter/run_with_linuxenv.py | 2 +- example/jitter/unpack_upx.py | 2 +- miasm/analysis/binary.py | 4 ++-- miasm/jitter/loader/elf.py | 12 ++++++------ miasm/jitter/loader/pe.py | 6 +++--- miasm/{elfesteem => loader}/__init__.py | 0 miasm/{elfesteem => loader}/cstruct.py | 0 miasm/{elfesteem => loader}/elf.py | 2 +- miasm/{elfesteem => loader}/elf_init.py | 6 +++--- miasm/{elfesteem => loader}/minidump.py | 2 +- miasm/{elfesteem => loader}/minidump_init.py | 4 ++-- miasm/{elfesteem => loader}/new_cstruct.py | 0 miasm/{elfesteem => loader}/pe.py | 4 ++-- miasm/{elfesteem => loader}/pe_init.py | 4 ++-- miasm/{elfesteem => loader}/strpatchwork.py | 0 miasm/os_dep/win_api_x86_32_seh.py | 2 +- setup.py | 2 +- test/analysis/dse.py | 2 +- test/arch/aarch64/unit/asm_test.py | 2 +- test/arch/mips32/unit/asm_test.py | 2 +- test/arch/x86/unit/asm_test.py | 2 +- 25 files changed, 37 insertions(+), 37 deletions(-) rename miasm/{elfesteem => loader}/__init__.py (100%) rename miasm/{elfesteem => loader}/cstruct.py (100%) rename miasm/{elfesteem => loader}/elf.py (99%) rename miasm/{elfesteem => loader}/elf_init.py (99%) rename miasm/{elfesteem => loader}/minidump.py (99%) rename miasm/{elfesteem => loader}/minidump_init.py (98%) rename miasm/{elfesteem => loader}/new_cstruct.py (100%) rename miasm/{elfesteem => loader}/pe.py (99%) rename miasm/{elfesteem => loader}/pe_init.py (99%) rename miasm/{elfesteem => loader}/strpatchwork.py (100%) diff --git a/example/asm/shellcode.py b/example/asm/shellcode.py index 59ea3a943..67c882e90 100755 --- a/example/asm/shellcode.py +++ b/example/asm/shellcode.py @@ -4,8 +4,8 @@ from pdb import pm from future.utils import viewitems -from miasm.elfesteem import pe_init -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader import pe_init +from miasm.loader.strpatchwork import StrPatchwork from miasm.core import parse_asm, asmblock from miasm.analysis.machine import Machine diff --git a/example/elfesteem/minidump_to_pe.py b/example/elfesteem/minidump_to_pe.py index 8aff3e624..30a953254 100644 --- a/example/elfesteem/minidump_to_pe.py +++ b/example/elfesteem/minidump_to_pe.py @@ -5,8 +5,8 @@ from future.utils import viewvalues -from miasm.elfesteem.minidump_init import Minidump -from miasm.elfesteem.pe_init import PE +from miasm.loader.minidump_init import Minidump +from miasm.loader.pe_init import PE minidump = Minidump(open(sys.argv[1], 'rb').read()) diff --git a/example/elfesteem/test_pe.py b/example/elfesteem/test_pe.py index e9cff0b42..543cbea5f 100644 --- a/example/elfesteem/test_pe.py +++ b/example/elfesteem/test_pe.py @@ -1,7 +1,7 @@ #! /usr/bin/env python -import miasm.elfesteem.pe as pe -from miasm.elfesteem.pe_init import PE +import miasm.loader.pe as pe +from miasm.loader.pe_init import PE import rlcompleter import readline import pdb diff --git a/example/jitter/arm_sc.py b/example/jitter/arm_sc.py index ddadbf29e..9ff770ff5 100755 --- a/example/jitter/arm_sc.py +++ b/example/jitter/arm_sc.py @@ -3,7 +3,7 @@ from miasm.core.utils import int_to_byte from miasm.analysis.sandbox import Sandbox_Linux_armb_str from miasm.analysis.sandbox import Sandbox_Linux_arml_str -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader.strpatchwork import StrPatchwork from pdb import pm diff --git a/example/jitter/run_with_linuxenv.py b/example/jitter/run_with_linuxenv.py index 0237cc942..f981d2ddd 100644 --- a/example/jitter/run_with_linuxenv.py +++ b/example/jitter/run_with_linuxenv.py @@ -2,7 +2,7 @@ import logging import re -from miasm.elfesteem import elf as elf_csts +from miasm.loader import elf as elf_csts from miasm.os_dep.linux import environment, syscall from miasm.analysis.machine import Machine diff --git a/example/jitter/unpack_upx.py b/example/jitter/unpack_upx.py index 05d28b16a..3b8125f45 100644 --- a/example/jitter/unpack_upx.py +++ b/example/jitter/unpack_upx.py @@ -2,7 +2,7 @@ import os import logging from pdb import pm -from miasm.elfesteem import pe +from miasm.loader import pe from miasm.analysis.sandbox import Sandbox_Win_x86_32 # User defined methods diff --git a/miasm/analysis/binary.py b/miasm/analysis/binary.py index 6dc095cf0..66244822f 100644 --- a/miasm/analysis/binary.py +++ b/miasm/analysis/binary.py @@ -131,7 +131,7 @@ class ContainerPE(Container): def parse(self, data, vm=None, **kwargs): from miasm.jitter.loader.pe import vm_load_pe, guess_arch - from miasm.elfesteem import pe_init + from miasm.loader import pe_init # Parse signature if not data.startswith(b'MZ'): @@ -178,7 +178,7 @@ def parse(self, data, vm=None, addr=0, apply_reloc=False, **kwargs): """ from miasm.jitter.loader.elf import vm_load_elf, guess_arch, \ fill_loc_db_with_symbols - from miasm.elfesteem import elf_init + from miasm.loader import elf_init # Parse signature if not data.startswith(b'\x7fELF'): diff --git a/miasm/jitter/loader/elf.py b/miasm/jitter/loader/elf.py index 4c68fc919..b70872dfc 100644 --- a/miasm/jitter/loader/elf.py +++ b/miasm/jitter/loader/elf.py @@ -3,9 +3,9 @@ from future.utils import viewitems -from miasm.elfesteem import cstruct -from miasm.elfesteem import * -import miasm.elfesteem.elf as elf_csts +from miasm.loader import cstruct +from miasm.loader import * +import miasm.loader.elf as elf_csts from miasm.jitter.csts import * from miasm.jitter.loader.utils import canon_libname_libfunc, libimp @@ -56,11 +56,11 @@ def preload_elf(vm, e, runtime_lib, patch_vm_imp=True, loc_db=None): return runtime_lib, dyn_funcs def fill_loc_db_with_symbols(elf, loc_db, base_addr=0): - """Parse the miasm.elfesteem's ELF @elf to extract symbols, and fill the LocationDB + """Parse the miasm.loader's ELF @elf to extract symbols, and fill the LocationDB instance @loc_db with parsed symbols. The ELF is considered mapped at @base_addr - @elf: miasm.elfesteem's ELF instance + @elf: miasm.loader's ELF instance @loc_db: LocationDB used to retrieve symbols'offset @base_addr: addr to reloc to (if any) """ @@ -163,7 +163,7 @@ def fill_loc_db_with_symbols(elf, loc_db, base_addr=0): def apply_reloc_x86(elf, vm, section, base_addr, loc_db): """Apply relocation for x86 ELF contained in the section @section - @elf: miasm.elfesteem's ELF instance + @elf: miasm.loader's ELF instance @vm: VmMngr instance @section: elf's section containing relocation to perform @base_addr: addr to reloc to diff --git a/miasm/jitter/loader/pe.py b/miasm/jitter/loader/pe.py index a2bdd3ac9..63a56d383 100644 --- a/miasm/jitter/loader/pe.py +++ b/miasm/jitter/loader/pe.py @@ -6,9 +6,9 @@ from future.utils import viewitems, viewvalues -from miasm.elfesteem import pe -from miasm.elfesteem import cstruct -from miasm.elfesteem import * +from miasm.loader import pe +from miasm.loader import cstruct +from miasm.loader import * from miasm.jitter.csts import * from miasm.jitter.loader.utils import canon_libname_libfunc, libimp diff --git a/miasm/elfesteem/__init__.py b/miasm/loader/__init__.py similarity index 100% rename from miasm/elfesteem/__init__.py rename to miasm/loader/__init__.py diff --git a/miasm/elfesteem/cstruct.py b/miasm/loader/cstruct.py similarity index 100% rename from miasm/elfesteem/cstruct.py rename to miasm/loader/cstruct.py diff --git a/miasm/elfesteem/elf.py b/miasm/loader/elf.py similarity index 99% rename from miasm/elfesteem/elf.py rename to miasm/loader/elf.py index bdd088b8c..742587826 100644 --- a/miasm/elfesteem/elf.py +++ b/miasm/loader/elf.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -from miasm.elfesteem.cstruct import CStruct +from miasm.loader.cstruct import CStruct class Ehdr(CStruct): _fields = [ ("ident","16s"), diff --git a/miasm/elfesteem/elf_init.py b/miasm/loader/elf_init.py similarity index 99% rename from miasm/elfesteem/elf_init.py rename to miasm/loader/elf_init.py index 14a37eb5a..36c4cfafc 100644 --- a/miasm/elfesteem/elf_init.py +++ b/miasm/loader/elf_init.py @@ -8,9 +8,9 @@ from future.utils import PY3, with_metaclass from miasm.core.utils import force_bytes -from miasm.elfesteem import cstruct -from miasm.elfesteem import elf -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader import cstruct +from miasm.loader import elf +from miasm.loader.strpatchwork import StrPatchwork log = logging.getLogger("elfparse") console_handler = logging.StreamHandler() diff --git a/miasm/elfesteem/minidump.py b/miasm/loader/minidump.py similarity index 99% rename from miasm/elfesteem/minidump.py rename to miasm/loader/minidump.py index ee2be8a08..fbb7bde5b 100644 --- a/miasm/elfesteem/minidump.py +++ b/miasm/loader/minidump.py @@ -4,7 +4,7 @@ from future.utils import viewitems from future.builtins import int as int_types -from miasm.elfesteem.new_cstruct import CStruct +from miasm.loader.new_cstruct import CStruct class Enumeration(object): """Stand for an enumeration type""" diff --git a/miasm/elfesteem/minidump_init.py b/miasm/loader/minidump_init.py similarity index 98% rename from miasm/elfesteem/minidump_init.py rename to miasm/loader/minidump_init.py index 0a9022b9e..dd37f730c 100644 --- a/miasm/elfesteem/minidump_init.py +++ b/miasm/loader/minidump_init.py @@ -4,8 +4,8 @@ from builtins import range import struct -from miasm.elfesteem.strpatchwork import StrPatchwork -from miasm.elfesteem import minidump as mp +from miasm.loader.strpatchwork import StrPatchwork +from miasm.loader import minidump as mp class MemorySegment(object): diff --git a/miasm/elfesteem/new_cstruct.py b/miasm/loader/new_cstruct.py similarity index 100% rename from miasm/elfesteem/new_cstruct.py rename to miasm/loader/new_cstruct.py diff --git a/miasm/elfesteem/pe.py b/miasm/loader/pe.py similarity index 99% rename from miasm/elfesteem/pe.py rename to miasm/loader/pe.py index 56bffbaab..96009ccfa 100644 --- a/miasm/elfesteem/pe.py +++ b/miasm/loader/pe.py @@ -10,8 +10,8 @@ from future.utils import PY3 from miasm.core.utils import force_bytes -from miasm.elfesteem.new_cstruct import CStruct -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader.new_cstruct import CStruct +from miasm.loader.strpatchwork import StrPatchwork log = logging.getLogger("pepy") console_handler = logging.StreamHandler() diff --git a/miasm/elfesteem/pe_init.py b/miasm/loader/pe_init.py similarity index 99% rename from miasm/elfesteem/pe_init.py rename to miasm/loader/pe_init.py index e243cecb6..2d7e3fa1e 100644 --- a/miasm/elfesteem/pe_init.py +++ b/miasm/loader/pe_init.py @@ -11,8 +11,8 @@ from future.builtins import int as int_types from future.utils import PY3 -from miasm.elfesteem import pe -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader import pe +from miasm.loader.strpatchwork import StrPatchwork log = logging.getLogger("peparse") console_handler = logging.StreamHandler() diff --git a/miasm/elfesteem/strpatchwork.py b/miasm/loader/strpatchwork.py similarity index 100% rename from miasm/elfesteem/strpatchwork.py rename to miasm/loader/strpatchwork.py diff --git a/miasm/os_dep/win_api_x86_32_seh.py b/miasm/os_dep/win_api_x86_32_seh.py index 5d8ed3d74..40f15480f 100644 --- a/miasm/os_dep/win_api_x86_32_seh.py +++ b/miasm/os_dep/win_api_x86_32_seh.py @@ -23,7 +23,7 @@ from future.utils import viewitems -from miasm.elfesteem import pe_init +from miasm.loader import pe_init from miasm.jitter.csts import PAGE_READ, PAGE_WRITE from miasm.core.utils import pck32 diff --git a/setup.py b/setup.py index 3aaeaf277..81f8e4a23 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def buil_all(): "miasm/analysis", "miasm/os_dep", "miasm/os_dep/linux", - "miasm/elfesteem", + "miasm/loader", "miasm/jitter", "miasm/jitter/arch", "miasm/jitter/loader", diff --git a/test/analysis/dse.py b/test/analysis/dse.py index 21225f54b..7d5998f15 100644 --- a/test/analysis/dse.py +++ b/test/analysis/dse.py @@ -3,7 +3,7 @@ from future.utils import viewitems -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader.strpatchwork import StrPatchwork from miasm.core import parse_asm from miasm.expression.expression import ExprCompose, ExprOp, ExprInt, ExprId from miasm.core.asmblock import asm_resolve_final diff --git a/test/arch/aarch64/unit/asm_test.py b/test/arch/aarch64/unit/asm_test.py index 9d193b47f..fe59f0d82 100644 --- a/test/arch/aarch64/unit/asm_test.py +++ b/test/arch/aarch64/unit/asm_test.py @@ -7,7 +7,7 @@ from miasm.core import parse_asm from miasm.expression.expression import * from miasm.core import asmblock -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader.strpatchwork import StrPatchwork from miasm.analysis.machine import Machine from miasm.jitter.csts import * diff --git a/test/arch/mips32/unit/asm_test.py b/test/arch/mips32/unit/asm_test.py index dd95c3afe..2dcaf6fc6 100644 --- a/test/arch/mips32/unit/asm_test.py +++ b/test/arch/mips32/unit/asm_test.py @@ -7,7 +7,7 @@ from miasm.core import parse_asm from miasm.expression.expression import * from miasm.core import asmblock -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader.strpatchwork import StrPatchwork from miasm.analysis.machine import Machine from miasm.jitter.csts import * diff --git a/test/arch/x86/unit/asm_test.py b/test/arch/x86/unit/asm_test.py index cf87ac933..6e7c55e2e 100644 --- a/test/arch/x86/unit/asm_test.py +++ b/test/arch/x86/unit/asm_test.py @@ -9,7 +9,7 @@ from miasm.core import parse_asm from miasm.expression.expression import * from miasm.core import asmblock -from miasm.elfesteem.strpatchwork import StrPatchwork +from miasm.loader.strpatchwork import StrPatchwork from miasm.analysis.machine import Machine from miasm.jitter.csts import *