Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


GCC compiled code embedded in the C language compiler problems

[code]int Main (int argc, char* argv[]) (
__asm__ ( "
Jmp 0x2a
Popl %esi
Movl %esi,0x8 (%esi)
Movb x0,0x7 (%esi)
Movl x0,0xc (%esi)
Movl xb, %eax
Movl %esi, %ebx
Leal 0x8 (%esi) %ecx
Leal 0xc (%esi) %edx
Int x80
Movl x1, %eax
Movl x0, %ebx
Int x80
Call -0x2f # 5 bytes
. String \ "/bin/sh\"
");
}
[/code]

Under the above code in gcc compiler, however, that mistakes are as follows :
Shellcode.c:2 : missed terminating "character
Shellcode.c:in function 'main'
Shellcode.c:3 : error : syntax error before "jmp"
Shellcode.c:17 : error : stray '\' in program
Shellcode.c:17 : missed terminating "character
Shellcode.c:18 : missed terminating "character

Experts ask you this : What are the reasons? Be resolved?

GCC compiled code embedded in the C language compiler problems

Watching very look familiar, seemed to give them the same message in response to my article.
Forum recommends careful search bar.

GCC compiled code embedded in the C language compiler problems

Asm
Not as?

GCC compiled code embedded in the C language compiler problems

Treasury should #include a compilation document, which is not sure whether under the GCC
GOOGLE under the bar

GCC compiled code embedded in the C language compiler problems

So try to write
[code]
Int main (int argc, char* argv[]) (
__asm__ ( "\n\
Jmp 0x2a \n\
Popl %esi \n\
Movl %esi,0x8 (%esi) \n\
Movb x0,0x7 (%esi) \n\
Movl x0,0xc (%esi) \n\
Movl xb, %eax \n\
Movl %esi, %ebx \n\
Leal 0x8 (%esi) %ecx \n\
Leal 0xc (%esi) %edx \n\
Int x80 \n\
Movl x1, %eax \n\
Movl x0, %ebx \n\
Int x80 \n\
Call -0x2f # 5 bytes \n\
. String \ "/bin/sh\" \n\
");
}
[/code]

GCC compiled code embedded in the C language compiler problems

Still wrong
This seems to be a compilation of instructions grammatical errors
[code]
Linux:~ # cc mm.c
/tmp/ccWP2HuC.s : Assembler messages :
/tmp/ccWP2HuC.s:21 : Error : too many memory references for `mov '
/tmp/ccWP2HuC.s:22 : Error : too many memory references for `mov '
/tmp/ccWP2HuC.s:27 : Error : suffix or operands invalid for `int '
/tmp/ccWP2HuC.s:30 : Error : suffix or operands invalid for `int '
Linux:~ #
[/code]

GCC compiled code embedded in the C language compiler problems



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com