linux bsd


         

, - 2


unsigned char prolog_1[]={0x55h,0x89,0xE5,0x83,0xEC};

unsigned char prolog_2[]={0x55,0x89,0xE5,0x57,0x56};

//

unsigned char buf_code[1024];

//

p = msym(base, fnc_name);

// prolog_1

// call prepare_prolog_1

if (!memcmp(p,prolog_1,sizeof(prolog_1))

call_r(base, fnc_name, "gets", 0);

// prolog_2

// call prepare_prolog_2

if (!memcmp(p,prolog_1,sizeof(prolog_2))

call_r(base,fnc_name,"gets", offset prapare_prolog_2-offset prepare_prolog_1);

 10  -,

; // "" EAX,

; //

; // ! EAX

fastcall-,

; // , ,

; //

prepare_prolog_1:

MOV EAX, 0x1

JMP short do_begin

prepare_prolog_2:

MOV EAX, 0x2

JMP short do_begin

prepare_prolog_n:

MOV EAX, 0x2

JMP do_begin

do_begin:

//

//

// [ESP+4]+5

//

//

// ""

DEC EAX

JZ prolog_1

DEC EAX

JZ prolog_2

prolog_1: ; // PUSH EBP/MOV EBP,ESP/SUB ESP,XXX