Last active
May 19, 2020 07:31
-
-
Save jenrik/5149944 to your computer and use it in GitHub Desktop.
[DEPRECATED] Minecraft login script for Python 3. Use as you wish as long as you give me credit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client, urllib.parse, getpass | |
username = input("Username: ") | |
password = getpass.getpass(prompt='Password: ', stream=None) | |
params = urllib.parse.urlencode({'user': username, 'password': password, 'version': 12}) | |
headers = {"Content-type": "application/x-www-form-urlencoded"} | |
conn = http.client.HTTPConnection("login.minecraft.net") | |
conn.request("POST", "", params, headers) | |
response = conn.getresponse() | |
print(response.status, response.reason) | |
data = response.read() | |
data = data.decode("utf-8").split(':') | |
print("Current minecraft version: " + data[0]) | |
print("Minecraft username: " + data[2]) | |
print("Session ID: " + data[3]) | |
print("UID: " + data[4]) | |
conn.close() |
@shai The login protocol has changed since I posted this script 7 years ago. Try taking a look at https://wiki.vg/Authentication and the other pages on that wiki
@jenrik yea I thought so, and thought you might want to update the code :)
I abandoned this scripts years ago, and I have no intention of updating it. If anybody needs a script to login to Minecraft you should read https://wiki.vg/Authentication and do your own implementation instead of trying to fix this crappy script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you make this work and also post it with a fixed indentation?