Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PORT = 42690
- REPLY = 42691
- SLOT = "back"
- print("")
- print("------------")
- print("IP-L0CC v0.1")
- print("------------")
- print(" client ")
- print("------------")
- print("")
- while true do
- tcp = peripheral.wrap(SLOT)
- if not tcp then
- print("ERROR: Modem not found at "..SLOT)
- break
- end
- if not auth then
- tcp.transmit(PORT,REPLY,"!AUTH")
- tcp.open(42691)
- local event,modemSide,senderChannel,
- replyChannel,message,senderDistance
- = os.pullEvent("modem_message")
- if message == "!IPL0CCYO!" then
- auth=true
- print("STATUS: Authenticated with server")
- break
- end
- end
- end
- while true do
- print("")
- print("Enter username:")
- userinput = read()
- tcp.transmit(PORT,REPLY,"USER="..userinput)
- local event,modemSize,senderChannel,
- replyChannel,message,senderDistance
- = os.pullEvent("modem_message")
- if message ~= "!YES" then
- print("Username does not exist")
- else
- user=userinput
- break
- end
- end
- while true do
- print("")
- print("Enter password:")
- passinput = read("*")
- tcp.transmit(PORT,REPLY,"PASS="..passinput)
- local event,modemSide,senderChannel,
- replyChannel,message,senderDistance
- = os.pullEvent("modem_message")
- if message ~= "!!YES" then
- print("Password is incorrect")
- else
- term.clear()
- print("Authentication successful")
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement