From 076f2beb3b78fe45913dd81c275b4953311914df Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Wed, 3 Apr 2024 17:06:48 +0200 Subject: [PATCH] chg: [test] Check if MISP and STIX2 are valid in build-test.sh --- tests/build-test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/build-test.sh b/tests/build-test.sh index 2f4be8309..3042aec4a 100644 --- a/tests/build-test.sh +++ b/tests/build-test.sh @@ -16,12 +16,14 @@ curl -sS --compressed https://stixproject.github.io/documentation/idioms/c2-indi python ./../app/files/scripts/stix2misp.py test-stix1.xml 1 1 ./../app/files/scripts/synonymsToTagNames.json | python3 -c 'import sys, json; data = json.load(sys.stdin); print(data); sys.exit(0 if data["success"] == 1 else 1)' rm -f ./../app/files/scripts/tmp/{test-stix1.xml,test-stix1.xml.json} -# Test converting stix2 to MISP format +# Test converting STIX2 to MISP format curl -sS --compressed https://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/master/examples/indicator-for-c2-ip-address.json > ./../app/files/scripts/tmp/test-stix2.json python ./../app/files/scripts/stix2/stix2misp.py -i ./../app/files/scripts/tmp/test-stix2.json --distribution 1 | python3 -c 'import sys, json; data = json.load(sys.stdin); print(data); sys.exit(0 if data["success"] == 1 else 1)' +python3 -c 'import sys, json; json.load(sys.stdin)' < ./../app/files/scripts/tmp/test-stix2.json.out rm -f ./../app/files/scripts/tmp/{test-stix2.json,test-stix2.json.stix2} # Test converting MISP to STIX2 cp event.json /tmp/ python ./../app/files/scripts/stix2/misp2stix2.py -i /tmp/event.json | python3 -c 'import sys, json; data = json.load(sys.stdin); print(data); sys.exit(0 if data["success"] == 1 else 1)' +python3 -c 'import sys, json; json.load(sys.stdin)' < /tmp/event.json.out rm -f /tmp/{event.json,event.json.out}