Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyrasite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
pyrasite
Commits
779c6bc6
Commit
779c6bc6
authored
Mar 12, 2012
by
Luke Macken
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://github.com/lmacken/pyrasite
parents
bb4ec164
150f8c7b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
12 deletions
+36
-12
README.rst
README.rst
+1
-1
docs/Payloads.rst
docs/Payloads.rst
+2
-2
pyrasite/ipc.py
pyrasite/ipc.py
+17
-5
pyrasite/payloads/reverse_shell.py
pyrasite/payloads/reverse_shell.py
+0
-1
pyrasite/reverse.py
pyrasite/reverse.py
+16
-3
No files found.
README.rst
View file @
779c6bc6
...
...
@@ -147,7 +147,7 @@ Since version 10.10, Ubuntu ships with a `controversial patch <https://lkml.org/
::
echo 0
>
/proc/sys/kernel/yama/ptrace_scope
echo 0
| sudo tee
/proc/sys/kernel/yama/ptrace_scope
...
...
docs/Payloads.rst
View file @
779c6bc6
...
...
@@ -18,7 +18,7 @@ This lets you easily introspect or alter any objects in your running process.
::
$ pyrasite <PID> pyrasite/payloads/reverse_python_shell.py
$ nc -l
localhost
9001
$ nc -l 9001
Python 2.7.1 (r271:86832, Apr 12 2011, 16:15:16)
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)]
Type 'quit' to exit.
...
...
@@ -62,7 +62,7 @@ Reverse Shell
::
$ pyrasite <PID> pyrasite/payloads/reverse_shell.py
$ nc -l
localhost
9001
$ nc -l 9001
Linux tomservo 2.6.40.3-0.fc15.x86_64 #1 SMP Tue Aug 16 04:10:59 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
Type 'quit' to exit.
% ls
...
...
pyrasite/ipc.py
View file @
779c6bc6
...
...
@@ -74,11 +74,23 @@ class PyrasiteIPC(object):
def
listen
(
self
):
"""Listen on a random port"""
self
.
server_sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
server_sock
.
settimeout
(
5
)
self
.
server_sock
.
bind
((
'localhost'
,
0
))
self
.
server_sock
.
listen
(
1
)
self
.
port
=
self
.
server_sock
.
getsockname
()[
1
]
for
res
in
socket
.
getaddrinfo
(
'localhost'
,
None
,
socket
.
AF_UNSPEC
,
socket
.
SOCK_STREAM
,
0
,
0
):
af
,
socktype
,
proto
,
canonname
,
sa
=
res
try
:
self
.
server_sock
=
socket
.
socket
(
af
,
socktype
,
proto
)
except
socket
.
error
,
msg
:
self
.
server_sock
=
None
continue
try
:
self
.
server_sock
.
bind
(
sa
)
self
.
server_sock
.
listen
(
1
)
except
socket
.
error
,
msg
:
self
.
server_sock
.
close
()
self
.
server_sock
=
None
continue
break
self
.
hostname
,
self
.
port
=
self
.
server_sock
.
getsockname
()[
0
:
2
]
self
.
running
=
True
def
create_payload
(
self
):
...
...
pyrasite/payloads/reverse_shell.py
View file @
779c6bc6
...
...
@@ -20,7 +20,6 @@ import pyrasite
class
ReverseShell
(
pyrasite
.
ReverseConnection
):
reliable
=
False
# This payload is designed to be used with netcat
host
=
'127.0.0.1'
port
=
9001
def
on_connect
(
self
):
...
...
pyrasite/reverse.py
View file @
779c6bc6
...
...
@@ -29,7 +29,7 @@ from pyrasite.ipc import PyrasiteIPC
class
ReverseConnection
(
threading
.
Thread
,
PyrasiteIPC
):
"""A payload that connects to a given host:port and receives commands"""
host
=
'
127.0.0.1
'
host
=
'
localhost
'
port
=
9001
def
__init__
(
self
,
host
=
None
,
port
=
None
):
...
...
@@ -50,8 +50,21 @@ class ReverseConnection(threading.Thread, PyrasiteIPC):
running
=
True
while
running
:
try
:
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
connect
((
self
.
host
,
self
.
port
))
for
res
in
socket
.
getaddrinfo
(
self
.
host
,
self
.
port
,
socket
.
AF_UNSPEC
,
socket
.
SOCK_STREAM
):
af
,
socktype
,
proto
,
canonname
,
sa
=
res
try
:
self
.
sock
=
socket
.
socket
(
af
,
socktype
,
proto
)
except
socket
.
error
,
msg
:
self
.
sock
=
None
continue
try
:
self
.
sock
.
connect
(
sa
)
except
socket
.
error
,
msg
:
self
.
sock
.
close
()
self
.
sock
=
None
continue
break
self
.
on_connect
()
while
running
:
cmd
=
self
.
recv
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment