A New Use for Pipes in R: Forkbombs

August 6, 2014
By

(This article was first published on librestats » R, and kindly contributed to R-bloggers)

Almost 3 years ago, I wrote about how to forkbomb with R. A quick recap is that a forkbomb is a low-tier, malicious misuse of a system; sort of a "baby's first denial of service". The idea is that you write a program that will start an entirely new copy of itself each time it is executed. Executing it will quickly gobble up all available resources, generally locking up the system.

Naturally this is one of my favorite things ever.

Perhaps the most famous forkbomb is the one for *NIX shell by Denis Roio:

:(){ :|:& };:

Many people consider this small piece of malicious code a work of art. Wait until they see the "art" my cat makes when he wants me to stop programming (I kid; I actually think it's beautiful).

The way it basically works is that :(){} is defining a function, which works by calling itself recursively in the background (via fork), causing your system to spawn shells until it's overwhelmed. With magrittr, we can kind of emulate this syntax:

library(parallel)
library(magrittr)

"&" <- function(.) parallel:::mcfork(T)
":" <- function(.) {`&`() %>% `:`()};`:`()

I admit it's far from a perfect match, but it'll do.  Because of the call to fork, this will only work on *NIX-likes (i.e., not Windows).  If you want to test this, I would recommend setting ulimit -u 1000 (or thereabouts) in your shell first.  Last I heard Macs do something like this by default.

But as we all know, software's out and services are in. With that in mind...

 

Forkbomb as a Service

We are proud to announce our latest enterprise-ready solution that scales to your competencies. Worried about how to waste the rest of your budget at the end of the year to avoid dreaded cutbacks? Using leading cloud analytics solutions, we dramatically conceptualize granular, market-driven technology by appropriately incubating professional meta-services. We will spin up an Amazon EC2 instance scaled perfectly to your needs, and through efficient webscale engineering, we will forkbomb it, backed by our uptime-to-downtime guarantee.

FBaaS wastes money better than a team of Java developers. If you're a lean enterprise with a startup culture always on the lookout for disruptors, let us help you actualize your multi-level strategies with our distinctively evolving synergistic web technology. Our best-of-breed functional meta-services synergize with interoperable progressive deliverables, enabling your business to dramatically iterate on convergence and reliably target long-term, next-generation, multi-functional paradigms.

Is your enterprise ready for the game-changer that is FBaaS? Contact us today.

To leave a comment for the author, please follow the link and comment on his blog: librestats » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.