Skip to content

Commit

Permalink
hotfix for bug on not being able to record fqdn beacons that are also…
Browse files Browse the repository at this point in the history
… ip beacons (#616)

FQDN strobes are now properly flagged.
  • Loading branch information
lisaSW authored Mar 4, 2021
1 parent ba22c3b commit 262263b
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions pkg/beaconfqdn/dissector.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,18 @@ func (d *dissector) start() {
"tbytes": bson.M{"$sum": "$tbytes"},
"icerts": bson.M{"$push": "$icerts"},
}},
{"$unwind": "$ts"},
{"$unwind": "$ts"},
{"$unwind": bson.M{
"path": "$ts",
// by default, $unwind does not output a document if the field value is null,
// missing, or an empty array. Since uconns stops storing ts and byte array
// results if a result is going to be guaranteed to be a beacon, we need this
// to not discard the result so we can update the fqdn beacon accurately
"preserveNullAndEmptyArrays": true,
}},
{"$unwind": bson.M{
"path": "$ts",
"preserveNullAndEmptyArrays": true,
}},
{"$group": bson.M{
"_id": "$_id",
// need to unique-ify timestamps or else results
Expand All @@ -114,8 +124,14 @@ func (d *dissector) start() {
"tbytes": bson.M{"$first": "$tbytes"},
"icerts": bson.M{"$first": "$icerts"},
}},
{"$unwind": "$bytes"},
{"$unwind": "$bytes"},
{"$unwind": bson.M{
"path": "$bytes",
"preserveNullAndEmptyArrays": true,
}},
{"$unwind": bson.M{
"path": "$bytes",
"preserveNullAndEmptyArrays": true,
}},
{"$group": bson.M{
"_id": "$_id",
"ts": bson.M{"$first": "$ts"},
Expand Down

0 comments on commit 262263b

Please sign in to comment.