Date: Thu, 2 Mar 2000 12:34:36 -0500 From: "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com> To: "'Michael Kyle'" <mfk@yahoo-inc.com>, freebsd-hackers@FreeBSD.ORG Subject: RE: Shell Code... (fwd) Message-ID: <E598F159668DD311B9C700902799EAF44733A3@njb140po01.ems.att.com>
next in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E598F159668DD311B9C700902799EAF44733A3>