local status = "Please login first."
local x,y = term.getSize()
function connect()
while true do
term.clear()
term.setCursorPos(1,1)
print(status.. "n")
print("Minecraft Username: ")
write("Minecraft Password: ")
test = string.len("Minecraft Password: *")
term.setCursorPos(test, 3)
user = read()
term.setCursorPos(test, 4)
pass = read()
http.request("http://login.minecraft.net/?user=" ..user.. "&password=" ..pass.. "&version=12")
local event, url, response = os.pullEvent()
if event == "http_success" then
_sResponse = { response.readAll() }
if string.find(tostring(_sResponse[1]), "deprecated") then
term.setCursorPos(1, y-1)
textutils.slowPrint("Logging in...")
sleep(0.5)
break
else
status = tostring(_sResponse[1])
end
else
status = ("Unable to connect to minecraft.net")
end
response.close()
end
end
connect()
First, it asks for your username
Then, it asks for your password
It connects to http://login.minecraft.net/?user=<USER>&password=<PASS>&version=12
(from the wiki)
And it prints whatever is inside that page.
If it doesn't exist, the page returns "Bad login" and it prints that.
If it does exist, but the password is wrong, it prints it again.
If it does exist, but the account is migrated, it prints "Account migrated. Use email to login."
If it exists, it will return <random number>:"deprecated":<your username>:<a session id(?)>
Since we can't find out the random number, username, and session id, we just search for "deprecated" (I haven't testing on non-migrated accounts. It still logs in if your not premium)