Browse Source

fixed topic grab

master
boB Rudis 2 years ago
parent
commit
ac7e9fdc2f
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 19
      R/utils.R
  2. 2
      inst/tinytest/test_attackerkb.R

19
R/utils.R

@ -76,6 +76,7 @@ date_convert <- function(.x) {
.x[["metadata"]] <- I(list(.x[["metadata"]]))
.x[["score"]] <- I(list(.x[["score"]]))
.x[["tags"]] <- I(list(.x[["tags"]]))
.x[["references"]] <- I(list(.x[["references"]]))
if ("rapid7Analysis" %in% names(.x)) {
if (length(.x[["rapid7Analysis"]])) {
@ -85,6 +86,22 @@ date_convert <- function(.x) {
}
}
if ("rapid7AnalysisCreated" %in% names(.x)) {
if (length(.x[["rapid7AnalysisCreated"]])) {
.x[["rapid7AnalysisCreated"]] <- paste0(.x[["rapid7AnalysisCreated"]], collapse = " ")
} else {
.x[["rapid7AnalysisCreated"]] <- NA_character_
}
}
if ("rapid7AnalysisRevisionDate" %in% names(.x)) {
if (length(.x[["rapid7AnalysisRevisionDate"]])) {
.x[["rapid7AnalysisRevisionDate"]] <- paste0(.x[["rapid7AnalysisRevisionDate"]], collapse = " ")
} else {
.x[["rapid7AnalysisRevisionDate"]] <- NA_character_
}
}
.x <- as.data.frame(.x, stringsAsFactors = FALSE)
.x
@ -133,7 +150,7 @@ handle_response <- function(.x, api_key = attackerkb_api_key(), came_from = NULL
path <- .x[["links"]][["self"]][["href"]]
if (length(path) == 0) path <- sub("^kb_", "/", came_from)
if (length(path) == 0) path <- sub("^kb_", "/v1/", came_from)
ret <- .x[["data"]]

2
inst/tinytest/test_attackerkb.R

@ -1,4 +1,4 @@
# Placeholder with simple test
expect_equal(1 + 1, 2)

Loading…
Cancel
Save