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

Method __init__

pwnlib/tubes/process.py:230–415  ·  view source on GitHub ↗
(self, argv = None,
                 shell = False,
                 executable = None,
                 cwd = None,
                 env = None,
                 ignore_environ = None,
                 stdin  = PIPE,
                 stdout = PTY if not IS_WINDOWS else PIPE,
                 stderr = STDOUT,
                 close_fds = True,
                 preexec_fn = lambda: None,
                 raw = True,
                 aslr = None,
                 setuid = None,
                 where = 'local',
                 display = None,
                 alarm = None,
                 creationflags = 0,
                 *args,
                 **kwargs
                 )

Source from the content-addressed store, hash-verified

228 proc = None
229
230 def __init__(self, argv = None,
231 shell = False,
232 executable = None,
233 cwd = None,
234 env = None,
235 ignore_environ = None,
236 stdin = PIPE,
237 stdout = PTY if not IS_WINDOWS else PIPE,
238 stderr = STDOUT,
239 close_fds = True,
240 preexec_fn = lambda: None,
241 raw = True,
242 aslr = None,
243 setuid = None,
244 where = 'local',
245 display = None,
246 alarm = None,
247 creationflags = 0,
248 *args,
249 **kwargs
250 ):
251 super(process, self).__init__(*args,**kwargs)
252
253 # Permit using context.binary
254 if argv is None:
255 if context.binary:
256 argv = [context.binary.path]
257 else:
258 raise TypeError('Must provide argv or set context.binary')
259
260 if IS_WINDOWS and PTY in (stdin, stdout, stderr):
261 raise NotImplementedError("ConPTY isn't implemented yet")
262
263 #: :class:`subprocess.Popen` object that backs this process
264 self.proc = None
265
266 # We need to keep a copy of the un-_validated environment for printing
267 original_env = env
268
269 if shell:
270 executable_val, argv_val, env_val = executable, argv, env
271 if executable is None:
272 if IS_WINDOWS:
273 executable_val = os.environ.get('ComSpec', 'cmd.exe')
274 else:
275 executable_val = '/bin/sh'
276 else:
277 executable_val, argv_val, env_val = self._validate(cwd, executable, argv, env)
278
279 # Avoid the need to have to deal with the STDOUT magic value.
280 if stderr is STDOUT:
281 stderr = stdout
282
283 if IS_WINDOWS:
284 self.pty = None
285 self.raw = False
286 self.aslr = True
287 self._setuid = False

Callers

nothing calls this directly

Calls 14

_validateMethod · 0.95
_handlesMethod · 0.95
__on_enoexecMethod · 0.95
indexMethod · 0.80
isEnabledForMethod · 0.80
progressMethod · 0.80
warn_onceMethod · 0.80
appendMethod · 0.80
getMethod · 0.45
updateMethod · 0.45
successMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected