Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not fs.exists("secure") then
- shell.run("pastebin get r8AFFkbV secure")
- end
- if not secure then
- os.loadAPI("secure")
- end
- local mo = {}
- for k,v in pairs(peripheral.getNames()) do
- if peripheral.getType(v) == "modem" and peripheral.call(v, "isWireless") == true then
- mo = peripheral.wrap(v)
- end
- end
- mo.open(338)
- assert(mo ~= {}, "A wireless modem is needed!")
- local function n()
- print("Amethyst test browser (early dev)")
- write("Enter website: ")
- local m = read()
- mo.transmit(337, os.getComputerID(), "WHOIS::"..tostring(read))
- local id = 0
- while true do
- local _, s, sen, rep, msg = os.pullEvent("modem_message")
- if msg == "IAM::"..tostring(m) then
- local id = rep
- break
- end
- end
- write("Enter page: ")
- local p = read()
- local cid = secure.openTunnel(mo, id)
- secure.sendTunnel(mo, cid, tostring(p))
- local code = secure.listenTunnel(cid)
- if not code then
- secure.closeTunnel(mo, cid)
- error("Code not received!", 0)
- else
- loadstring(code)
- secure.closeTunnel(mo, cid)
- end
- end
- parallel.waitForAll(function()
- secure.connectionHandler(mo)
- end, n)
Advertisement
Add Comment
Please, Sign In to add comment