Skip to content

Commit

Permalink
#292 Fix MISP threat level and Thehive severity convertion
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Aug 28, 2017
1 parent 830fef3 commit 6c4489d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion thehive-misp/app/connectors/misp/JsonFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object JsonFormat {
isPublished,
s"#$eventId ${info.trim}",
s"Imported from MISP Event #$eventId, created at $date",
threatLevel.toLong,
4 - threatLevel.toLong,
alertTags,
tlp,
"")
Expand Down
6 changes: 3 additions & 3 deletions thehive-misp/app/connectors/misp/MispExport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ class MispExport @Inject() (
.map(_._1)
}

def createEvent(mispConnection: MispConnection, title: String, severity: String, date: Date, attributes: Seq[ExportedMispAttribute]): Future[(String, Seq[ExportedMispAttribute])] = {
def createEvent(mispConnection: MispConnection, title: String, severity: Long, date: Date, attributes: Seq[ExportedMispAttribute]): Future[(String, Seq[ExportedMispAttribute])] = {
val mispEvent = Json.obj(
"Event" Json.obj(
"distribution" 0,
"threat_level_id" severity,
"threat_level_id" (4 - severity),
"analysis" 0,
"info" title,
"date" dateFormat.format(date),
Expand Down Expand Up @@ -150,7 +150,7 @@ class MispExport @Inject() (
simpleAttributes = uniqueAttributes.filter(_.value.isLeft) // FIXME used only if event doesn't exist
(eventId, existingAttributes) maybeEventId.fold {
// if no event is associated to this case, create a new one
createEvent(mispConnection, caze.title(), caze.severity().toString, caze.startDate(), simpleAttributes).map {
createEvent(mispConnection, caze.title(), caze.severity(), caze.startDate(), simpleAttributes).map {
case (eventId, exportedAttributes) eventId exportedAttributes.map(_.value.left.get)
}
} { eventId // if an event already exists, retrieve its attributes in order to export only new one
Expand Down

0 comments on commit 6c4489d

Please sign in to comment.