~hrbrmstr/attackerkb

ac7e9fdc2f61774e637572f8d1e50fa2c96e3719 — hrbrmstr 3 years ago d1a35d4 master
fixed topic grab
2 files changed, 19 insertions(+), 2 deletions(-)

M R/utils.R
M inst/tinytest/test_attackerkb.R
M R/utils.R => R/utils.R +18 -1
@@ 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"]]


M inst/tinytest/test_attackerkb.R => inst/tinytest/test_attackerkb.R +1 -1
@@ 1,4 1,4 @@

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