This class provides methods to read and write to linux-style passwd/shadow files, ability to parse shadow-style lines into dicts and identifying password hashing algorithms used in linux-style hash format.
More...
This class provides methods to read and write to linux-style passwd/shadow files, ability to parse shadow-style lines into dicts and identifying password hashing algorithms used in linux-style hash format.
Definition at line 46 of file unixpassword.py.
◆ __init__()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.__init__ |
( |
|
self, |
|
|
|
line_format, |
|
|
|
separator = ":" , |
|
|
|
newline = "\n" |
|
) |
| |
Initialize parser.
- Parameters
-
line_format | List of field names, field names have to be unique and cannot be empty. Not all fields have to be in format list if dumping text. |
separator | String to use to separate fields in line |
newline | String to use as line separator |
Definition at line 56 of file unixpassword.py.
◆ add_line_from_text()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.add_line_from_text |
( |
|
self, |
|
|
|
line |
|
) |
| |
Parsed line and adds appropriate dict to internal buffer.
- Parameters
-
line | String representation of a given line |
Definition at line 137 of file unixpassword.py.
◆ add_new_line()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.add_new_line |
( |
|
self, |
|
|
|
fields |
|
) |
| |
Prepares and adds new line to internal buffer.
- Parameters
-
fields | Dict of field values to add to internal buffer as a line |
Definition at line 129 of file unixpassword.py.
◆ create_line()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.create_line |
( |
|
self, |
|
|
|
fields |
|
) |
| |
Creates string line from fieldset and line_format.
- Parameters
-
fields | Dict of field values to fill line with |
- Returns
- String representation of give line data
Definition at line 108 of file unixpassword.py.
◆ dump_text()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.dump_text |
( |
|
self | ) |
|
Prepares and returns text block representing all lines in internal buffer.
- Returns
- String block representing internal buffer. Empty string when no lines in buffer.
Definition at line 145 of file unixpassword.py.
◆ load_text()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.load_text |
( |
|
self, |
|
|
|
textblock |
|
) |
| |
Parses text block and adds its lines to internal buffer.
- Parameters
-
textblock | String to load into internal buffer |
Definition at line 157 of file unixpassword.py.
◆ parse_line()
def caellion.pycommons.stringutil.unixpassword.UnixPasswordText.parse_line |
( |
|
self, |
|
|
|
line |
|
) |
| |
Parses line according to line_format.
- Parameters
-
line | The line to be parsed |
- Returns
- The dict representation of given line
Definition at line 85 of file unixpassword.py.
◆ line_format [1/2]
list caellion.pycommons.stringutil.unixpassword.UnixPasswordText.line_format = [] |
|
static |
◆ line_format [2/2]
caellion.pycommons.stringutil.unixpassword.UnixPasswordText.line_format |
◆ newline [1/2]
string caellion.pycommons.stringutil.unixpassword.UnixPasswordText.newline = "\n" |
|
static |
◆ newline [2/2]
caellion.pycommons.stringutil.unixpassword.UnixPasswordText.newline |
◆ separator [1/2]
string caellion.pycommons.stringutil.unixpassword.UnixPasswordText.separator = ":" |
|
static |
◆ separator [2/2]
caellion.pycommons.stringutil.unixpassword.UnixPasswordText.separator |
◆ text_lines [1/2]
list caellion.pycommons.stringutil.unixpassword.UnixPasswordText.text_lines = [] |
|
static |
◆ text_lines [2/2]
caellion.pycommons.stringutil.unixpassword.UnixPasswordText.text_lines |
The documentation for this class was generated from the following file: