SHOW:
|
|
- or go back to the newest paste.
| 1 | --Servector Variant 1 "Infinity" | |
| 2 | ||
| 3 | args = {...}
| |
| 4 | local vir = [[local function a() | |
| 5 | local mod = "" | |
| 6 | for i, v in pairs(peripheral.getNames()) do | |
| 7 | if (peripheral.getType(v) == "modem" and peripheral.call(v,"isWireless") == true) then | |
| 8 | rednetside = v | |
| 9 | mod = peripheral.wrap(v) | |
| 10 | rednet.open(v) | |
| 11 | break | |
| 12 | end | |
| 13 | end | |
| 14 | if mod == "" then | |
| 15 | while true do | |
| 16 | sleep(5) | |
| 17 | end | |
| 18 | end | |
| 19 | local sites = {"TimerWolf "..((os.getComputerLabel() ~= nil) and os.getComputerLabel().." " or "")..os.getComputerID()}
| |
| 20 | while true do | |
| 21 | local id, msg = rednet.receive() | |
| 22 | msg = tostring(msg) | |
| 23 | local thing, thing3 = sites[1], 1 | |
| 24 | if msg == "infiniftp_dns" then | |
| 25 | - | rednet.send(id,textutils.serialize(sites)) |
| 25 | + | rednet.send(id,"iftp:"..textutils.serialize(sites)) |
| 26 | elseif thing ~= nil then | |
| 27 | if string.sub(msg,1,4) == "ftp:" then | |
| 28 | path = string.gsub(string.sub(msg,5),thing,"/") | |
| 29 | page = fs.open(path,"r") | |
| 30 | red = page.readAll() | |
| 31 | if page ~= nil then | |
| 32 | rednet.send(id,"file:"..red) | |
| 33 | page.close() | |
| 34 | end | |
| 35 | elseif string.sub(msg,1,7) == "exists:" then | |
| 36 | path = string.gsub(string.sub(msg,8),thing,"/") | |
| 37 | rednet.send(id,(fs.exists(path))) | |
| 38 | elseif string.sub(msg,1,9) == "iftplist:" then | |
| 39 | path = string.gsub(string.sub(msg,10),thing,"/") | |
| 40 | if fs.exists(path) and fs.isDir(path) then | |
| 41 | local list = fs.list(path) | |
| 42 | local list2 = {}
| |
| 43 | for i, v in pairs(list) do | |
| 44 | table.insert(list2,{v,fs.isDir(path.."/"..v)})
| |
| 45 | end | |
| 46 | rednet.send(id,"flist:"..textutils.serialize(list2)) | |
| 47 | end | |
| 48 | end | |
| 49 | end | |
| 50 | end | |
| 51 | end | |
| 52 | parallel.waitForAny(prog,a)]] | |
| 53 | page = fs.open(args[1],"r") | |
| 54 | red = page.readAll() | |
| 55 | if page ~= nil then | |
| 56 | page.close() | |
| 57 | end | |
| 58 | page = fs.open(args[2],"w") | |
| 59 | page.write("local function prog()\n"..red.."\nend\n"..vir)
| |
| 60 | page.close() |