BananeMan

Untitled

Sep 21st, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. --*****************************
  2. --********BANQUE CLIENT********
  3. --*****************************
  4.  
  5. --Déclaration des variables
  6. user = ""
  7. pass = ""
  8. idserver = 0
  9. whilef = False
  10. rondanet = "/disk/rondanet"
  11. publickey = ""
  12. os.loadAPI(rondanet)
  13. -- Fin des déclaration des variables
  14. function keyretriver()
  15. idserver = rondanet.lookup("babanque", "server")
  16. local messagea = {action = "keyretrive"}
  17. textutils.serialize(messagea)
  18. rondanet.send(idserver, messagea)
  19. while true do
  20. local si, mess, distance = rondanet.receive()
  21. if si == idserver then
  22. publickey = mess
  23. return publickey
  24. break
  25. end
  26. end
  27. end
  28. function interfac()
  29. print("Connection au serveur banquaire")
  30. rondanet.open("back")
  31. keyretriver()
  32. print("Banque interface")
  33. print("Entrée votre nom d'utilisateur:")
  34. user = read()
  35. print("Entrée votre mot de passe")
  36. pass = read("*")
  37. print("Connection en cours")
  38. end
  39.  
  40. function conn()
  41. local logintable = {action = "Login", User = user, Pass = pass, id = os.getComputerID()}
  42. login = textutils.serialize(logintable)
  43. idserver = rondanet.lookup("babanque", "server")
  44. rondanet.send(idserver, login "superproto")
  45. while whilef == False do
  46. senderid, message, disance = rondanet.receive()
  47. if senderid == idserver then
  48.  
  49. message = textutils.unserialize(message)
  50. if message.action == "login" and message.pseudo == user then
  51. whilef = True
  52. if message.response == "yes" then
  53. print("Bravo !")
  54. else
  55. print("Mauvais identifiant")
  56. break
  57. end
  58. end
  59. end
  60. end
  61. whilef = False
  62. end
  63.  
  64. interfac()
Add Comment
Please, Sign In to add comment