Samba status commands

This module provides processing for the smbstatus command using the following parsers:

SmbstatusS - command /usr/bin/smbstatus -S

Smbstatusp - command /usr/bin/smbstatus -p

class insights.parsers.smbstatus.SmbstatusS(context, extra_bad_lines=None)[source]

Bases: Statuslist

Class SmbstatusS parses the output of the smbstatus -S command.

Sample output of this command looks like:

Service      pid     Machine       Connected at                     Encryption   Signing
----------------------------------------------------------------------------------------
share_test   13668   10.66.208.149 Wed Sep 27 10:33:55 AM 2017 CST  -            -

The format of smbstatus -S is like table, and function parse_fixed_table could parse it.

Examples

>>> smbstatuss_info.data[0] == {'Signing': '-', 'Service': 'share_test', 'Encryption': '-', 'pid': '13668', 'Machine': '10.66.208.149', 'Connected_at': 'Wed Sep 27 10:33:55 AM 2017 CST'}
True
>>> smbstatuss_info.data[0]['pid']
'13668'
Raises:

ParseException -- When there is no usefull data or the input content is empty, or does contain the header line.

data

List of dicts, where the keys in each dict are the column headers and each item in the list represents a connection.

Type:

list

parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.smbstatus.Smbstatusp(context, extra_bad_lines=None)[source]

Bases: Statuslist

Class Smbstatusp parses the output of the smbstatus -p command.

Sample output of this command looks like:

Samba version 4.6.2
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing
--------------------------------------------------------------------------------------------------------------------------
12668   testsmb       testsmb       10.66.208.149 (ipv4:10.66.208.149:44376)  SMB2_02           -                    -

The format of smbstatus -p is like table, and function parse_fixed_table could parse it.

Examples

>>> smbstatusp_info.data[0] == {'Username': 'testsmb', 'Signing': '-', 'Group': 'testsmb', 'Encryption': '-', 'PID': '12668', 'Machine': '10.66.208.149 (ipv4:10.66.208.149:44376)', 'Protocol_Version': 'SMB2_02'}
True
>>> smbstatusp_info.data[0]['PID']
'12668'
Raises:

ParseException -- When there is no usefull data or the input content is empty, or does contain the header line.

data

List of dicts, where the keys in each dict are the column headers and each item in the list represents a connection.

Type:

list

parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.smbstatus.Statuslist(context, extra_bad_lines=None)[source]

Bases: CommandParser

Base class implementing shared code.

parse_content(content)[source]

This method must be implemented by classes based on this class.