Last active
December 27, 2020 00:39
-
-
Save gitFurious/28134b27414297681e29 to your computer and use it in GitHub Desktop.
This file contains 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
__author__ = 'Damon Pollard (@DamonLPollard)' | |
import re | |
import random | |
import json | |
import requests | |
WLID_USERNAME = "user@example.com" | |
WLID_PASSWORD = "password" | |
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) ' \ | |
'AppleWebKit/537.36 (KHTML, like Gecko) ' \ | |
'Chrome/38.0.2125.104 Safari/537.36' | |
R_PPFT = "<input type=\"hidden\" name=\"PPFT\" id=\"i0327\" value=\"(.+?)\"\/>" | |
R_PPSX = "L:'(.+?)'" | |
R_URLPOST = "urlPost:'(.+?)'" | |
s = requests.Session() | |
oauth20_authorize = "https://login.live.com/oauth20_authorize.srf?client_id=000000004C0BD2F1&scope=xbox.basic+xbox.of" \ | |
"fline_access&response_type=code&redirect_uri=https:%2f%2fwww.halowaypoint.com%2fauth%2fcallback&" \ | |
"locale=en-us&display=touch&state=https%253a%252f%252fwww.halowaypoint.com%252fen-us%252fgames%25" \ | |
"2fhalo-the-master-chief-collection%252fxbox-one%252fgame-history%253fgamertags%253dfuriousn00b%2" \ | |
"526view%253dDataOnly" | |
print oauth20_authorize | |
response_one = s.get(oauth20_authorize, | |
headers={ | |
'user-agent': USER_AGENT, | |
'host': 'login.live.com' | |
}, | |
verify=False | |
) | |
ppft = re.search(R_PPFT, response_one.text).group(1) | |
ppsx = re.search(R_PPSX, response_one.text).group(1) | |
post = re.search(R_URLPOST, response_one.text).group(1) | |
print post | |
response_two = s.post(post, | |
data={ | |
'PPFT': ppft, | |
'login': WLID_USERNAME, | |
'passwd': WLID_PASSWORD, | |
'LoginOptions': '3', | |
'NewUser': '1', | |
'PPSX': ppsx, | |
'type': '11', | |
'i3': random.randrange(5000, 10000), | |
'm1': '1920', | |
'm2': '1080', | |
'm3': '0', | |
'i12': '1', | |
'i17': '0', | |
'i18': '__MobileLogin|1,', | |
}, | |
headers={ | |
'user-agent': USER_AGENT, | |
'referer': oauth20_authorize, | |
'host': 'login.live.com', | |
'origin': 'https://login.live.com' | |
}, | |
verify=False, | |
allow_redirects=False | |
) | |
callback_url = response_two.headers['Location'] | |
print callback_url | |
response_three = s.get(callback_url, | |
headers={ | |
'user-agent': USER_AGENT, | |
'referer': oauth20_authorize, | |
'host': 'www.halowaypoint.com' | |
}, | |
verify=False, | |
allow_redirects=False | |
) | |
endpoint = response_three.headers['Location'] | |
print endpoint | |
response_four = s.get(endpoint, | |
headers={ | |
'user-agent': USER_AGENT, | |
'referer': oauth20_authorize, | |
'host': 'www.halowaypoint.com' | |
}, | |
verify=False, | |
allow_redirects=False | |
) | |
data = response_four.json() | |
print json.dumps(data) | |
# https://login.live.com/oauth20_authorize.srf?client_id=000000004C0BD2F1&scope=xbox.basic+xbox.offline_access&response_type=code&redirect_uri=https:%2f%2fwww.halowaypoint.com%2fauth%2fcallback&locale=en-us&display=touch&state=https%253a%252f%252fwww.halowaypoint.com%252fen-us%252fgames%252fhalo-the-master-chief-collection%252fxbox-one%252fgame-history%253fgamertags%253dfuriousn00b%2526view%253dDataOnly | |
# https://login.live.com/ppsecure/post.srf?client_id=000000004C0BD2F1&scope=xbox.basic+xbox.offline_access&response_type=code&redirect_uri=https:%2f%2fwww.halowaypoint.com%2fauth%2fcallback&locale=en-us&display=touch&state=https%253a%252f%252fwww.halowaypoint.com%252fen-us%252fgames%252fhalo-the-master-chief-collection%252fxbox-one%252fgame-history%253fgamertags%253dfuriousn00b%2526view%253dDataOnly&bk=1415661432&uaid=60aa214faf704e93898e04ab217cc080 | |
# https://www.halowaypoint.com/auth/callback?code=a5d3b42b-4010-f773-cfe7-b829ed854fc1&state=https%253a%252f%252fwww.halowaypoint.com%252fen-us%252fgames%252fhalo-the-master-chief-collection%252fxbox-one%252fgame-history%253fgamertags%253dfuriousn00b%2526view%253dDataOnly | |
# https://www.halowaypoint.com/en-us/games/halo-the-master-chief-collection/xbox-one/game-history?gamertags=furiousn00b&view=DataOnly | |
# [{"Gamertag": "Furiousn00b", "TotalMultiplayerGamesCompleted": null, "Stats": []}] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works for me, hella nice! I made a Node.js version for anyone who wants it: https://gist.github.com/almic/3795edc0e0143ef02fc400634313930f