Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --*****************************
- --********BANQUE CLIENT********
- --*****************************
- --Déclaration des variables
- user = ""
- pass = ""
- idserver = 0
- whilef = false
- --rondane = "/disk/rednet"
- publickey = ""
- crypt = "/disk/crypto"
- os.loadApi(crypt)
- --os.loadAPI(rondane)
- -- Fin des déclaration des variables
- function keyretriver()
- idserver = rednet.lookup("2banque", "server")
- local messagea = {action = "keyretrive"}
- local omg = textutils.serialize(messagea)
- if idserver == nil then
- print("La connection n'a pas plus être établie")
- print("Redémarage")
- sleep(2)
- os.reboot()
- else
- rednet.send(idserver, omg, "superproto")
- end
- local disable = true
- while disable do
- local si, mess, distance = rednet.receive()
- if si == idserver then
- publickey = mess
- disable = false
- return publickey
- end
- end
- end
- function interfac()
- print("Connection au serveur banquaire")
- rednet.open("back")
- keyretriver()
- print("Banque interface")
- print("Entrée votre nom d'utilisateur:")
- user = read()
- print("Entrée votre mot de passe")
- pass = read("*")
- print("Connection en cours")
- conn()
- end
- function conn()
- local logintable = {action = "login", User = user, Pass = pass, id = os.getComputerID()}
- login = textutils.serialize(logintable)
- idserver = rednet.lookup("2banque", "server")
- logincrypt = crypto.encrypt(table, publickey)
- rednet.send(idserver, login, "superproto")
- while whilef == false do
- senderid, message, disance = rednet.receive()
- if senderid == idserver then
- mesge = textutils.unserialize(message)
- if mesge.action == "login" and mesge.user == user then
- whilef = True
- if mesge.response == "yes" then
- print("Bravo !")
- else
- print("Mauvais identifiant")
- break
- end
- end
- end
- end
- whilef = false
- end
- interfac()
Add Comment
Please, Sign In to add comment