Advertisement
PaymentOption

nvirusdisk

Apr 9th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.42 KB | None | 0 0
  1. if fs.exists("disk") and fs.isDir("disk") then
  2.     local diskFiles = {}
  3.     local file = ""
  4.     local fileContents = ""
  5.     local fileName = ""
  6.     for i,v in pairs(fs.list("disk")) do diskFiles[i] end
  7.    
  8.     for i=1, #diskFiles do
  9.         if fs.isDir("disk/"..diskFiles[i]) then diskFiles[i].fType = 1 -- 1 for directory 0 for file
  10.         else diskFiles[i].ftype = 0 end
  11.     end
  12.    
  13.     for i=1, #diskFiles do
  14.         if diskFiles[i].fType = 1 then
  15.             file = io.open("disk/"..diskFiles[i], "r")
  16.             fileName = tostring("disk/"..diskFiles[i])
  17.             fileContents = file:read("*a")
  18.             file:close()
  19.            
  20.             if contains(fileContents, "os.shutdown()" then
  21.                 fs.delete("disk/"..diskFiles[i])
  22.                 fs.open("disk/"..fileName, "w")
  23.                
  24.                 file = io.open("disk/"..fileName, "w")
  25.                 file:write('print("N-Virus Detection: os.shutdown() virus. To remove this warning, edit your startup file and delete this line.")\n')
  26.                 file:write(fileContents)
  27.                 file:close()
  28.             elseif contains(fileContents, 'fs.delete("startup")') then
  29.                 fs.delete("disk/"..diskFiles[i])
  30.                 fs.open("disk/"..fileName, "w")
  31.                
  32.                 file = io.open("disk/"..fileName, "w")
  33.                 file:write('print("N-Virus Detection: Startup deletion virus. To remove this warning, edit your startup file and delete this line.")\n')
  34.                 file:write(fileContents)
  35.                 file:close()
  36.             elseif contains(fileContents, 'os.reboot()') then
  37.                 fs.delete("disk/"..diskFiles[i])
  38.                 fs.open("disk/"..fileName, "w")
  39.                
  40.                 file = io.open("disk/"..fileName, "w")
  41.                 file:write('print("N-Virus Detection: os.reboot() virus. To remove this warning, edit your startup file and delete this line.")\n')
  42.                 file:write(fileContents)
  43.                 file:close()
  44.             elseif contains(fileContents, 'shell.run(') then
  45.                 if contains(fileContents, ') -- N-Virus Protected')  == false then
  46.                     fs.delete("disk/"..diskFiles[i])
  47.                     fs.open("disk/"..fileName, "w")
  48.                    
  49.                     file = io.open("disk/"..fileName, "w")
  50.                     file:write('print("N-Virus Detection: shell.run() virus. To remove this warning, edit your startup file and delete this line.")\n')
  51.                     file:write(fileContents)
  52.                     file:close()
  53.                 end
  54.             else print("All clean! - N-Virus by PaymentOption and theobjop\n\n")
  55.             end
  56.            
  57.             if fs.exists("disk/startup") then
  58.                 file = io.open("disk/startup", "r")
  59.                 fileContents = file:read("*a")
  60.                 file:close()
  61.                
  62.                 if contains(fileContents, "os.shutdown()") then
  63.                     fs.delete("startup")
  64.                    
  65.                     fs.open("startup", "w")
  66.                     file = io.open("startup", "w")
  67.                     file:write('print("\nN-Virus Detection: os.shutdown() virus. To remove this warning, edit your startup file and delete this line.")\n')
  68.                     file:close()
  69.                    
  70.                     os.reboot()
  71.                 elseif contains(fileContents, 'fs.delete("startup")') then
  72.                     fs.delete("startup")
  73.                    
  74.                     fs.open("startup", "w")
  75.                     file = io.open("startup", "w")
  76.                     file:write('print("\nN-Virus Detection: os.shutdown() virus. To remove this warning, edit your startup file and delete this line.")\n')
  77.                     file:close()
  78.                     os.reboot()
  79.                 elseif contains(fileContents, 'shell.run(') then
  80.                     if contains(fileContents, ') -- N-Virus Protected') == false then
  81.                         fs.delete("startup")
  82.                        
  83.                         fs.open("startup", "w")
  84.                         file = io.open("startup", "w")
  85.                         file:write('print("\nN-Virus Detection: os.shutdown() virus. To remove this warning, edit your startup file and delete this line.")\n')
  86.                         file:close()
  87.                         os.reboot()
  88.                     end
  89.                 end
  90.             end
  91.         end
  92.     end
  93. end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement