zdnsr

Perform Bulk 'DNS' Queries Using 'zdns'

Description

Provides wrapper/helper methods for executing 'zdns' (https://github.com/zmap/zdns) bulk queries along with utility methods to retrieve and cache 'Public DNS' (http://public-dns.info/) nameserver lists.

What's Inside The Tin

The following functions are implemented:

Installation

devtools::install_github("hrbrmstr/zdnsr")
options(width=120)

Usage

library(zdnsr)

# current verison
packageVersion("zdnsr")

Example (top prefix enumeration)

c(
  "www", "mail", "mx", "blog", "ns1", "ns2", "dev", "server", "email", 
  "cloud", "api", "support", "smtp", "app", "webmail", "test", "box", 
  "m", "admin", "forum", "news", "web", "mail2", "ns", "demo", "my", 
  "portal", "shop", "host", "cdn", "git", "vps", "mx1", "mail1", 
  "static", "help", "ns3", "beta", "chat", "secure", "staging", "vpn", 
  "apps", "server1", "ftp", "crm", "new", "wiki",  "home", "info"
) -> top_common_prefixes # via Rapid7 FDNS analysis

tf <- tempfile(fileext = ".json")

zdns_query(
  sprintf("%s.rstudio.com", top_common_prefixes),
  query_type = "A",
  num_nameservers = (length(top_common_prefixes) * 2),
  output_file = tf
)

res <- jsonlite::stream_in(file(tf))
unlink(tf)

found <- which(lengths(res$data$answers) > 0)

do.call(
  rbind.data.frame,
  lapply(found, function(idx) {
    res$data$answers[[idx]]$query_name <- res$name[idx]
    res$data$answers[[idx]]
  })
) -> xdf

xdf <- xdf[,c("query_name", "name", "class", "ttl", "type", "answer")]

knitr::kable(xdf)


hrbrmstr/zdnsr documentation built on Feb. 28, 2020, 9:35 a.m.