Skip to content

Commit

Permalink
#1685 Remove redundant MISP filters
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Dec 22, 2020
1 parent 080e6ee commit 2946d8e
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions misp/client/src/main/scala/org/thp/misp/client/MispClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,9 @@ class MispClient(
val maybeEvent = Try(Json.parse(data.toArray[Byte]).as[Event])
maybeEvent.fold(error => { logger.warn(s"Event has invalid format: ${data.decodeString("UTF-8")}", error); Nil }, List(_))
}
.filterNot(isExcluded)
.mapMaterializedValue(_ => NotUsed)
}

def isExcluded(event: Event): Boolean = {
val eventTags = event.tags.map(_.name).toSet
if (whitelistTags.nonEmpty && (whitelistTags & eventTags).isEmpty) {
logger.debug(s"event ${event.id} is ignored because it doesn't contain any of whitelist tags (${whitelistTags.mkString(",")})")
true
} else if (excludedOrganisations.contains(event.orgc)) {
logger.debug(s"event ${event.id} is ignored because its organisation (${event.orgc}) is excluded")
true
} else {
val t = excludedTags.intersect(eventTags)
if ((excludedTags & eventTags).nonEmpty) {
logger.debug(s"event ${event.id} is ignored because one of its tags (${t.mkString(",")}) is excluded")
true
} else false
}
}

def searchAttributes(eventId: String, publishDate: Option[Date])(implicit ec: ExecutionContext): Source[Attribute, NotUsed] = {
logger.debug(s"Search MISP attributes for event #$eventId ${publishDate.fold("")("from " + _)}")
Source
Expand Down

0 comments on commit 2946d8e

Please sign in to comment.