scapy.autorun

Run commands when the Scapy interpreter starts.

class scapy.autorun.ScapyAutorunInterpreter(*args: Any, **kargs: Any)[source]

Bases: code.InteractiveInterpreter

write(data: str) None[source]
exception scapy.autorun.StopAutorun[source]

Bases: scapy.error.Scapy_Exception

code_run = ''
exception scapy.autorun.StopAutorunTimeout[source]

Bases: scapy.autorun.StopAutorun

class scapy.autorun.StringWriter(debug: Optional[TextIO] = None)[source]

Bases: _io.StringIO

Util to mock sys.stdout and sys.stderr, and store their output in a ‘s’ var.

flush() None[source]
write(x: str) int[source]
scapy.autorun.autorun_commands(_cmds: str, my_globals: Optional[Dict[str, Any]] = None, verb: Optional[int] = None) Any[source]
scapy.autorun.autorun_commands_timeout(cmds: str, timeout: Optional[int] = None, **kwargs: Any) Any[source]

Wraps autorun_commands with a timeout that raises StopAutorunTimeout on expiration.

scapy.autorun.autorun_get_ansi_interactive_session(cmds: str, **kargs: Any) Tuple[str, Any][source]
scapy.autorun.autorun_get_html_interactive_session(cmds: str, **kargs: Any) Tuple[str, Any][source]
scapy.autorun.autorun_get_interactive_live_session(cmds: str, **kargs: Any) Tuple[str, Any][source]

Create an interactive session and execute the commands passed as “cmds” and return all output

Parameters
  • cmds – a list of commands to run

  • timeout – timeout in seconds

Returns

(output, returned) contains both sys.stdout and sys.stderr logs

scapy.autorun.autorun_get_interactive_session(cmds: str, **kargs: Any) Tuple[str, Any][source]

Create an interactive session and execute the commands passed as “cmds” and return all output

Parameters
  • cmds – a list of commands to run

  • timeout – timeout in seconds

Returns

(output, returned) contains both sys.stdout and sys.stderr logs

scapy.autorun.autorun_get_latex_interactive_session(cmds: str, **kargs: Any) Tuple[str, Any][source]
scapy.autorun.autorun_get_live_interactive_session(cmds: str, **kargs: Any) Tuple[str, Any][source]
scapy.autorun.autorun_get_text_interactive_session(cmds: str, **kargs: Any) Tuple[str, Any][source]