This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Quartz101's profile picture

SMT: Secure Modem Transit for ComputerCraft

Started by Quartz101, 23 July 2018 - 06:52 PM
Quartz101 #1
Posted 23 July 2018 - 08:52 PM
it's like ringnet but better

INTRODUCING, SMT!

Secure, easy to use modem transit!

Download:
 wget https://gist.githubusercontent.com/steamp0rt/080de776670a778d3e612e1a05d2de77/raw/smt.min.lua smt.lua 
Github: https://github.com/steamp0rt/SMT
Docs: https://steamp0rt.github.io/SMT/

Server Example:

local smt = require("/smt")
local t = smt("smt.main.transit")
t.openChannel(100)
parallel.waitForAll(t.listener, function()
while true do
  local ev, cid, data = os.pullEvent("RLWE-Receive")
  print("Received data! "..tostring(data))
end
end)

Client Example:

local smt = require("/sm")
local t = smt("smt.main.transit")
t.openChannel(100)
parallel.waitForAll(t.listener, function()
    t.openTunnel("f463820793", 100)
    local _,cid = os.pullEvent("RLWE-Finish")
    sleep(0.15)
    t.sendData(cid, "hai")
end)

FAQ:
Q: So wait, what's this "f463820793" in the client example?
A: That's the server's UUID. The server can get it by either reading the ".rlwe_uuid" file, or reading "t.uuid", assuming t is smt("smt.main.transit").
Q: How does this work?
A: Basically, math shenanigans is used to exchange a key in a way that can't be intercepted. And yes, there IS forward secrecy!
Q: Can't I just pretend to have a UUID and intercept the handshake?
A: Not really! The server's static public-private keypair is used during the key exchange. Provided the client already has the public key (it does if you have already handshaked with it once), an attempt to spoof the server will fail the handshake.
Edited on 23 July 2018 - 06:56 PM
hugeblank #2
Posted 27 July 2018 - 09:19 PM
First!

No, literally first to use this. Works really well considering the amount that I'm trying to send. This is one hell of a development for this community and I'm really excited to see where people go with this. Upvote for oyu because you deserve it.