Script started on Wed 20 Apr 2005 07:26:18 PM CEST
(19:26:22) ~/tmp/test_elfsh cat gentil.c
int hello()
{
  puts("hello");
}

int call_hello()
{
  puts("call hello from elsewhere");
  hello();
}

int main(int ac)
{
  puts("call hello");
  hello();
  call_hello();
}
(19:26:36) ~/tmp/test_elfsh cat mechant.c
int hook()
{
  puts("DTC");
}
(19:26:41) ~/tmp/test_elfsh make gentil
cc     gentil.c   -o gentil
(19:26:48) ~/tmp/test_elfsh cc -c mechant.c
(19:26:53) ~/tmp/test_elfsh elfsh 


	 Welcome to The ELF shell 0.62a (32 bits built) .::. 

 	 .::. This software is under the General Public License V.2 
	 .::. Please visit http://www.gnu.org for information about Free Software

created IMMED with val = 0 
(elfsh-0.62a) modload modflow

name : /usr/share/elfsh/modflow.so
 [*] ELFsh modflow(Apr 20 2005/17:22:12) fini -OK-

     Added commands:

	flow                                               : process control flow analysis
	graph    <file> <symbol/address> <address|+size>   : dump graphviz graph to file
	inspect  <symbol/address>                          : inspect block at vaddr
	flowjack <sym1> <sym2>                             : hijack xref from sym1 to sym2

(elfsh-0.62a) load mechant.o


 [*] New object mechant.o loaded on Wed Apr 20 19:27:13 2005
 

(elfsh-0.62a) load gentil


 [*] New object gentil loaded on Wed Apr 20 19:27:18 2005
 

(elfsh-0.62a) reladd gentil mechant.o

[DEBUG_BSS] BSSzone found with size = 4 
fixing up overlapping sections
RETURNED .bss as last bss 
[DEBUG_COPYPLT] Symbol at .plt + 16 injected succesfully 
[DEBUG_COPYPLT] Symbol at .plt + 32 injected succesfully 
 [*] ET_REL mechant.o injected succesfully in ET_EXEC gentil

(elfsh-0.62a) flow

 * 36 sections
 * section name=(      .comment) index=(00) not allocatable ->skipping ...
 * section name=(      .alt.plt) index=(01)          allocatable  executable -> analysing
[MODFLOW] loading code... vaddr = 08045114 foffset = 276 len = 4096
 [*] Entry point: 080482a0
 [*] starting disassembly
 * section name=(mechant.o.rodata) index=(02)          allocatable  not executable -> skipping ...
 * section name=(mechant.o.text) index=(03)          allocatable  executable -> analysing
[MODFLOW] loading code... vaddr = 08047114 foffset = 8468 len = 4096
 [*] Entry point: 080482a0
 [*] starting disassembly
 * section name=(       .interp) index=(04)          allocatable  not executable -> skipping ...
 * section name=( .note.ABI-tag) index=(05)          allocatable  not executable -> skipping ...
 * section name=(         .hash) index=(06)          allocatable  not executable -> skipping ...
 * section name=(       .dynsym) index=(07)          allocatable  not executable -> skipping ...
 * section name=(       .dynstr) index=(08)          allocatable  not executable -> skipping ...
 * section name=(  .gnu.version) index=(09)          allocatable  not executable -> skipping ...
 * section name=(.gnu.version_r) index=(10)          allocatable  not executable -> skipping ...
 * section name=(      .rel.dyn) index=(11)          allocatable  not executable -> skipping ...
 * section name=(      .rel.plt) index=(12)          allocatable  not executable -> skipping ...
 * section name=(         .init) index=(13)          allocatable  executable -> analysing
[MODFLOW] loading code... vaddr = 0804824c foffset = 12876 len = 25
 [*] Entry point: 080482a0
 [*] starting disassembly
 * section name=(          .plt) index=(14)          allocatable  executable -> analysing
[MODFLOW] loading code... vaddr = 08048268 foffset = 12904 len = 48
 [*] Entry point: 080482a0
 [*] starting disassembly
 * section name=(         .text) index=(15)          allocatable  executable -> analysing
[MODFLOW] loading code... vaddr = 080482a0 foffset = 12960 len = 496
 [*] Entry point: 080482a0
 [*] _start found at 080482a0
 [*] Linux-like start
 [*] main located at  8048391
 [*] starting disassembly
 * section name=(         .fini) index=(16)          allocatable  executable -> analysing
[MODFLOW] loading code... vaddr = 08048490 foffset = 13456 len = 32
 [*] Entry point: 080482a0
 [*] starting disassembly
 * section name=(       .rodata) index=(17)          allocatable  not executable -> skipping ...
 * section name=(         .data) index=(18)          allocatable  not executable -> skipping ...
 * section name=(     .eh_frame) index=(19)          allocatable  not executable -> skipping ...
 * section name=(      .dynamic) index=(20)          allocatable  not executable -> skipping ...
 * section name=(        .ctors) index=(21)          allocatable  not executable -> skipping ...
 * section name=(        .dtors) index=(22)          allocatable  not executable -> skipping ...
 * section name=(          .jcr) index=(23)          allocatable  not executable -> skipping ...
 * section name=(          .got) index=(24)          allocatable  not executable -> skipping ...
 * section name=(          .bss) index=(25)          allocatable  not executable -> skipping ...
 * section name=(      .comment) index=(26) not allocatable ->skipping ...
 * section name=(      .comment) index=(27) not allocatable ->skipping ...
 * section name=(      .comment) index=(28) not allocatable ->skipping ...
 * section name=(      .comment) index=(29) not allocatable ->skipping ...
 * section name=(      .comment) index=(30) not allocatable ->skipping ...
 * section name=(      .comment) index=(31) not allocatable ->skipping ...
 * section name=(      .comment) index=(32) not allocatable ->skipping ...
 * section name=(      .comment) index=(33) not allocatable ->skipping ...
 * section name=(      .comment) index=(34) not allocatable ->skipping ...
 * section name=(      .comment) index=(35) not allocatable ->skipping ...
[MODFLOW] done

(elfsh-0.62a) flowjack hello hook

 * loading blocks
 * .control section already loaded

 * patch blacks calling 08048364
 * patching block hello + 0
 * would patch -> 
 080483AD [foff: 0] main + 28                                call          <hello>                              
 * patched ->
 080483AD [foff: 0] main + 28                                call          <hook>                               
 * patching block hello + 0
 * would patch -> 
 0804838A [foff: 0] call_hello + 18                          call          <hello>                              
 * patched ->
 0804838A [foff: 0] call_hello + 18                          call          <hook>                               
(elfsh-0.62a) save dh_gentil


 [*] Object dh_gentil save successfully 

(elfsh-0.62a) quit


 [*] Unloading object 1 (gentil) * 
 [*] Unloading object 2 (mechant.o)   

	 Good bye ! .::. The ELF shell 0.62a 


(19:28:37) ~/tmp/test_elfsh ./gentil 
call hello
hello
call hello from elsewhere
hello
(19:28:42) ~/tmp/test_elfsh ./dh_gentil 
call hello
DTC
call hello from elsewhere
DTC
(19:28:47) ~/tmp/test_elfsh exit

Script done on Wed 20 Apr 2005 07:28:50 PM CEST
