creds.utils¶
sudo_check () |
Return the string ‘sudo’ if current user isn’t root. |
check_platform |
|
execute_command ([command]) |
Execute a command and return the stdout and stderr. |
random_string ([length]) |
Generate a random string of ASCII characters. |
base64encode ([_input]) |
Return base64 encoded representation of a string. |
base64decode ([_input]) |
Take a base64 encoded string and return the decoded string. |
-
creds.utils.
base64decode
(_input=None)[source]¶ Take a base64 encoded string and return the decoded string.
-
creds.utils.
execute_command
(command=None)[source]¶ Execute a command and return the stdout and stderr.
-
creds.utils.
get_missing_commands
(_platform)[source]¶ Check I can identify the necessary commands for managing users.
-
creds.utils.
get_sudoers_entry
(username=None, sudoers_entries=None)[source]¶ Find the sudoers entry in the sudoers file for the specified user.
Parameters: - username (str) – username.
- sudoers_entries (list) – list of lines from the sudoers file.
- returns:`r
- str: sudoers entry for the specified user.
-
creds.utils.
read_sudoers
()[source]¶ Read the sudoers entry for the specified user.
Parameters: username (str) – username. - returns:`r
- str: sudoers entry for the specified user.