Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dofile = function(path,...)
- local f = loadfile(path)
- setfenv(f,_G)
- return f(...)
- end
- local Tunnel = dofile("Tunnel/init.lua","Tunnel")
- local AESkeys = {}
- local file = fs.open("pass","r")
- local pass = file.readAll()
- print(pass)
- file.close()
- local modem = peripheral.wrap("right")
- modem.open(405)
- local function addConnection()
- while true do
- print("Adding connection...")
- local secretNumber = Tunnel.DH.connect(modem,404,BigNum)
- local AESkey = Tunnel.SHA.sha256(tostring(secretNumber))
- local id = #AESkeys + 1
- AESkeys[id] = AESkey
- modem.transmit(404,2,id)
- end
- end
- term.redirect(term.native())
- local event = {}
- local function main()
- while true do
- event = {os.pullEvent()}
- if event[1] == "modem_message" and event[3] == 405 then
- decrypted = nil
- local decrypted = Tunnel.AES.decryptBytes(AESkeys[event[4]],event[5])
- if decrypted == pass then
- print("WOW, Yissss!")
- rs.setOutput("left",true)
- sleep(3)
- rs.setOutput("left",false)
- end
- end
- end
- end
- parallel.waitForAll(main,addConnection)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement