msticpy.common.utility.format module
Formatting and checking functions.
- msticpy.common.utility.format.defang_ioc(ioc, ioc_type=None)
Return de-fanged observable.
- Parameters:
ioc (str) – The observable.
ioc_type (str) – The type of IoC. If URL or Email it will do extra processing to neuter the URL protocol and email @ symbol
- Returns:
The de-fanged observable.
- Return type:
str
- msticpy.common.utility.format.escape_windows_path(str_path)
Escape backslash characters in a string.
- Parameters:
str_path (str)
- Return type:
str
- msticpy.common.utility.format.is_not_empty(test_object)
Return True if the test_object is not None or empty.
- Parameters:
test_object (Any)
- Return type:
bool
- msticpy.common.utility.format.is_valid_uuid(uuid_str)
Return true if uuid_str is a value GUID/UUID.
- Parameters:
uuid_str (str) – String to test
- Returns:
True if valid GUID/UUID.
- Return type:
bool
- msticpy.common.utility.format.refang_ioc(ioc, ioc_type=None)
Return observable with removed de-fanging elements.
- Parameters:
ioc (str) – The observable to re-fang.
ioc_type (str) – The type of IoC. If URL or Email it will do extra processing to restore protocol and @ symbol
- Returns:
The re-fanged observable.
- Return type:
str
- msticpy.common.utility.format.string_empty(string)
Return True if the input string is None or whitespace.
- Parameters:
string (str)
- Return type:
bool
- msticpy.common.utility.format.unescape_windows_path(str_path)
Remove escaping from backslash characters in a string.
- Parameters:
str_path (str)
- Return type:
str
- msticpy.common.utility.format.valid_pyname(identifier)
Return legal Python identifier, which doesn’t collide with builtins.
- Parameters:
identifier (str) – The input identifier
- Returns:
The cleaned identifier
- Return type:
str