Skip to content

Commit

Permalink
Rename elfesteem loader
Browse files Browse the repository at this point in the history
  • Loading branch information
serpilliere committed Mar 5, 2019
1 parent bb675f5 commit 26c1075
Show file tree
Hide file tree
Showing 25 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions example/asm/shellcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions example/elfesteem/minidump_to_pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
4 changes: 2 additions & 2 deletions example/elfesteem/test_pe.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/jitter/arm_sc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion example/jitter/run_with_linuxenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/jitter/unpack_upx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions miasm/analysis/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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'):
Expand Down
12 changes: 6 additions & 6 deletions miasm/jitter/loader/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
"""
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions miasm/jitter/loader/pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion miasm/elfesteem/elf.py → miasm/loader/elf.py
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions miasm/elfesteem/elf_init.py → miasm/loader/elf_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion miasm/elfesteem/minidump.py → miasm/loader/minidump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions miasm/elfesteem/pe.py → miasm/loader/pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions miasm/elfesteem/pe_init.py → miasm/loader/pe_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion miasm/os_dep/win_api_x86_32_seh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/analysis/dse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/arch/aarch64/unit/asm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *

Expand Down
2 changes: 1 addition & 1 deletion test/arch/mips32/unit/asm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *

Expand Down
2 changes: 1 addition & 1 deletion test/arch/x86/unit/asm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *

Expand Down

0 comments on commit 26c1075

Please sign in to comment.