diff --git a/kea_integration.groovy b/kea_integration.groovy index 6e1b3c2..6e77f07 100644 --- a/kea_integration.groovy +++ b/kea_integration.groovy @@ -33,13 +33,41 @@ pipeline { String token = sh(label: "get_keycloak_token", script: "curl -s -X POST $KEYCLOAK_URL -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=$USER' -d 'password=$PASSWORD' -d 'grant_type=password' -d 'client_id=$CLIENT_ID' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true) String testName = "KEA_TIE_I001" - String url = "$APP_URL/api/v1/od/start" + + // MLTD + String url = "$APP_URL/api/v1/mltd/start" String responseCode = sh(label: testName, script: "curl -m 10 -sL -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url", returnStdout: true) echo responseCode if (!responseCode.endsWith('200')) { error("$testName: Returned status code = $responseCode when calling $url") } - String processId = responseCode.split(",")[1].split(":")[1].split('"')[1]; + String processId = responseCode.split(",")[1].split(":")[1]; + url = "$APP_URL/api/v1/xlsiem" + responseCode = sh(label: testName, script: "curl -m 10 -sL -w '%{http_code}' -H 'Authorization: Bearer $token' -F file=@pcap-data/mltd1-unix.json $url -o /dev/null", returnStdout: true) + echo responseCode + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + responseCode = sh(label: testName, script: "curl -m 10 -sL -w '%{http_code}' -H 'Authorization: Bearer $token' -F file=@pcap-data/mltd2-unix.json $url -o /dev/null", returnStdout: true) + echo responseCode + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + url = "$APP_URL/api/v1/mltd/stop/$processId" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) + echo responseCode + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + + // OD + url = "$APP_URL/api/v1/od/start" + responseCode = sh(label: testName, script: "curl -m 10 -sL -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url", returnStdout: true) + echo responseCode + if (!responseCode.endsWith('200')) { + error("$testName: Returned status code = $responseCode when calling $url") + } + processId = responseCode.split(",")[1].split(":")[1].split('"')[1]; url = "$APP_URL/api/v1/od/analyze/$processId" responseCode = sh(label: testName, script: "curl -m 10 -sL -w '%{http_code}' -H 'Authorization: Bearer $token' -F file=@pcap-data/big.pcap $url -o /dev/null", returnStdout: true) echo responseCode diff --git a/pcap-data/README.md b/pcap-data/README.md index 4bfc6ba..c2b2e84 100644 --- a/pcap-data/README.md +++ b/pcap-data/README.md @@ -1,4 +1,5 @@ -# PCAP data +# PCAP and JSON data files These are some PCAP files with network traffic that can be used to test -KEA functionality. +KEA functionality, along with JSON files for submitting to the different +modules of KEA for testing. diff --git a/pcap-data/mltd1-unix.json b/pcap-data/mltd1-unix.json new file mode 100644 index 0000000..dec891c --- /dev/null +++ b/pcap-data/mltd1-unix.json @@ -0,0 +1,17 @@ +{ + "asset_id": "server", + "timestamp": "1622215320", + "event_alarm": [ + { + "event_alarm_id": "danger", + "event_alarm_char": "danger", + "name": "danger", + "source_ip": "192.168.1.1", + "source_port": 1234, + "destination_ip": "192.168.1.50", + "destination_port": 1231, + "priority": 0, + "confidence": 0 + } + ] +} diff --git a/pcap-data/mltd2-unix.json b/pcap-data/mltd2-unix.json new file mode 100644 index 0000000..dec891c --- /dev/null +++ b/pcap-data/mltd2-unix.json @@ -0,0 +1,17 @@ +{ + "asset_id": "server", + "timestamp": "1622215320", + "event_alarm": [ + { + "event_alarm_id": "danger", + "event_alarm_char": "danger", + "name": "danger", + "source_ip": "192.168.1.1", + "source_port": 1234, + "destination_ip": "192.168.1.50", + "destination_port": 1231, + "priority": 0, + "confidence": 0 + } + ] +}