Skip to content

Commit f02ad49

Browse files
committed
[IDEV-282] bugbash: Clean the ssl hash value if the special char (':') is present.
1 parent e5ef544 commit f02ad49

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

domaintools/cli/commands/iris.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
from domaintools.cli.main import dt_cli
55
from domaintools.cli.api import DTCLICommand
6-
from domaintools.cli.utils import get_cli_helptext_by_name
6+
from domaintools.cli.utils import (
7+
get_cli_helptext_by_name,
8+
remove_special_char_in_string,
9+
)
710
from domaintools.cli import constants as c
811

912

@@ -68,6 +71,12 @@ def iris_investigate(
6871

6972
extra_args = ctx.args.copy()
7073
kwargs = DTCLICommand.args_to_dict(*extra_args)
74+
if "ssl_hash" in kwargs:
75+
# silently remove the ':' if present.
76+
ssl_hash_value = kwargs["ssl_hash"]
77+
kwargs["ssl_hash"] = remove_special_char_in_string(
78+
ssl_hash_value, special_char=":"
79+
)
7180

7281
DTCLICommand.run(name=c.IRIS_INVESTIGATE, params=ctx.params, **kwargs)
7382

domaintools/cli/utils.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,21 @@ def get_file_extension(source: str) -> str:
9393
return ext
9494

9595

96-
__all__ = ["get_cli_helptext_by_name", "get_file_extension"]
96+
def remove_special_char_in_string(item: str, special_char: str) -> str:
97+
"""Removes the given `special char` in an string item.
98+
99+
Args:
100+
item (str): The string to be formatted
101+
102+
Returns:
103+
str: The formatted string.
104+
"""
105+
cleaned_string = item.replace(special_char, "")
106+
return cleaned_string
107+
108+
109+
__all__ = [
110+
"get_cli_helptext_by_name",
111+
"get_file_extension",
112+
"remove_special_char_in_string",
113+
]

0 commit comments

Comments
 (0)