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
bc40e727
Commit
bc40e727
authored
Jan 27, 2017
by
Luke Macken
Committed by
GitHub
Jan 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #61 from TheJakeSchmidt/develop
Add the ability to control the IPC timeout.
parents
8c5545aa
d1c076f8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
pyrasite/ipc.py
pyrasite/ipc.py
+3
-2
pyrasite/main.py
pyrasite/main.py
+6
-1
pyrasite/tools/shell.py
pyrasite/tools/shell.py
+3
-1
No files found.
pyrasite/ipc.py
View file @
bc40e727
...
...
@@ -64,7 +64,7 @@ class PyrasiteIPC(object):
# shell payloads with netcat.
reliable
=
True
def
__init__
(
self
,
pid
,
reverse
=
'ReversePythonConnection'
):
def
__init__
(
self
,
pid
,
reverse
=
'ReversePythonConnection'
,
timeout
=
5
):
super
(
PyrasiteIPC
,
self
).
__init__
()
self
.
pid
=
pid
self
.
sock
=
None
...
...
@@ -72,6 +72,7 @@ class PyrasiteIPC(object):
self
.
hostname
=
None
self
.
port
=
None
self
.
reverse
=
reverse
self
.
timeout
=
float
(
timeout
)
def
__enter__
(
self
):
self
.
connect
()
...
...
@@ -165,7 +166,7 @@ class PyrasiteIPC(object):
"""Wait for the injected payload to connect back to us"""
(
clientsocket
,
address
)
=
self
.
server_sock
.
accept
()
self
.
sock
=
clientsocket
self
.
sock
.
settimeout
(
5
)
self
.
sock
.
settimeout
(
self
.
timeout
)
self
.
address
=
address
def
cmd
(
self
,
cmd
):
...
...
pyrasite/main.py
View file @
bc40e727
...
...
@@ -92,6 +92,10 @@ def main():
help
=
"Set where output is to be printed. 'procstreams'"
" prints output in stdout/stderr of running process"
" and 'localterm' prints output in local terminal."
)
parser
.
add_argument
(
'--ipc-timeout'
,
dest
=
'ipc_timeout'
,
default
=
5
,
action
=
'store'
,
type
=
int
,
help
=
"The number of seconds to wait for the injected"
" code to reply over IPC before giving up."
)
if
len
(
sys
.
argv
)
==
1
:
parser
.
print_help
()
...
...
@@ -129,7 +133,8 @@ def main():
if
args
.
output_type
==
'localterm'
:
# Create new IPC connection to the process.
ipc
=
pyrasite
.
PyrasiteIPC
(
pid
,
'ReversePythonConnection'
)
ipc
=
pyrasite
.
PyrasiteIPC
(
pid
,
'ReversePythonConnection'
,
timeout
=
ipc_timeout
)
ipc
.
connect
()
print
(
"Pyrasite Shell %s"
%
pyrasite
.
__version__
)
print
(
"Connected to '%s'"
%
ipc
.
title
)
...
...
pyrasite/tools/shell.py
View file @
bc40e727
...
...
@@ -15,6 +15,7 @@
#
# Copyright (C) 2011-2013 Red Hat, Inc., Luke Macken <lmacken@redhat.com>
import
os
import
sys
import
pyrasite
...
...
@@ -32,7 +33,8 @@ def shell():
print
(
usage
)
sys
.
exit
(
1
)
ipc
=
pyrasite
.
PyrasiteIPC
(
pid
,
'ReversePythonShell'
)
ipc
=
pyrasite
.
PyrasiteIPC
(
pid
,
'ReversePythonShell'
,
timeout
=
os
.
getenv
(
'PYRASITE_IPC_TIMEOUT'
)
or
5
)
ipc
.
connect
()
print
(
"Pyrasite Shell %s"
%
pyrasite
.
__version__
)
...
...
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