ldns DNS resolver wrapper libary for R
Needs ldns
- http://www.nlnetlabs.nl/projects/ldns/ - which is apt
-able and brew
-able.
library(devtools) install_github("hrbrmstr/resolv")
These folks seem to have done some work getting the ldns
library to work under Windows, but this particular package only works (for now on Linux/Mac OS X.
Bug reports (esp from ppl with more C++/Rcpp experience), feature requests & pull requests welcome/encouraged. The code/package is documented pretty well (esp for me). Hopefully this library can replace system
calls for folks who need to "do DNS stuff" from R.
0.2.3
removed plyr
dependency; cleaned up tests; converted alexa CSV to rda file (can now do data(alexa)
)0.2.2
includes making the parameters fully consistent, making the vectorized functions work better and having even saner return values when there were errors or no records found0.2.1
includes 2 memory fixes and better return types if no records are found0.2.0
includes ability to (optionally - set the full
parameter to TRUE
) return class
, ttl
& owner
fields, includes resolve_ns()
and NS()
functions, plus changes return type for a few functions.0.1.2
after running valgrind
and fixing some missing free
's (#ty
to @arj!)0.1.1
as I modified some of the roxygen documentation to better make this work out of the box. Any help getting it to work on Windows is greatly appreciatedProvides functions to perform robust DNS lookups from R. Uses the ldns
library which provides support for IPv4 & IPv6 addresses as well as DNSSEC. This library currently exposes the functions indicated below.
Package: resolv Type: Package Title: Wrapper to ldns library for DNS calls from R Version: 0.2.3 Date: 2014-08-30 Author: Bob Rudis (@hrbrmstr) Maintainer: Bob Rudids <bob@rudis.net> Description: Wrapper to ldns library for DNS calls from R. It provides vecorized & non-vectorized version of core DNS query functions and allows for vector or data frame return values in most functions (depending on the level of detail desired from the query). It's significantly faster than issuing a system() call but does not yet work under Windows. URL: https://github.com/hrbrmstr/resolv BugReports: https://github.com/hrbrmstr/resolv/issues License: GPL-2 Imports: Rcpp (>= 0.11.1) LinkingTo: Rcpp
Direct ldns
wrappers:
resolv_txt()
- perform TXT lookupsresolv_mx()
- perform MX lookups (returns data frame)resolv_cname()
- perform CNAME lookupsresolv_srv()
- perform SRV lookups (returns data frame)resolv_a()
- perform A lookupsresolv_ptr()
- perform PTR lookupsresolv_ns()
- perform NS lookupsand, their vectorized counterparts:
TXT()
MX()
CNAME()
SRV()
A()
PTR()
NS()
(TODO: to add "SOA" suppot)
Ancillary/"fun"ctions
These show off some of what you can do with DNS
ip2asn()
- interface to http://www.team-cymru.org/Services/ip-to-asn.html#dnsasninfo()
- interface to http://www.team-cymru.org/Services/ip-to-asn.html#dnswikidns()
- interface to https://dgl.cx/wikipedia-dnsdnscalc()
- interface to http://www.isi.edu/touch/tools/dns-calc.htmldevtools::install_github("hrbrmstr/resolv")
Don't forget the need to
brew install ldns
or your favorite linux pkg mgr equivalent, first.
options(width=120)
require(resolv) library(plyr) ## google talk provides a good example for this resolv_srv("_xmpp-server._tcp.gmail.com.") ## where www.nasa.gov hosts resolv_a("www.nasa.gov") ## DNS seekrit TXT URLs ## uncomment and run it locally # browseURL(gsub("\"", "", resolv_txt("google-public-dns-a.google.com"))) # vectorized + full return TXT(c("stackoverflow.com", "microsoft.com", "apple.com", "google.com"), full=TRUE) ## parallel queries library(foreach) library(doParallel) library(data.table) data(alexa) # http://s3.amazonaws.com/alexa-static/top-1m.csv.zip n <- 100 # top 'n' to resolve (change it to 10000 on your own as that # makes the README builds churn too long) registerDoParallel(cores=6) # set to what you can on your system output <- foreach(i=1:n, .packages=c("Rcpp", "resolv")) %dopar% resolv_a(alexa[i,]$domain) names(output) <- alexa[1:n,]$domain head(output)
library(resolv) library(testthat) date() test_dir("tests/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.