mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-06-22 10:18:09 +02:00
Merge pull request #15609 from Security-Onion-Solutions/moresoup
Moresoup
This commit is contained in:
@@ -462,19 +462,14 @@ function add_sensor_to_minion() {
|
|||||||
echo " lb_procs: '$CORECOUNT'"
|
echo " lb_procs: '$CORECOUNT'"
|
||||||
echo "suricata:"
|
echo "suricata:"
|
||||||
echo " enabled: True "
|
echo " enabled: True "
|
||||||
if [[ $is_pcaplimit ]]; then
|
|
||||||
echo " pcap:"
|
echo " pcap:"
|
||||||
|
echo " enabled: True"
|
||||||
|
if [[ $is_pcaplimit ]]; then
|
||||||
echo " maxsize: $MAX_PCAP_SPACE"
|
echo " maxsize: $MAX_PCAP_SPACE"
|
||||||
fi
|
fi
|
||||||
echo " config:"
|
echo " config:"
|
||||||
echo " af-packet:"
|
echo " af-packet:"
|
||||||
echo " threads: '$CORECOUNT'"
|
echo " threads: '$CORECOUNT'"
|
||||||
echo "pcap:"
|
|
||||||
echo " enabled: True"
|
|
||||||
if [[ $is_pcaplimit ]]; then
|
|
||||||
echo " config:"
|
|
||||||
echo " diskfreepercentage: $DFREEPERCENT"
|
|
||||||
fi
|
|
||||||
echo " "
|
echo " "
|
||||||
} >> $PILLARFILE
|
} >> $PILLARFILE
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ def replacelistobject(args):
|
|||||||
def addKey(content, key, value):
|
def addKey(content, key, value):
|
||||||
pieces = key.split(".", 1)
|
pieces = key.split(".", 1)
|
||||||
if len(pieces) > 1:
|
if len(pieces) > 1:
|
||||||
if not pieces[0] in content:
|
if pieces[0] not in content or content[pieces[0]] is None:
|
||||||
content[pieces[0]] = {}
|
content[pieces[0]] = {}
|
||||||
addKey(content[pieces[0]], pieces[1], value)
|
addKey(content[pieces[0]], pieces[1], value)
|
||||||
elif key in content:
|
elif key in content:
|
||||||
@@ -346,7 +346,12 @@ def get(args):
|
|||||||
print(f"Key '{key}' not found by so-yaml.py", file=sys.stderr)
|
print(f"Key '{key}' not found by so-yaml.py", file=sys.stderr)
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
print(yaml.safe_dump(output))
|
if isinstance(output, bool):
|
||||||
|
print(str(output).lower())
|
||||||
|
elif isinstance(output, (dict, list)):
|
||||||
|
print(yaml.safe_dump(output).strip())
|
||||||
|
else:
|
||||||
|
print(output)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ class TestRemove(unittest.TestCase):
|
|||||||
|
|
||||||
result = soyaml.get([filename, "key1.child2.deep1"])
|
result = soyaml.get([filename, "key1.child2.deep1"])
|
||||||
self.assertEqual(result, 0)
|
self.assertEqual(result, 0)
|
||||||
self.assertIn("45\n...", mock_stdout.getvalue())
|
self.assertEqual("45\n", mock_stdout.getvalue())
|
||||||
|
|
||||||
def test_get_str(self):
|
def test_get_str(self):
|
||||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||||
@@ -404,7 +404,18 @@ class TestRemove(unittest.TestCase):
|
|||||||
|
|
||||||
result = soyaml.get([filename, "key1.child2.deep1"])
|
result = soyaml.get([filename, "key1.child2.deep1"])
|
||||||
self.assertEqual(result, 0)
|
self.assertEqual(result, 0)
|
||||||
self.assertIn("hello\n...", mock_stdout.getvalue())
|
self.assertEqual("hello\n", mock_stdout.getvalue())
|
||||||
|
|
||||||
|
def test_get_bool(self):
|
||||||
|
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||||
|
filename = "/tmp/so-yaml_test-get.yaml"
|
||||||
|
file = open(filename, "w")
|
||||||
|
file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}")
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
result = soyaml.get([filename, "key2"])
|
||||||
|
self.assertEqual(result, 0)
|
||||||
|
self.assertEqual("false\n", mock_stdout.getvalue())
|
||||||
|
|
||||||
def test_get_list(self):
|
def test_get_list(self):
|
||||||
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
with patch('sys.stdout', new=StringIO()) as mock_stdout:
|
||||||
|
|||||||
Reference in New Issue
Block a user