WannaCry? Do your own data analysis.

Published: 2017-05-16
Last Updated: 2017-05-16 22:01:06 UTC
by Russ McRee (Version: 1)
3 comment(s)

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

 WannaCry IPs

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('','','','','','',

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:

Source code for this post: https://github.com/holisticinfosec/toolsmith_R


Russ McRee | @holisticinfosec

3 comment(s)


I downloaded an ebook about R programming months ago in a Humble Bundle, you've inspired me to try it.
I looked into R a few years ago for portfolio analysis, but it always got back-burnered. Since January, I have dabbled in R for retail data analytics, mostly supporting and modifying other people's R code. Pretty snazzy language, but we seem to be moving more towards scala and python for use with hadoop.
Just reposting this information here, in case someone needs it:

So now there is a possibility to unlock files encrypted by WannaCry ransomware
using a free decryption program




The decryptor is only going to work if you haven't killed the ransomware process (should be wnry.exe or
or wcry.exe) in Task Manager.

Diary Archives