Skip to content

Commit

Permalink
#1644 Fix MISP export for hash observables
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Nov 13, 2020
1 parent ecd323b commit 87fcd20
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,22 @@ class MispExportSrv @Inject() (
observable.tags.map(t => MispTag(None, t.toString, Some(t.colour), None)) ++ tlpTags.get(observable.tlp)
else
tlpTags.get(observable.tlp).toSeq
connector
.attributeConverter(observable.`type`)

observable
.data
.collect {
case data if observable.`type` == "hash" => data.data.length
}
.collect {
case 32 => "md5"
case 40 => "sha1"
case 56 => "sha224"
case 64 => "sha256"
case 96 => "sha384"
case 128 => "sha512"
}
.map("Payload delivery" -> _)
.orElse(connector.attributeConverter(observable.`type`))
.map {
case (cat, tpe) =>
Attribute(
Expand Down

0 comments on commit 87fcd20

Please sign in to comment.