Skip to content

Commit bb019ba

Browse files
committed
#254 Include attachment information in artifact sent to cortex
1 parent f2c296b commit bb019ba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

thehive-cortex/app/connectors/cortex/services/CortexSrv.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import connectors.cortex.models._
1313
import models.Artifact
1414
import org.elastic4play.controllers.Fields
1515
import org.elastic4play.services._
16+
import org.elastic4play.services.JsonFormat.attachmentFormat
1617
import org.elastic4play.{ InternalError, NotFoundError }
1718
import play.api.libs.json.{ JsObject, Json }
1819
import play.api.libs.ws.WSClient
@@ -257,7 +258,7 @@ class CortexSrv @Inject() (
257258
"dataType" artifact.dataType())
258259
cortexArtifact = (artifact.data(), artifact.attachment()) match {
259260
case (Some(data), None) DataArtifact(data, artifactAttributes)
260-
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifactAttributes)
261+
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifactAttributes + ("attachment" Json.toJson(attachment)))
261262
case _ throw InternalError(s"Artifact has invalid data : ${artifact.attributes}")
262263
}
263264
cortexJobJson cortex.analyze(analyzerId, cortexArtifact)

0 commit comments

Comments
 (0)