SHOW:
|
|
- or go back to the newest paste.
| 1 | print("Connection a RedNet...")
| |
| 2 | rednet.open("top")
| |
| 3 | ||
| 4 | --Variable(s)-- | |
| 5 | ||
| 6 | print("En attente de requetes...")
| |
| 7 | local senderIP, request = rednet.receive() | |
| 8 | local senderIPcard, dataKey = rednet.receive() | |
| 9 | --local logsFile = fs.open("disk/Logs.txt", "w")
| |
| 10 | ||
| 11 | --Fonction(s)-- | |
| 12 | ||
| 13 | function writeInfo() | |
| 14 | ||
| 15 | print("--> Requete recu: ", os.day(), " ", os.time())
| |
| 16 | print(" >>IPSource: ", senderIP)
| |
| 17 | print(" >>AccessID: ", dataKey)
| |
| 18 | print(" >>RequestLevel: ", request)
| |
| 19 | ||
| 20 | end | |
| 21 | ||
| 22 | --Protocole-- | |
| 23 | ||
| 24 | writeInfo() | |
| 25 | accessList = fs.open(request, "r") | |
| 26 | ||
| 27 | for i = 1, 20 do | |
| 28 | ||
| 29 | if accessList.readLine(i) == dataKey then | |
| 30 | ||
| 31 | rednet.send(senderIP, "AccessGranted") | |
| 32 | print(i, " ID Match!") | |
| 33 | print("--Access Granted--")
| |
| 34 | break | |
| 35 | ||
| 36 | else | |
| 37 | ||
| 38 | print(i, " ID doesn't match...") | |
| 39 | ||
| 40 | end | |
| 41 | ||
| 42 | end | |
| 43 | ||
| 44 | --New Instance/End Of Program-- | |
| 45 | rednet.close("top")
| |
| 46 | shell.openTab("security.exe")
| |
| 47 | sleep(120) | |
| 48 | shell.exit() |