MCPcopy Create free account
hub / github.com/secdev/scapy / autorun_get_interactive_live_session

Function autorun_get_interactive_live_session

scapy/autorun.py:182–202  ·  view source on GitHub ↗

Create an interactive session and execute the commands passed as "cmds" and return all output :param cmds: a list of commands to run :param timeout: timeout in seconds :returns: (output, returned) contains both sys.stdout and sys.stderr logs

(cmds, **kargs)

Source from the content-addressed store, hash-verified

180
181
182def autorun_get_interactive_live_session(cmds, **kargs):
183 # type: (str, **Any) -> Tuple[str, Any]
184 """Create an interactive session and execute the
185 commands passed as "cmds" and return all output
186
187 :param cmds: a list of commands to run
188 :param timeout: timeout in seconds
189 :returns: (output, returned) contains both sys.stdout and sys.stderr logs
190 """
191 sstdout, sstderr = sys.stdout, sys.stderr
192 sw = StringWriter(debug=sstdout)
193 try:
194 try:
195 sys.stdout = sys.stderr = sw
196 res = autorun_commands_timeout(cmds, **kargs)
197 except StopAutorun as e:
198 e.code_run = sw.s
199 raise
200 finally:
201 sys.stdout, sys.stderr = sstdout, sstderr
202 return sw.s, res
203
204
205def autorun_get_text_interactive_session(cmds, **kargs):

Callers 1

Calls 2

StringWriterClass · 0.85
autorun_commands_timeoutFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…