jordan-henderson

Untitled

Nov 19th, 2013
3,984
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # FFXIV ARR Python Launcher - Python 2
  3. # Author: Jordan Henderson
  4. # This is a fairly quick and nasty implementation of a functional launcher for FFXIV.
  5. # TODO: ffxivupdate support.
  6.  
  7. # Configuration
  8. region = "3" #Region for authentication checking.
  9. username = "user"
  10. password = "pass"
  11. gamepath = "/var/FFX14" #Path containing boot and game
  12. wine = True #Prefix execution with 'wine' (for Linux/Mac)
  13.  
  14. import urllib2
  15. import urllib
  16. import re
  17. import os
  18. import hashlib
  19.  
  20. def gen_hash(file):
  21.     return str(os.stat(file).st_size) + "/" + hashlib.sha1(open(file, "rb").read()).hexdigest()
  22.  
  23. os.chdir(gamepath + "/game")
  24.  
  25. version = ""
  26. with open('ffxivgame.ver', 'r') as f:
  27.     version = f.readline()
  28.  
  29. headers = {"User-Agent":"SQEXAuthor/2.0.0(Windows 6.2; ja-jp; ecf4a84335)"}
  30. login_url = "https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/top?lng=en&rgn="+region
  31. login_info_req = urllib2.Request(login_url,
  32.                     None, headers)
  33.  
  34. login_info = urllib2.urlopen(login_info_req)
  35. cookies = login_info.headers.get('Set-Cookie')
  36. response = login_info.read()
  37.  
  38. m = re.search('<input type="hidden" name="_STORED_" value="(.*)"', response)
  39. headers = {"User-Agent":"SQEXAuthor/2.0.0(Windows 6.2; ja-jp; ecf4a84335)", "Cookie": cookies,
  40.             "Referer": login_url, "Content-Type": "application/x-www-form-urlencoded"}
  41. login_data = urllib.urlencode({'_STORED_':m.group(1), 'sqexid':username, 'password':password, 'otppw':''})
  42. login_req = urllib2.Request("https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/login.send",
  43.                             login_data, headers)
  44.  
  45. login_result = urllib2.urlopen(login_req)
  46. response = login_result.read()
  47. m = re.search('login=auth,ok,sid,(.+?),', response)
  48. if not m:
  49.     #Login failed. Abort
  50.     print("Login failed. Please try again.")
  51.     quit()
  52. sid = m.group(1)
  53.  
  54. #gamever headers
  55. headers = {"X-Hash-Check":"enabled"}
  56. #Use the patch gamever service to retrieve our *actual* sid.
  57. gamever_url = "https://patch-gamever.ffxiv.com/http/win32/ffxivneo_release_game/"+version+"/"+sid
  58.  
  59. #calculate hashes...
  60. hash_str = "ffxivboot.exe/" + gen_hash("../boot/ffxivboot.exe") + "," + "ffxivlauncher.exe/" + gen_hash("../boot/ffxivlauncher.exe") + "," + "ffxivupdater.exe/" + gen_hash("../boot/ffxivupdater.exe")
  61.  
  62. gamever_req = urllib2.Request(gamever_url, hash_str, headers)
  63.  
  64. gamever_result = urllib2.urlopen(gamever_req)
  65. actual_sid = gamever_result.info().getheader("X-Patch-Unique-Id")
  66. 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+'"')
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×