hello all,
in case if still need it :)
here is good skeleton for shell code :-) i DO NOT want to put
REAL shell code here. just do ``x/32bx main'' and you will
see what you want. :)
i'm too lazy to write in assebmler and hate AT&T syntax :)
<-------------------------- cut here ------------------------------------->
char *cmd = "/bin/sh";
char *arg[] = { "sh", 0 };
void
main(void)
{
/* execve(cmd, argv, env) */
/* pass ``env'' == NULL */
__asm__("xorl %eax,%eax\n");
__asm__("push %eax");
/* pass ``argv[]'' */
__asm__("push $arg\n");
/* pass ``cmd'' */
__asm__("movl $cmd,%edx\n");
__asm__("movl (%edx),%eax\n");
__asm__("push %eax\n");
/* simulate ``libc call <execve>'' */
__asm__("push %ecx\n");
/* system call */
__asm__("xorl %eax,%eax\n");
__asm__("movb $0x3b,%al\n");
__asm__("int $0x80\n");
}
<------------------------- end cut ---------------------->
thanks
emax
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message