Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

helpers.py: Add optional additional safe characters.

smicallef0d9be8e554f7
diff --git a/spiderfoot/helpers.py b/spiderfoot/helpers.py
index cfe26ae4..72f1f666 100644
--- a/spiderfoot/helpers.py
+++ b/spiderfoot/helpers.py
@@ -404,11 +404,12 @@ class SpiderFootHelpers():
return returnArr
@staticmethod
- def sanitiseInput(cmd: str) -> bool:
+ def sanitiseInput(cmd: str, extra: list = []) -> bool:
"""Verify input command is safe to execute
Args:
cmd (str): The command to check
+ extra (list): Additional characters to consider safe
Returns:
bool: command is "safe"
@@ -416,6 +417,10 @@ class SpiderFootHelpers():
chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '.']
+
+ if extra:
+ chars.extend(extra)
+
for c in cmd:
if c.lower() not in chars:
return False