Advertisement
programcreator

Door Lock Client

Feb 6th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1.  
  2. dofile = function(path,...)
  3.     local f = loadfile(path)
  4.     setfenv(f,_G)
  5.     return f(...)
  6. end
  7.  
  8. local Tunnel = dofile("Tunnel/init.lua","Tunnel")
  9.  
  10. local modem = peripheral.wrap("back")
  11. local event = {}
  12.  
  13.  
  14. local secretNumber = Tunnel.DH.connect(modem,404)
  15. local AESkey = Tunnel.SHA.sha256(tostring(secretNumber))
  16.  
  17. repeat
  18.     event = {os.pullEvent()}
  19. until event[3] == 404 and event[1] == "modem_message"
  20.  
  21. local id = event[5]
  22. print("ID: ")
  23. print(id)
  24.  
  25.  
  26. term.redirect(term.native())
  27.  
  28. while true do
  29.   term.clear()
  30.   term.setCursorPos(1,1)
  31.   print("Input the password:")
  32.   local input = read()
  33.   local SHAInput = Tunnel.SHA.sha256(input)
  34.   local encrypted = Tunnel.AES.encryptBytes(AESkey,SHAInput)
  35.   modem.transmit(405,id,encrypted)
  36.   sleep(3)
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement