Re: Strange instructions in compiler output

2004-03-07 Thread Anthony Schneider
On Sat, Mar 06, 2004 at 09:31:51PM +0100, Dag-Erling Smørgrav wrote: Anthony Schneider [EMAIL PROTECTED] writes: On Sat, Mar 06, 2004 at 02:26:51PM +, chungwei Hsiung wrote: gcc -o shellcode -ggdb -static shellcode.c try compiling with the -static flag the gcc. Reading is fast

Re: Strange instructions in compiler output

2004-03-06 Thread Chungwei Hsiung
Greg 'groggy' Lehey wrote: On Friday, 5 March 2004 at 13:43:04 -0500, Chungwei Hsiung wrote: Hello.. I am super new to this list, and I have a simple question that I don't know why it does that. I have a simple test program. I compile it, and gdb to disassemble main. I got the following..

Re: Strange instructions in compiler output

2004-03-06 Thread Chungwei Hsiung
Greg 'groggy' Lehey wrote: On Friday, 5 March 2004 at 18:43:11 -0500, Chungwei Hsiung wrote: Greg 'groggy' Lehey wrote: On Friday, 5 March 2004 at 13:43:04 -0500, Chungwei Hsiung wrote: Hello.. I am super new to this list, and I have a simple question that I don't know why it

Re: Strange instructions in compiler output (was: A simple question)

2004-03-06 Thread chungwei Hsiung
Hello everyone Thanks for fellows' previous helps. I actually have a further question. I read an article that it says if I compile the following program #include stdio.h int main(){ char *name[2]; name[0] = /bin/sh; name[1] = NULL; execve(name[0],name,NULL); return 0; } by gcc -o

Re: Strange instructions in compiler output (was: A simple question)

2004-03-06 Thread Anthony Schneider
try compiling with the -static flag the gcc. then 'disassemble execve'. -Anthony. On Sat, Mar 06, 2004 at 02:26:51PM +, chungwei Hsiung wrote: Hello everyone Thanks for fellows' previous helps. I actually have a further question. I read an article that it says if I compile the

Re: Strange instructions in compiler output

2004-03-06 Thread Dag-Erling Smørgrav
Anthony Schneider [EMAIL PROTECTED] writes: On Sat, Mar 06, 2004 at 02:26:51PM +, chungwei Hsiung wrote: gcc -o shellcode -ggdb -static shellcode.c try compiling with the -static flag the gcc. Reading is fast becoming a lost art... Anyway, here's the code for execve(): 08048224

Re: Strange instructions in compiler output

2004-03-06 Thread chungwei Hsiung
thanks for the reply compile the code by gcc -o shellcode -ggdb -static shellcode.c actually giving me the code you showed below I still don't understand it because we are supposed to pass in the op code 0xb to %eax, and arguments to %ebx, %ecx, and %edx before calling interupt, but I can't

Re: Strange instructions in compiler output

2004-03-06 Thread Dag-Erling Smørgrav
chungwei Hsiung [EMAIL PROTECTED] writes: I still don't understand it because we are supposed to pass in the op code 0xb to %eax, and arguments to %ebx, %ecx, and %edx before calling interupt, but I can't see any of those instruction anywhere. Did I miss anything? Huh? Arguments are passed

Re: Strange instructions in compiler output

2004-03-06 Thread chungwei Hsiung
OH yes... this is FreeBSD not linux, I will try it on the linux box later thank you for the clarification, but how does FreeBSD know where the passed arguments are?? just out of curiosity.. thanks again Chungwei On Sat, 06 Mar 2004 21:47:10 +0100 [EMAIL PROTECTED] (Dag-Erling Smørgrav)

Re: Strange instructions in compiler output

2004-03-06 Thread Dag-Erling Smørgrav
chungwei Hsiung [EMAIL PROTECTED] writes: thank you for the clarification, but how does FreeBSD know where the passed arguments are?? just out of curiosity.. They are on the stack, just like in a regular function call. DES -- Dag-Erling Smørgrav - [EMAIL PROTECTED]

Strange instructions in compiler output (was: A simple question)

2004-03-05 Thread Greg 'groggy' Lehey
On Friday, 5 March 2004 at 13:43:04 -0500, Chungwei Hsiung wrote: Hello.. I am super new to this list, and I have a simple question that I don't know why it does that. I have a simple test program. I compile it, and gdb to disassemble main. I got the following.. 0x80481f8 main: push

Re: Strange instructions in compiler output

2004-03-05 Thread Greg 'groggy' Lehey
On Friday, 5 March 2004 at 18:43:11 -0500, Chungwei Hsiung wrote: Greg 'groggy' Lehey wrote: On Friday, 5 March 2004 at 13:43:04 -0500, Chungwei Hsiung wrote: Hello.. I am super new to this list, and I have a simple question that I don't know why it does that. I have a simple test