Utils Module
utils.utils
TcEx Utilities Module
- class tcex.utils.utils.Utils[source]
Bases:
AesOperations
,DatetimeOperations
,StringOperations
,Variables
TcEx Utilities Class
- static find_line_in_code(needle: str, code: str, trigger_start: Optional[Pattern[AnyStr]] = None, trigger_stop: Optional[Pattern[AnyStr]] = None) str [source]
Return matching line of code in a class definition.
- Parameters:
needle – The string to search for.
code – The contents of the Python file to search.
trigger_start – The regex pattern to use to trigger the search.
trigger_stop – The regex pattern to use to stop the search.
- static flatten_list(lst: List[Any]) List[Any] [source]
Flatten a list
Will work for lists of lists to arbitrary depth and for lists with a mix of lists and single values
- static is_cidr(possible_cidr_range: str) bool [source]
Return True if the provided value is a valid CIDR block.
- Parameters:
possible_cidr_range – The cidr value to validate.
- static is_ip(possible_ip: str) bool [source]
Return True if the provided value is a valid IP address.
- Parameters:
possible_ip – The IP value to validate.
- static printable_cred(cred: str, visible: Optional[int] = 1, mask_char: Optional[str] = '*', mask_char_count: Optional[int] = 4) str [source]
Return a printable (masked) version of the provided credential.
- Parameters:
cred – The cred to print.
visible – The number of characters at the beginning and ending of the cred to not mask.
mask_char – The character to use in the mask.
mask_char_count – How many mask character to insert (obscure cred length).