Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # FFXIV ARR Python Launcher - Python 2
- # Author: Jordan Henderson
- # This is a fairly quick and nasty implementation of a functional launcher for FFXIV.
- # TODO: ffxivupdate support.
- # Configuration
- region = "3" #Region for authentication checking.
- username = "user"
- password = "pass"
- gamepath = "/var/FFX14" #Path containing boot and game
- wine = True #Prefix execution with 'wine' (for Linux/Mac)
- import urllib2
- import urllib
- import re
- import os
- import hashlib
- def gen_hash(file):
- return str(os.stat(file).st_size) + "/" + hashlib.sha1(open(file, "rb").read()).hexdigest()
- os.chdir(gamepath + "/game")
- version = ""
- with open('ffxivgame.ver', 'r') as f:
- version = f.readline()
- headers = {"User-Agent":"SQEXAuthor/2.0.0(Windows 6.2; ja-jp; ecf4a84335)"}
- login_url = "https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/top?lng=en&rgn="+region
- login_info_req = urllib2.Request(login_url,
- None, headers)
- login_info = urllib2.urlopen(login_info_req)
- cookies = login_info.headers.get('Set-Cookie')
- response = login_info.read()
- m = re.search('<input type="hidden" name="_STORED_" value="(.*)"', response)
- headers = {"User-Agent":"SQEXAuthor/2.0.0(Windows 6.2; ja-jp; ecf4a84335)", "Cookie": cookies,
- "Referer": login_url, "Content-Type": "application/x-www-form-urlencoded"}
- login_data = urllib.urlencode({'_STORED_':m.group(1), 'sqexid':username, 'password':password, 'otppw':''})
- login_req = urllib2.Request("https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/login.send",
- login_data, headers)
- login_result = urllib2.urlopen(login_req)
- response = login_result.read()
- m = re.search('login=auth,ok,sid,(.+?),', response)
- if not m:
- #Login failed. Abort
- print("Login failed. Please try again.")
- quit()
- sid = m.group(1)
- #gamever headers
- headers = {"X-Hash-Check":"enabled"}
- #Use the patch gamever service to retrieve our *actual* sid.
- gamever_url = "https://patch-gamever.ffxiv.com/http/win32/ffxivneo_release_game/"+version+"/"+sid
- #calculate hashes...
- hash_str = "ffxivboot.exe/" + gen_hash("../boot/ffxivboot.exe") + "," + "ffxivlauncher.exe/" + gen_hash("../boot/ffxivlauncher.exe") + "," + "ffxivupdater.exe/" + gen_hash("../boot/ffxivupdater.exe")
- gamever_req = urllib2.Request(gamever_url, hash_str, headers)
- gamever_result = urllib2.urlopen(gamever_req)
- actual_sid = gamever_result.info().getheader("X-Patch-Unique-Id")
- os.system(('wine' if wine else '') + ' ffxiv.exe "DEV.TestSID='+ actual_sid + '" "DEV.UseSqPack=1" "DEV.DataPathType=1" "DEV.LobbyHost01=neolobby01.ffxiv.com" "DEV.LobbyPort01=54994" "DEV.LobbyHost02=neolobby02.ffxiv.com" "DEV.LobbyPort02=54994" "SYS.Region=3" "language=1" "ver='+version+'"')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement