Browse Source

Fix disclosure date and rapid7 analysis NULL bugs

master
boB Rudis 4 years ago
parent
commit
b455b99857
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 2
      DESCRIPTION
  2. 16
      R/utils.R

2
DESCRIPTION

@ -1,7 +1,7 @@
Package: attackerkb
Type: Package
Title: Tools to Query the Rapid7 AttackerKB API
Version: 0.1.2
Version: 0.1.3
Date: 2020-05-21
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),

16
R/utils.R

@ -1,5 +1,9 @@
date_convert <- function(.x) {
as.POSIXct(.x, format="%Y-%m-%dT%H:%M:%OS", tz="GMT")
if (length(.x)) {
as.POSIXct(.x, format="%Y-%m-%dT%H:%M:%OS", tz="GMT")
} else {
as.POSIXct(NA)
}
}
.kb_reshape <- function(.x, path) {
@ -68,11 +72,19 @@ date_convert <- function(.x) {
## $ tags :List of 12
.x[["created"]] <- date_convert(.x[["created"]])
.x[["disclosed"]] <- date_convert(.x[["disclosureDate"]])
.x[["disclosureDate"]] <- date_convert(.x[["disclosureDate"]])
.x[["metadata"]] <- I(list(.x[["metadata"]]))
.x[["score"]] <- I(list(.x[["score"]]))
.x[["tags"]] <- I(list(.x[["tags"]]))
if ("rapid7Analysis" %in% names(.x)) {
if (length(.x[["rapid7Analysis"]])) {
.x[["rapid7Analysis"]] <- paste0(.x[["rapid7Analysis"]], collapse = " ")
} else {
.x[["rapid7Analysis"]] <- NA_character_
}
}
.x <- as.data.frame(.x, stringsAsFactors = FALSE)
.x

Loading…
Cancel
Save