Last Updated: 2017-05-16 22:01:06 UTC
by Russ McRee (Version: 1)
"In God we trust. All others must bring data." ~Bob Rudis
With endless amounts of data, technical detail, and insights on WannaCrypt/WannaCry, and even more FUD, speculation, and even downright trolling, herein is a proposal for you to do your own data-driven security analysis. My favorite book to help you scratch that itch? Data Driven Security: Analysis, Visualization and Dashboards, by Jay Jacobs & Bob Rudis. A few quick samples, using WannaCry data and R, the open source programming language and software environment for statistical computing and graphics. If ever you wanted to pick up a bit of immediately useful programming, R is for you.
Our good friends over at Team Cymru tweeted out a great GitHubGist WannaCry factsheet, therein are a number of useful resources, many leading to other good reads. I easily tracked down a list of malicious IPs associated with WannaCry.
You can always learn interesting insights from IPs and this situation is no different. In very few lines of R, we can identify and visualize the data for further insight. I'll walk you through it. First, let's pull in the libraries we need to do some IP geolocation, create a word cloud, and make said word cloud more color rich, and make a nice plot.
We need to then read in Maxmind data (GeoLite2-Country) and call Oliver Key and @hrbrmstr's rgeolocate package
file <- system.file("extdata","GeoLite2-Country.mmdb", package = "rgeolocate")
Follow that with our malicious WannaCry IP addresses.
ips <- c('220.127.116.11','18.104.22.168','22.214.171.124','126.96.36.199','188.8.131.52','184.108.40.206',
Finally, we pull it all together and receive our first results file.
results <- maxmind(ips, file, c("continent_name", "country_code", "country_name"))
And in one fell swoop, we create a word cloud from our data.
wordcloud(results$country_name, max.words = 100, min.freq = 1, random.order = FALSE, rot.per=0.35, colors=brewer.pal(8, "Dark2"))
Hmm, looks like most of the malicious IPs are in Germany. :-)
Prefer to visualize that a different way? No problem, we'll run a quick count and use plotH to create a scatterplot with histogram-like bars.
ct <- count(results$country_name)
Give it a try for yourself. When events such as WannaCry have you frustrated and down, you can at least take data-driven security analysis in your own hands.
Resources for this article:
- WannaCry – Thoughts and Threat Intelligence
- Introduction to rgeolocate
- Text mining and word cloud fundamentals in R : 5 simple steps you should know
Source code for this post: https://github.com/holisticinfosec/toolsmith_R