-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathshellcode-dup2-linux-ia32.S
More file actions
45 lines (39 loc) · 968 Bytes
/
shellcode-dup2-linux-ia32.S
File metadata and controls
45 lines (39 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#if defined(__linux__) && defined(__i386)
/** injcode/shellcode-dup2-linux-ia32.S
*
* Copyright(c) Thomas Habets 2009
*/
#include "asm-constants.h"
.globl shellcodeDup2
shellcodeDup2:
# open()
movl $SYS_open, %eax
leal 12(%ebp), %ebx
movl 4(%ebp), %ecx
movl 8(%ebp), %edx
int $0x80
cmpl $0, %eax
jl .Lerrout_open
movl %eax, %ebx
# dup2()
movl $SYS_dup2, %eax
movl (%ebp), %ecx
int $0x80
cmpl $0, %eax
jl .Lerrout_dup2
# close()
movl $SYS_close, %eax
int $0x80
cmpl $0, %eax
jl .Lerrout_close
# all done
xorl %eax, %eax
jmp shellcodeDup2End
.Lerrout_close:
.Lerrout_dup2:
movl $SYS_close, %eax
int $0x80
.Lerrout_open:
.globl shellcodeDup2End
shellcodeDup2End: nop
#endif