utils.unix.running module
Parsing and handling process and other run-time information
- class utils.unix.running.NetstatSection(*values)
Bases:
EnumTypes of ports we might find
- NETWORK = 'net'
- UNIX = 'unix'
- class utils.unix.running.PsMode(*values)
Bases:
EnumProcess list modes
- AUTO = 'auto'
- FLAGS_NONE = 'blank'
- FLAGS_f = 'f'
- FLAGS_l = 'l'
- FLAGS_lf = 'lf'
- utils.unix.running.simplify_ifconfig(ifconf_output: str) str
Given an ifconfig output, redacts all the IP addresses and MACs
Replaces them with “X.X.X.X” if they exist
- utils.unix.running.simplify_netstat(text: str, section: NetstatSection = NetstatSection.NETWORK, listen_only: bool = False) str
Given the output of a
netstatcall, returns a table of just the key dataKey data for:
Network connections: Proto, Port, and State
Unix sockets: Proto, Flags, Type, State, Path
- utils.unix.running.simplify_ps(text: str, show_uid: bool = True, mode: PsMode = PsMode.AUTO) str
Given the output of a
pscall, returns just non-volatile informationThis typically means just the executable name and UID if available.
Works with most
psoutputs includingps -A,ps -Al,ps -Af, etc.