Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chan = 15432
- local k = require("k")
- local secret = "secretword"
- local mod = peripheral.wrap("back")
- local trusted = {
- ["16714"] = true
- }
- mod.open(chan)
- while true do
- local e, p1, p2, p3, p4, p5 = os.pullEvent()
- if e == "modem_message" and p2 == chan and type(p4) == "string" and p4:sub(1, 10) == "authchall:" and p5 and p5 < 5 then
- local computerID, epoch = p4:match("authchall:(%d+):(%d+)")
- if computerID and trusted[tostring(computerID)] then
- local response = "authresp:" .. k.sha256(p4 .. ":" .. secret .. ":" .. tostring(p5))
- mod.transmit(chan, chan, response)
- print("fulfilled challenge")
- else
- print("invalid challenge")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement