Skip to content

Instantly share code, notes, and snippets.

@jgamblin
Last active April 29, 2017 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgamblin/ccf3390bc5d2ce922cd5df38a40617b4 to your computer and use it in GitHub Desktop.
Save jgamblin/ccf3390bc5d2ce922cd5df38a40617b4 to your computer and use it in GitHub Desktop.
Do GeoIP Lookup & Build A Map of Ciscos 25,000 Top DNS Names.
library(leaflet)
library(ipapi)
#devtools::install_github("hrbrmstr/ipapi")
library(tidyverse)
# Get Top 25,000 Cisco Domains
if (file.exists(fn)) file.remove(fn)
temp <- tempfile()
download.file("http://s3-us-west-1.amazonaws.com/umbrella-static/top-1m.csv.zip",temp)
unzip(temp, "top-1m.csv")
sites <- read_csv("top-1m.csv", col_names = FALSE, n_max=25000)
unlink(temp)
#Build Map:
locations <- mutate(geolocate(sites$X2))
sites <- merge(sites, locations, by.x = 0, by.y = 0)
m <- leaflet(sites) %>% addTiles('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png')
m %>% addMarkers(clusterOptions = markerClusterOptions(), ~lon, ~lat, popup = paste("DNS:", sites$X2, "<br>",
"RANK:", sites$X1, "<br>",
"IP:", sites$query, "<br>",
"ISP", sites$isp, "<br>",
"ASN:", sites$as))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment