You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.1 KiB

---
output: rmarkdown::github_document
---

# 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.

- `zdns`: <https://github.com/zmap/zdns>
- `Public DNS Lists`: <http://public-dns.info/>

## What's Inside The Tin

The following functions are implemented:

- `install_zdns`: Helper to try to get `zdns` installed
- `refresh_publc_nameservers_list`: Refresh the list of valid public nameservers
- `zdns_exec`: Raw interface to `zdns`
- `zdns_help`: Raw interface to `zdns`
- `zdns_query`: Bulk query using `zdns`

## Installation

```{r eval=FALSE}
devtools::install_github("hrbrmstr/zdnsr")
```

```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
options(width=120)
```

## Usage

```{r message=FALSE, warning=FALSE, error=FALSE}
library(zdnsr)

# current verison
packageVersion("zdnsr")

```

### Example (top prefix enumeration)

```{r cache=TRUE}
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)
```