Skip to content

Commit 11f1d9b

Browse files
authored
Merge pull request #58 from hazcod/feat/deps
feat: add days open to security overview
2 parents 8171793 + 4fc0e50 commit 11f1d9b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ templates:
113113
:man-surfing: *{{ $result.Email }}*
114114
{{ range $device := $result.Devices }}
115115
:computer: {{ $device.MachineName}}
116-
{{ range $vuln := $device.Findings }}- {{ $vuln.ProductName }} ({{ $vuln.CveSeverity }}) ({{ $vuln.TimestampFound }}) ({{ $vuln.CveID }}){{ end }}
116+
{{ range $vuln := $device.Findings }}- {{ $vuln.ProductName }} ({{ $vuln.CveSeverity }}) (Open for {{ $vuln.DaysOpen }} days) ({{ $vuln.CveID }}){{ end }}
117117
{{ end }}
118118
{{ end }}
119119

pkg/falcon/extractor.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import (
88
"fmt"
99
"github.com/crowdstrike/gofalcon/falcon/client/hosts"
1010
"github.com/pkg/errors"
11+
"math"
1112
"strings"
13+
"time"
1214

1315
"github.com/crowdstrike/gofalcon/falcon"
1416
"github.com/crowdstrike/gofalcon/falcon/client/spotlight_vulnerabilities"
@@ -40,6 +42,7 @@ type UserDeviceFinding struct {
4042
CveID string
4143
CveSeverity string
4244
TimestampFound string
45+
DaysOpen uint
4346
Mitigations []string
4447
}
4548

@@ -299,11 +302,18 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string
299302
WithField("severity", vuln.Cve.Severity).WithField("cve", *vuln.Cve.ID).
300303
Debug("adding vulnerability")
301304

305+
createdTime, err := time.Parse(time.RFC3339, *vuln.CreatedTimestamp)
306+
if err != nil {
307+
logrus.WithField("created_timestamp", *vuln.CreatedTimestamp).WithError(err).
308+
Error("could not parse created timestamp as RFC3339")
309+
}
310+
302311
deviceFinding := UserDeviceFinding{
303312
ProductName: *vulnApp.ProductNameVersion,
304313
CveID: *vuln.Cve.ID,
305314
CveSeverity: vuln.Cve.Severity,
306315
TimestampFound: *vuln.CreatedTimestamp,
316+
DaysOpen: uint(math.Ceil(time.Since(createdTime).Hours() / 24)),
307317
}
308318

309319
for _, mitigation := range vuln.Remediation.Entities {

0 commit comments

Comments
 (0)