Giter Site home page Giter Site logo

statifier's Introduction

Statifier create from dynamically linked ELF executable
and all it's libraries (and all LD_PRELOAD libraries if any)
one file. This file can be copied and run on another machine
without need to drag all it's libraries.

Statifier use following software:
+----------+-----------------------+---------------------+
| Program  |  PackageName for RH72 | PackageName for RH9 |
+----------+-----------------------+---------------------+
| awk      |  gawk                 | gawk                |
| bash     |  bash                 | bash                |
| cat      |  textutils            | coreutils           |
| chmod    |  fileutils            | coreutils           |
| dirname  |  sh-utils             | coreutils           |
| mkdir    |  fileutils            | coreutils           |
| rm       |  fileutils            | coreutils           |
| uname    |  sh-utils             | coreutils           |
+----------+-----------------------+---------------------+

statifier's People

Stargazers

molety avatar Alex Myczko avatar Sebastian Mossberg avatar Marco Matthies avatar Sissel avatar  avatar garrison hinson-hasty avatar Isaque Neves avatar 马兴 avatar anatasluo avatar  avatar Willie Möller avatar vtta avatar Yasuhiro Yamada avatar Dorin Ionita avatar  avatar  avatar  avatar Blazej Krzeminski avatar  avatar Andrew Wong avatar  avatar  avatar  avatar Shawn Anastasio avatar Shengtuo Hu avatar Ryan M Smith avatar  avatar Andrey avatar Xiadong Zhu avatar qiao hai-jun avatar 49 avatar shekk avatar James Michael DuPont avatar Sung-Yu Chen avatar

Watchers

James Cloos avatar  avatar Paul Greenberg avatar  avatar

statifier's Issues

Files showing dynamic linking

I love the concept of this program, but I'm having trouble getting it to work. I installed it and noticed a few warnings when I tried it:

$ statifier ./uname uname_stat 
/usr/lib/statifier/64/non_pt_load: warning: can't find segment with v_addr=0x0
/usr/lib/statifier/64/non_pt_load: warning: can't find segment with v_addr=0x2000
/usr/lib/statifier/64/non_pt_load: warning: can't find segment with v_addr=0x7000
/usr/lib/statifier/64/non_pt_load: warning: can't find segment with v_addr=0x9000

The code ran, but it shows to be dynamically linked and not static:

$ file uname_stat 
uname_stat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, stripped

Any advice?

/usr/lib/statifier/64/my_gdb/usr/lib/statifier/64/my_gdb pid 39 exited with status 1

Statifier Output

# statifier -v -k /bin/df df.static
+ Main
+ set -e
+ source ./.statifier/common/option.src
++ opt_orig_exe=/bin/df
++ opt_new_exe=df.static
++ opt_loader_num_var=0
++ opt_keep_working_directory=yes
++ opt_verbose=yes
+ set +e
+ Sanity /bin/df
+ local Func=Sanity
+ '[' 1 -ne 1 -o x/bin/df = x ']'
+ local OrigExe=/bin/df
+ '[' -f /bin/df ']'
+ '[' -x /bin/df ']'
+ '[' -r /bin/df ']'
+ return 0
+ local ElfClass
++ /usr/lib/statifier/elf_class /bin/df
+ ElfClass=64
+ D=/usr/lib/statifier/64
+ '[' -d /usr/lib/statifier/64 ']'
+ local 'SH_VERBOSE=/bin/bash -x'
+ /bin/bash -x /usr/lib/statifier/64/statifier_common.sh ./.statifier 64
++ dirname /usr/lib/statifier/64/statifier_common.sh
+ D=/usr/lib/statifier/64
+ source /usr/lib/statifier/64/statifier_lib.src
+ '[' 2 -ne 2 -o x./.statifier = x -o x64 = x ']'
+ WORK_DIR=./.statifier
+ val_elf_class=64
+ SetVariables ./.statifier
+ '[' 1 -ne 1 -o x./.statifier = x ']'
+ local WORK_DIR=./.statifier
+ WORK_COMMON_DIR=./.statifier/common
+ LOADER_SYMBOLS=./.statifier/common/ld.syms
+ LOADER_PHDRS=./.statifier/common/ld.phdrs
+ OPTION_SRC=./.statifier/common/option.src
+ COMMON_SRC=./.statifier/common/common.src
+ LOADER_SRC=./.statifier/common/loader.src
+ WORK_GDB_CMD_DIR=./.statifier/gdb_cmd
+ WORK_DUMPS_DIR=./.statifier/dumps
+ WORK_GDB_OUT_DIR=./.statifier/gdb_out
+ MAPS_FILE=./.statifier/gdb_out/maps
+ INIT_MAPS_FILE=./.statifier/gdb_out/init_maps
+ REGISTERS_FILE=./.statifier/gdb_out/registers
+ MISC_SRC=./.statifier/gdb_out/misc.src
+ WORK_OUT_DIR=./.statifier/out
+ return 0
+ Main
+ set -e
+ source ./.statifier/common/option.src
++ opt_orig_exe=/bin/df
++ opt_new_exe=df.static
++ opt_loader_num_var=0
++ opt_keep_working_directory=yes
++ opt_verbose=yes
+ set +e
+ local val_interpreter
++ /usr/lib/statifier/64//elf_data -i /bin/df
+ val_interpreter=/lib64/ld-linux-x86-64.so.2
+ /usr/lib/statifier/64//elf_symbols /lib64/ld-linux-x86-64.so.2
+ set -e
++ /usr/lib/statifier/64//elf_data -e /lib64/ld-linux-x86-64.so.2
+ val_interpreter_file_entry=0x1a8e0
+ echo val_elf_class=64
+ echo 'val_interpreter='\''/lib64/ld-linux-x86-64.so.2'\'''
+ echo 'val_interpreter_file_entry='\''0x1a8e0'\'''
+ /usr/lib/statifier/64//elf_data -T val_interpreter_has_symtab= -B val_interpreter_file_base_addr= -W val_interpreter_file_rw_seg_addr= -S val_interpreter_rw_seg_size= /lib64/ld-linux-x86-64.so.2
+ return 0
+ exit 0
+ /bin/bash -x /usr/lib/statifier/64/statifier_loader.sh ./.statifier
++ dirname /usr/lib/statifier/64/statifier_loader.sh
+ D=/usr/lib/statifier/64
+ source /usr/lib/statifier/64/statifier_lib.src
+ source /usr/lib/statifier/64/properties.src
++ prop_pattern_dl_start_user='0x49 0x89 0xc4'
+ '[' 1 -ne 1 -o x./.statifier = x ']'
+ WORK_DIR=./.statifier
+ SetVariables ./.statifier
+ '[' 1 -ne 1 -o x./.statifier = x ']'
+ local WORK_DIR=./.statifier
+ WORK_COMMON_DIR=./.statifier/common
+ LOADER_SYMBOLS=./.statifier/common/ld.syms
+ LOADER_PHDRS=./.statifier/common/ld.phdrs
+ OPTION_SRC=./.statifier/common/option.src
+ COMMON_SRC=./.statifier/common/common.src
+ LOADER_SRC=./.statifier/common/loader.src
+ WORK_GDB_CMD_DIR=./.statifier/gdb_cmd
+ WORK_DUMPS_DIR=./.statifier/dumps
+ WORK_GDB_OUT_DIR=./.statifier/gdb_out
+ MAPS_FILE=./.statifier/gdb_out/maps
+ INIT_MAPS_FILE=./.statifier/gdb_out/init_maps
+ REGISTERS_FILE=./.statifier/gdb_out/registers
+ MISC_SRC=./.statifier/gdb_out/misc.src
+ WORK_OUT_DIR=./.statifier/out
+ return 0
+ Main
+ set -e
+ source ./.statifier/common/common.src
++ val_elf_class=64
++ val_interpreter=/lib64/ld-linux-x86-64.so.2
++ val_interpreter_file_entry=0x1a8e0
++ val_interpreter_file_base_addr=0x0
++ val_interpreter_rw_seg_size=0x29e8
++ val_interpreter_file_rw_seg_addr=0x30900
++ val_interpreter_has_symtab=no
+ set +e
+ ForDump
+ local val_breakpoint_start
++ GetSymbol _dl_start_user 1 no
++ '[' 3 -ne 3 -o x_dl_start_user = x -o x1 = x -o xno = x ']'
++ local Symbol=_dl_start_user
++ local IsMandatory=1
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_dl_start_user'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_dl_start_user'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ PgmName=/usr/lib/statifier/64/elf_find_pattern
+++ /usr/lib/statifier/64/elf_find_pattern /lib64/ld-linux-x86-64.so.2 0x49 0x89 0xc4
++ Value=0x1a8e8
++ '[' x0x1a8e8 = x ']'
++ printf 0x%x 0x1a8e8
++ return 0
+ val_breakpoint_start=0x1a8e8
+ echo 'val_breakpoint_start='\''0x1a8e8'\'''
+ return 0
+ ForStarter
+ local Value
+ local Var
+ local val_dl_list=
+ Var=_dl_argc
++ GetSymbol _dl_argc 1 no
++ '[' 3 -ne 3 -o x_dl_argc = x -o x1 = x -o xno = x ']'
++ local Symbol=_dl_argc
++ local IsMandatory=1
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_dl_argc'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_dl_argc'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ PgmName=/usr/lib/statifier/64/find_dl_argc
++ local Found=-1
+++ /usr/lib/statifier/64/find_dl_argc -1 0x0 0x30900 0x29e8
++ Value=0x31a80
++ '[' x0x31a80 = x ']'
++ printf 0x%x 0x31a80
++ return 0
+ Value=0x31a80
+ echo val__dl_argc=0x31a80
+ val_dl_list=' 0x31a80'
+ Var=_dl_argv
++ GetSymbol _dl_argv 1 no
++ '[' 3 -ne 3 -o x_dl_argv = x -o x1 = x -o xno = x ']'
++ local Symbol=_dl_argv
++ local IsMandatory=1
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_dl_argv'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_dl_argv'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ PgmName=/usr/lib/statifier/64/find_dl_argv
++ local Found=-1
+++ /usr/lib/statifier/64/find_dl_argv -1 0x0 0x30900 0x29e8
++ Value=0x31a78
++ '[' x0x31a78 = x ']'
++ printf 0x%x 0x31a78
++ return 0
+ Value=0x31a78
+ echo val__dl_argv=0x31a78
+ val_dl_list=' 0x31a80 0x31a78'
+ Var=_environ
++ GetSymbol _environ 1 no
++ '[' 3 -ne 3 -o x_environ = x -o x1 = x -o xno = x ']'
++ local Symbol=_environ
++ local IsMandatory=1
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_environ'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_environ'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ PgmName=/usr/lib/statifier/64/find_environ
++ local Found=-1
+++ /usr/lib/statifier/64/find_environ -1 0x0 0x30900 0x29e8
++ Value=0x332e0
++ '[' x0x332e0 = x ']'
++ printf 0x%x 0x332e0
++ return 0
+ Value=0x332e0
+ echo val__environ=0x332e0
+ val_dl_list=' 0x31a80 0x31a78 0x332e0'
+ Var=_dl_auxv
++ GetSymbol _dl_auxv 1 no
++ '[' 3 -ne 3 -o x_dl_auxv = x -o x1 = x -o xno = x ']'
++ local Symbol=_dl_auxv
++ local IsMandatory=1
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_dl_auxv'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_dl_auxv'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ PgmName=/usr/lib/statifier/64/find_dl_auxv
++ local Found=-1
+++ /usr/lib/statifier/64/find_dl_auxv -1 0x0 0x30900 0x29e8
++ Value=0x31b08
++ '[' x0x31b08 = x ']'
++ printf 0x%x 0x31b08
++ return 0
+ Value=0x31b08
+ echo val__dl_auxv=0x31b08
+ val_dl_list=' 0x31a80 0x31a78 0x332e0 0x31b08'
+ Var=_dl_platform
++ GetSymbol _dl_platform 0 no
++ '[' 3 -ne 3 -o x_dl_platform = x -o x0 = x -o xno = x ']'
++ local Symbol=_dl_platform
++ local IsMandatory=0
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_dl_platform'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_dl_platform'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ PgmName=/usr/lib/statifier/64/find_dl_platform
++ local Found=-1
+++ /usr/lib/statifier/64/find_dl_platform -1 0x0 0x30900 0x29e8
++ Value=0x31aa8
++ '[' x0x31aa8 = x ']'
++ printf 0x%x 0x31aa8
++ return 0
+ Value=0x31aa8
+ echo val__dl_platform=0x31aa8
+ val_dl_list=' 0x31a80 0x31a78 0x332e0 0x31b08 0x31aa8'
+ Var=_dl_platformlen
++ GetSymbol _dl_platformlen 0 no
++ '[' 3 -ne 3 -o x_dl_platformlen = x -o x0 = x -o xno = x ']'
++ local Symbol=_dl_platformlen
++ local IsMandatory=0
++ local IsGlobal=no
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''_dl_platformlen'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''_dl_platformlen'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xno = Xyes ']'
++ '[' x = x ']'
++ local PgmName
++ case "$Symbol" in
++ Value=
++ '[' x = x ']'
++ '[' x0 = x1 ']'
++ Value=0x0
++ printf 0x%x 0x0
++ return 0
+ Value=0x0
+ echo val__dl_platformlen=0x0
+ val_dl_list=' 0x31a80 0x31a78 0x332e0 0x31b08 0x31aa8 0x0'
+ Var=__libc_stack_end
++ GetSymbol __libc_stack_end 0 yes
++ '[' 3 -ne 3 -o x__libc_stack_end = x -o x0 = x -o xyes = x ']'
++ local Symbol=__libc_stack_end
++ local IsMandatory=0
++ local IsGlobal=yes
++ local 'MsgNotFound=/usr/lib/statifier/64/statifier_loader.sh: Symbol '\''__libc_stack_end'\'' not found in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'''
++ local 'MsgNoIdea=/usr/lib/statifier/64/statifier_loader.sh: internal error: no idea how to find '\''__libc_stack_end'\'' in the interpreter '\''/lib64/ld-linux-x86-64.so.2'\'' without symtab.'
++ local Value=
++ '[' Xno = Xyes -o Xyes = Xyes ']'
+++ awk -vSymbol=__libc_stack_end '{
			if ($NF == Symbol) {
				print "0x" $2;
				exit 0;
			}
		}'
++ Value=0x0000000000031a48
++ '[' x0x0000000000031a48 = x ']'
++ '[' x0x0000000000031a48 = x ']'
++ printf 0x%x 0x0000000000031a48
++ return 0
+ Value=0x31a48
+ echo val___libc_stack_end=0x31a48
+ val_dl_list=' 0x31a80 0x31a78 0x332e0 0x31b08 0x31aa8 0x0 0x31a48'
+ echo 'val_dl_list='\'' 0x31a80 0x31a78 0x332e0 0x31b08 0x31aa8 0x0 0x31a48'\'''
+ return 0
+ return 0
+ exit 0
+ /bin/bash -x /usr/lib/statifier/64/statifier_dump.sh ./.statifier
++ dirname /usr/lib/statifier/64/statifier_dump.sh
+ D=/usr/lib/statifier/64
+ source /usr/lib/statifier/64/statifier_lib.src
+ '[' 1 -ne 1 -o x./.statifier = x ']'
+ WORK_DIR=./.statifier
+ SetVariables ./.statifier
+ '[' 1 -ne 1 -o x./.statifier = x ']'
+ local WORK_DIR=./.statifier
+ WORK_COMMON_DIR=./.statifier/common
+ LOADER_SYMBOLS=./.statifier/common/ld.syms
+ LOADER_PHDRS=./.statifier/common/ld.phdrs
+ OPTION_SRC=./.statifier/common/option.src
+ COMMON_SRC=./.statifier/common/common.src
+ LOADER_SRC=./.statifier/common/loader.src
+ WORK_GDB_CMD_DIR=./.statifier/gdb_cmd
+ WORK_DUMPS_DIR=./.statifier/dumps
+ WORK_GDB_OUT_DIR=./.statifier/gdb_out
+ MAPS_FILE=./.statifier/gdb_out/maps
+ INIT_MAPS_FILE=./.statifier/gdb_out/init_maps
+ REGISTERS_FILE=./.statifier/gdb_out/registers
+ MISC_SRC=./.statifier/gdb_out/misc.src
+ WORK_OUT_DIR=./.statifier/out
+ return 0
+ Main
+ set -e
+ set -a
+ source ./.statifier/common/option.src
++ opt_orig_exe=/bin/df
++ opt_new_exe=df.static
++ opt_loader_num_var=0
++ opt_keep_working_directory=yes
++ opt_verbose=yes
+ set +a
+ source ./.statifier/common/common.src
++ val_elf_class=64
++ val_interpreter=/lib64/ld-linux-x86-64.so.2
++ val_interpreter_file_entry=0x1a8e0
++ val_interpreter_file_base_addr=0x0
++ val_interpreter_rw_seg_size=0x29e8
++ val_interpreter_file_rw_seg_addr=0x30900
++ val_interpreter_has_symtab=no
+ source ./.statifier/common/loader.src
++ val_breakpoint_start=0x1a8e8
++ val__dl_argc=0x31a80
++ val__dl_argv=0x31a78
++ val__environ=0x332e0
++ val__dl_auxv=0x31b08
++ val__dl_platform=0x31aa8
++ val__dl_platformlen=0x0
++ val___libc_stack_end=0x31a48
++ val_dl_list=' 0x31a80 0x31a78 0x332e0 0x31b08 0x31aa8 0x0 0x31a48'
+ set +e
+ DumpRegistersAndMemory
+ /usr/lib/statifier/64/my_gdb /bin/df 0x1a8e8 0x1a8e0 ./.statifier/gdb_out/misc.src ./.statifier/gdb_out/regs_from_kernel ./.statifier/gdb_out/init_maps ./.statifier/gdb_out/registers ./.statifier/gdb_out/maps ./.statifier/gdb_out/set_thread_area ./.statifier/dumps
/usr/lib/statifier/64/my_gdb/usr/lib/statifier/64/my_gdb pid 82 exited with status 1
+ return
+ return
+ exit
+ return
+ st=1
+ '[' xyes = x ']'
+ exit 1

Dockerfile

FROM debian:latest

RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates \
 && update-ca-certificates --fresh \
 && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

RUN apt-get update \
 && apt-get install -y --no-install-recommends \
        wget unzip build-essential gcc-multilib \
        libncurses5 \
 && cd /opt \
 && wget https://github.com/greenpau/statifier/archive/refs/heads/master.zip \
 && unzip master.zip \
 && rm -rf master.zip \
 && cd statifier-master \
 && sh configure \
 && make \
 && make install \
 && rm -rf /var/cache/apt/* /var/lib/apt/lists/*

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.