· 3 months ago · Jun 16, 2025, 04:00 PM
1local tempPullEvent = os.pullEvent
2os.pullEvent = os.pullEventRaw
3local Correct = false
4local md5 = require("/lib/md5")
5shell.run("clear")
6
7while not Correct do
8 print("Username:")
9 username = io.read()
10 print("Password:")
11 password = io.read()
12 usernameCorrect = true
13 if not fs.exists("/etc/passwd/"..username) or username == "" then
14 shell.run("clear")
15 print("Wrong username or password, try again.")
16 usernameCorrect = false
17 end
18 if usernameCorrect == true then
19 passhash = tostring(md5.digest(password))
20 passfile = fs.open("/etc/passwd/"..username, "rb")
21 if passhash == passfile.readAll() then
22 shell.run("cd /home/"..username)
23 shell.run("clear")
24 print("Welcome, "..username.."!")
25 passfile.close()
26 Correct = true
27 else
28 passfile.close()
29 shell.run("clear")
30 print("Wrong username or password, try again.")
31 end
32 end
33end
34
35os.pullEvent = tempPullEvent