MCPcopy
hub / github.com/Gallopsled/pwntools / process

Method process

pwnlib/tubes/ssh.py:787–1028  ·  view source on GitHub ↗

r""" Executes a process on the remote server, in the same fashion as pwnlib.tubes.process.process. To achieve this, a Python script is created to call ``os.execve`` with the appropriate arguments. As an added bonus, the ``ssh_channel`` object returned has a

(self, argv=None, executable=None, tty=True, cwd=None, env=None, ignore_environ=None, timeout=Timeout.default, run=True,
                stdin=0, stdout=1, stderr=2, preexec_fn=None, preexec_args=(), raw=True, aslr=None, setuid=None,
                shell=False)

Source from the content-addressed store, hash-verified

785 return self.run(shell, tty, timeout = timeout)
786
787 def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, ignore_environ=None, timeout=Timeout.default, run=True,
788 stdin=0, stdout=1, stderr=2, preexec_fn=None, preexec_args=(), raw=True, aslr=None, setuid=None,
789 shell=False):
790 r"""
791 Executes a process on the remote server, in the same fashion
792 as pwnlib.tubes.process.process.
793
794 To achieve this, a Python script is created to call ``os.execve``
795 with the appropriate arguments.
796
797 As an added bonus, the ``ssh_channel`` object returned has a
798 ``pid`` property for the process pid.
799
800 Arguments:
801 argv(list):
802 List of arguments to pass into the process
803 executable(str):
804 Path to the executable to run.
805 If :const:`None`, ``argv[0]`` is used.
806 tty(bool):
807 Request a `tty` from the server. This usually fixes buffering problems
808 by causing `libc` to write data immediately rather than buffering it.
809 However, this disables interpretation of control codes (e.g. Ctrl+C)
810 and breaks `.shutdown`.
811 cwd(str):
812 Working directory. If :const:`None`, uses the working directory specified
813 on :attr:`cwd` or set via :meth:`set_working_directory`.
814 env(dict):
815 Environment variables to add to the environment.
816 ignore_environ(bool):
817 Ignore default environment. By default use default environment iff env not specified.
818 timeout(int):
819 Timeout to set on the `tube` created to interact with the process.
820 run(bool):
821 Set to :const:`True` to run the program (default).
822 If :const:`False`, returns the path to an executable Python script on the
823 remote server which, when executed, will do it.
824 stdin(int, str):
825 If an integer, replace stdin with the numbered file descriptor.
826 If a string, a open a file with the specified path and replace
827 stdin with its file descriptor. May also be one of ``sys.stdin``,
828 ``sys.stdout``, ``sys.stderr``. If :const:`None`, the file descriptor is closed.
829 stdout(int, str):
830 See ``stdin``.
831 stderr(int, str):
832 See ``stdin``.
833 preexec_fn(callable):
834 Function which is executed on the remote side before execve().
835 This **MUST** be a self-contained function -- it must perform
836 all of its own imports, and cannot refer to variables outside
837 its scope.
838 preexec_args(object):
839 Argument passed to ``preexec_fn``.
840 This **MUST** only consist of native Python objects.
841 raw(bool):
842 If :const:`True`, disable TTY control code interpretation.
843 aslr(bool):
844 See :class:`pwnlib.tubes.process.process` for more information.

Callers 5

__init__Method · 0.95
getenvMethod · 0.95
aslr_ulimitMethod · 0.95
getenvMethod · 0.45

Calls 15

upload_dataMethod · 0.95
sh_stringFunction · 0.90
ssh_processClass · 0.85
mktempMethod · 0.80
chmodMethod · 0.80
infoMethod · 0.80
isEnabledForMethod · 0.80
progressMethod · 0.80
recvline_containsMethod · 0.80
recvlineMethod · 0.80
warn_onceMethod · 0.80
recvrepeatMethod · 0.80

Tested by

no test coverage detected