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
762525a1
Commit
762525a1
authored
Feb 11, 2012
by
Luke Macken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the new pyrasite.utils.run everywhere
parent
eab58d17
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
pyrasite/inspect.py
pyrasite/inspect.py
+1
-1
pyrasite/tools/gui.py
pyrasite/tools/gui.py
+6
-2
tests/test_code_injection.py
tests/test_code_injection.py
+4
-4
No files found.
pyrasite/inspect.py
View file @
762525a1
...
...
@@ -28,6 +28,6 @@ class ObjectInspector(object):
'gdb --quiet -p %s -batch'
%
self
.
pid
,
'-eval-command="print (PyObject *)%s"'
%
address
,
])
for
line
in
run
(
cmd
).
split
(
'
\
n
'
):
for
line
in
run
(
cmd
)
[
1
]
.
split
(
'
\
n
'
):
if
line
.
startswith
(
'$1 = '
):
return
line
[
5
:]
pyrasite/tools/gui.py
View file @
762525a1
...
...
@@ -27,14 +27,18 @@ from meliae import loader
from
gi.repository
import
GLib
,
GObject
,
Pango
,
GdkPixbuf
,
Gtk
import
pyrasite
from
pyrasite.utils
import
run
,
PyrasiteIPC
from
pyrasite.utils
import
run
,
setup_logger
from
pyrasite.ipc
import
PyrasiteIPC
log
=
logging
.
getLogger
(
'pyrasite'
)
class
Process
(
GObject
.
GObject
):
def
__init__
(
self
,
pid
):
super
(
Process
,
self
).
__init__
()
self
.
pid
=
pid
self
.
title
=
run
(
'ps --no-heading -o cmd= -p %d'
%
pid
)
self
.
title
=
run
(
'ps --no-heading -o cmd= -p %d'
%
pid
)
[
1
]
self
.
command
=
self
.
title
self
.
title
=
self
.
title
[:
25
]
self
.
ipc
=
None
...
...
tests/test_code_injection.py
View file @
762525a1
...
...
@@ -15,15 +15,16 @@
#
# Copyright (C) 2011 Red Hat, Inc.
import
unittest
,
subprocess
import
unittest
from
pyrasite.inject
import
CodeInjector
from
pyrasite.utils
import
run
class
TestCodeInjection
(
unittest
.
TestCase
):
def
test_injection
(
self
):
cmd
=
'python -c "import time; time.sleep(0.5)"'
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
p
=
run
(
cmd
,
communicate
=
False
)[
0
]
ci
=
CodeInjector
(
p
.
pid
,
verbose
=
True
)
ci
.
inject
(
'payloads/helloworld.py'
)
...
...
@@ -37,8 +38,7 @@ class TestCodeInjection(unittest.TestCase):
'snooze = lambda: time.sleep(0.5)'
,
'threading.Thread(target=snooze).start()'
,
]
p
=
subprocess
.
Popen
(
'python -c "%s"'
%
';'
.
join
(
cmd
),
shell
=
True
,
stdout
=
subprocess
.
PIPE
)
p
=
run
(
'python -c "%s"'
%
';'
.
join
(
cmd
),
communicate
=
False
)[
0
]
ci
=
CodeInjector
(
p
.
pid
,
verbose
=
True
)
ci
.
inject
(
'payloads/helloworld.py'
)
...
...
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