Skip to content

Commit

Permalink
#564 Send caseId to Cortex analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed May 4, 2018
1 parent 85ed6ef commit 9bbdac2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions thehive-cortex/app/connectors/cortex/services/CortexSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import connectors.cortex.models.JsonFormat._
import connectors.cortex.models._
import javax.inject.{ Inject, Singleton }
import models.Artifact
import services.{ ArtifactSrv, CustomWSAPI, MergeArtifact, RemoveJobsOf }
import services.{ ArtifactSrv, CaseSrv, CustomWSAPI, MergeArtifact, RemoveJobsOf }

import org.elastic4play.controllers.Fields
import org.elastic4play.database.{ DBRemove, ModifyConfig }
Expand Down Expand Up @@ -107,6 +107,7 @@ class JobReplicateActor @Inject() (
class CortexSrv @Inject() (
cortexConfig: CortexConfig,
jobModel: JobModel,
caseSrv: CaseSrv,
artifactSrv: ArtifactSrv,
attachmentSrv: AttachmentSrv,
getSrv: GetSrv,
Expand Down Expand Up @@ -313,9 +314,11 @@ class CortexSrv @Inject() (
case (cortex, analyzer)
for {
artifact artifactSrv.get(artifactId)
caze caseSrv.get(artifact.parentId.get)
artifactAttributes = Json.obj(
"tlp" artifact.tlp(),
"dataType" artifact.dataType())
"dataType" artifact.dataType(),
"message" caze.caseId().toString)
cortexArtifact = (artifact.data(), artifact.attachment()) match {
case (Some(data), None) DataArtifact(data, artifactAttributes)
case (None, Some(attachment)) FileArtifact(attachmentSrv.source(attachment.id), artifactAttributes + ("attachment" Json.toJson(attachment)))
Expand Down

0 comments on commit 9bbdac2

Please sign in to comment.