base/utils/exec.bro

Exec

A module for executing external command line programs.

Namespace:Exec
Imports:base/frameworks/input
Source File:/scripts/base/utils/exec.bro

Summary

Options

Exec::tmp_dir: string &redef The system directory for temporary files.

Functions

Exec::run: function Function for running command line programs and getting output.

Detailed Interface

Options

Exec::tmp_dir
Type:string
Attributes:&redef
Default:"/tmp"

The system directory for temporary files.

Types

Exec::Command
Type:

record

cmd: string

The command line to execute. Use care to avoid injection attacks (i.e., if the command uses untrusted/variable data, sanitize it with str_shell_escape).

stdin: string &default = "" &optional

Provide standard input to the program as a string.

read_files: set [string] &optional

If additional files are required to be read in as part of the output of the command they can be defined here.

uid: string &default = M5KL1w1IPB3 &optional

The unique id for tracking executors.

Exec::Result
Type:

record

exit_code: count &default = 0 &optional

Exit code from the program.

signal_exit: bool &default = F &optional

True if the command was terminated with a signal.

stdout: vector of string &optional

Each line of standard output.

stderr: vector of string &optional

Each line of standard error.

files: table [string] of string_vec &optional

If additional files were requested to be read in the content of the files will be available here.

Functions

Exec::run
Type:function (cmd: Exec::Command) : Exec::Result

Function for running command line programs and getting output. This is an asynchronous function which is meant to be run with the when statement.

Cmd:The command to run. Use care to avoid injection attacks!
Returns:A record representing the full results from the external program execution.

Copyright 2016, The Bro Project. Last updated on December 07, 2018. Created using Sphinx 1.8.2.