File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 {
You can’t perform that action at this time.
0 commit comments