configure_client.bat 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. @ECHO OFF
  2. TITLE configure_client
  3. ECHO Configuring Zwift client to use zoffline
  4. ECHO.
  5. NET SESSION >nul 2>&1 || ( PowerShell start -verb runas '"%~0"' & EXIT /B )
  6. CD /D "%~dp0"
  7. SET HOSTS="%WINDIR%\system32\drivers\etc\hosts"
  8. COPY %HOSTS% %HOSTS%.bak >nul
  9. TYPE %HOSTS%.bak | FINDSTR /V /I zwift > %HOSTS%
  10. ECHO Adding servers to hosts file
  11. ECHO 127.0.0.1 us-or-rly101.zwift.com secure.zwift.com cdn.zwift.com launcher.zwift.com>>%HOSTS%
  12. ECHO.
  13. certutil.exe -store Root | FIND /C /I "54f7f293407370a07679885767e5bd599458e471" >nul 2>&1
  14. IF %ERRORLEVEL% NEQ 0 (
  15. ECHO Importing certificate
  16. (
  17. ECHO -----BEGIN CERTIFICATE-----
  18. ECHO MIIK/QIBAzCCCsMGCSqGSIb3DQEHAaCCCrQEggqwMIIKrDCCBOcGCSqGSIb3DQEH
  19. ECHO BqCCBNgwggTUAgEAMIIEzQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIY6PJ
  20. ECHO vb+86aMCAggAgIIEoCQbnzNfXivoA8tNaMbaHobG3XMGstm7ouyZIvk0Ohd/j//N
  21. ECHO bT/QaGXKT/961E9WOewkprtpAmZOP7LGF52INGlGI4hi4Nz385vXURIag0Dcpi+u
  22. ECHO 12LTF0HIv2Lnma8y9zljjQfN7g23b5plxgXu/JWeT421/agArsnE6zB5p/m8HjPB
  23. ECHO IaaaN8ird5IKAEfYY7dRyEFmr+7QuEqorK4ebjpaXbK4/C79Imtmg1rdv31uUb9C
  24. ECHO bSOfsXSfu5kloL1e1onAaSrokNPQ2zr14xU8QYhhXYG+0/NphrqJOV8uomisx18K
  25. ECHO AJ1nZJE8BlwpnISzQeHEJ21js+QOWJrusDFI9AO6+wP2ojPRv+UI5dZYN19McO7b
  26. ECHO PqNS8DJ6zTfQgSOTs/3D1Gh9prIciC915ifJoEbCCrwHFhUXcp/3K+pQEHODqhFb
  27. ECHO EJ5xzvJjgpEMAxdYxmfqctTZSZyUb0SqAwMYfIXnWTWXIuow1Ffmmy/qCI49sZIo
  28. ECHO MyaE9VCpXTOFxEp/BeIeor5PBd/MqNPGaJwGo7ZuUdBgengHqOJzCbQ0JDF8HSmL
  29. ECHO hi78eHoC6qf6vkYNYM0cBvuX46mCHbVaMdWQwKcVwhVHLKcxjyvT/B0kpWVWiGX8
  30. ECHO Ol86k9+VO/kMzZkCGA2r01T0SVj04SZJ1jizqRZKEuUOF1pm9mRuHhgKAfNNMcKi
  31. ECHO UvQ71HWCKMEKu1I9gau++GHCgztC6rGnKLNOIUaix9o7To1EKBVA352pJTJ5weav
  32. ECHO HonRB0oroxdMfPQ/LanbYvsxpgkiwq/9mxsPTNfZZGuPgOyptXu6AYGVbUN47Wwf
  33. ECHO jzHFnHcTyuyZMOsCZ/3SgICwQCNNc8sbamAu1e60KVsc8H4ttpAgxcEL4ssz1qPG
  34. ECHO xFBqWJQm5HshzZ+3mYPz/G5b1BcvniMsWDZQcm5TlpyNVd+LvCPSEFER8SBXl0P6
  35. ECHO E6aUyVqLCdoR3oaQSyTgIxKRSbOM0PNX2m5kquWusbfdl+QdsK1iuY0hEd6hqXQ4
  36. ECHO +Sa1xXhKUCWgzol8FcQduLriw6SpnBk/toqRSzcDZzqNSQAuOKIm6qlvmwn4FLYT
  37. ECHO UlRuwAzB4qX04hdtSR15LUANVWI9Dp85FaZjIoa+Fdf55kQuBlgBKJ50kzDSwJxa
  38. ECHO y2EsLS5L+3cqhb/7Px2yDgCpbEDB0/ildwhJiHd6Co/JbQMCpIsN70qHrFuvlmSy
  39. ECHO XTx46Fg5uixNCZnoH88h7irDTtdOBL84D32WIZPSQBVHv+ffOmqudJm9kC/k2OHV
  40. ECHO vy3FXsxC+6swOro25A02pEcKRmfStRfxpiq8/RsftpsWlFdCsZ8gOtfhDKfS8fSN
  41. ECHO OGo1MUWGAbL2OQfsAKNGQzNRdjxJENMc7fyZJYOrYw9gmDJSZqU5II9Y8yabgHWS
  42. ECHO T14jRZXemBkoo1AtE9cAq0wUv0hWz8QAVzwXYBw87zhxMtIeZHZIbNKLKyTEW9AK
  43. ECHO EX3wBHLbvN09ikZ6OBWFxKPw2SyJE3wsJcNXbQihNZJCZCslOLxrrSikC03XI1mT
  44. ECHO mwgnlmqFuOXDr6Vt4ec2Z0a8FZLZK6rlmmo9SI6wPjGZtkNVU8NA40yQO904MIIF
  45. ECHO vQYJKoZIhvcNAQcBoIIFrgSCBaowggWmMIIFogYLKoZIhvcNAQwKAQKgggTuMIIE
  46. ECHO 6jAcBgoqhkiG9w0BDAEDMA4ECMiTbXZ/qCvdAgIIAASCBMh+f1Rq5A8s910Bjhhz
  47. ECHO MQaBM9Q9KOwkJL2+slx9h3BCxBENRqVgIhCTKsibpuDecbFHJakJ1RY7msjZaHAR
  48. ECHO e6Ib4Tso0MgVXRNBMarSLSEb1ePLcm1nfk3o5Z8lKtlZ10097URcvan1SrYBASgz
  49. ECHO EFcj8Sv6vD27YkC2snbGLxr9aTMg6slvFLHrQ9lVWnK77jejNc/8ZF1FgwpD1l5I
  50. ECHO sQbosEL/4xCX8GGUxAulIzn8LuZCCqZwJHpsBOApXfpRJOejeq6qGCDkmgrJm3AL
  51. ECHO 5PI4IJBS5diNtht+jii4Ht4s/mVb+f9p6ENVOwqfgJADA3cw0H8uvFdhVAZjp3nw
  52. ECHO VAeKkZc/D0ExvQrjqMUK5c8q9lhql0E+2Pu9C694NxP8dl9jK44z8EIPpUw54rou
  53. ECHO CaCzqqB6mYgWzwNoHQrhfDYaiB0bSjt+DV5Yb3WN40Y6I9/sxen/BF37SjYh3A86
  54. ECHO XxhaEy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K7Fkhu4amEO
  69. ECHO yC9WRAPjqwNSpBqwLGzp8xsNWzknip9lcHjjsjyrbaAhOTtSiNA9DsHGi0adtxoo
  70. ECHO oWNv3bw2WdyCPhewhDLbAVUVL2dFhLznoaz0G89+kNKQVsIem7ANxKZjqAzpN2p5
  71. ECHO 9oxVpMA0b3o/S51L40WhBoU6VygvX0ThQ/tdnFc4GJBTsGIEChf1U/bafHlAN4m3
  72. ECHO dV3JZLnMwr3yRtAxgaAwIwYJKoZIhvcNAQkVMRYEFJ/4v2OquLIbakW67GEqbbZT
  73. ECHO HN6IMHkGCSsGAQQBgjcRATFsHmoATQBpAGMAcgBvAHMAbwBmAHQAIABFAG4AaABh
  74. ECHO AG4AYwBlAGQAIABSAFMAQQAgAGEAbgBkACAAQQBFAFMAIABDAHIAeQBwAHQAbwBn
  75. ECHO AHIAYQBwAGgAaQBjACAAUAByAG8AdgBpAGQAZQByMDEwITAJBgUrDgMCGgUABBRY
  76. ECHO wC0BH1M4q6B4EMZNfhWa1kz8PAQIaQoA0Y9lFm4CAggA
  77. ECHO -----END CERTIFICATE-----
  78. )>cert-zwift-com.tmp
  79. certutil.exe -decode cert-zwift-com.tmp cert-zwift-com.p12 >nul
  80. DEL cert-zwift-com.tmp
  81. ECHO.|certutil.exe -importpfx Root cert-zwift-com.p12
  82. DEL cert-zwift-com.p12
  83. ) ELSE ( ECHO Certificate found in root store, no changes will be made )
  84. ECHO.
  85. SET ZWIFT=zwift_location.txt
  86. IF EXIST %ZWIFT% ( SET /P FOLDER=<%ZWIFT%
  87. ) ELSE ( SET FOLDER="%SystemDrive%\Program Files (x86)\Zwift")
  88. SET CACERT=%FOLDER%\data\cacert.pem
  89. IF EXIST %CACERT% GOTO:FOUND
  90. :NOT_FOUND
  91. SET COMMAND="(new-object -COM 'Shell.Application').BrowseForFolder(0,'Please locate Zwift folder',0,0).self.path"
  92. FOR /F "usebackq delims=" %%I IN (`PowerShell %COMMAND%`) DO SET FOLDER="%%I"
  93. SET CACERT=%FOLDER%\data\cacert.pem
  94. IF NOT EXIST %CACERT% GOTO:NOT_FOUND
  95. ECHO %FOLDER%>%ZWIFT%
  96. :FOUND
  97. >nul 2>&1 FIND /C "MIIEQTCCAymgAwIBAgIUVPfyk0BzcKB2eYhXZ+W9WZRY5HEwDQYJKoZIhvcNAQEL" %CACERT%
  98. IF %ERRORLEVEL% NEQ 0 (
  99. ECHO Adding certificate to cacert.pem
  100. (
  101. ECHO.
  102. ECHO -----BEGIN PRIVATE KEY-----
  103. ECHO MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDmmdIPj0YJfQfU
  104. ECHO Hi1ox3X4XvbkZV09dYJ65+jcOlajD+yLLC7FEsRr4l3poIpHpElCXMN33xVPAP8s
  105. ECHO oLMw14Z86BzKFxh3mHMldSTQoSNUEvPmZsmOOj306Y2B9kDZYm5i1enOZAzrljPb
  106. ECHO QwZ80/7QlilnPRfv7xP4eUzqpjjUtwbVu/0TylX5X6LniGuylNfk5wn+Fxsck5C4
  107. ECHO PKUc6VdeOnhVYAN6wwQxbXnQeg5T4FZN6z0tuhtXDQinNtd3F+NMazGup6YZxi5C
  108. ECHO +KU+6MXIqyh16iOwyN0UDrj2jiIchV62uJ11mLW6n9zSXH002Z5pn5DGGtA116WT
  109. ECHO G2FtbxnjAgMBAAECggEAMXYi2VWI1zYrPLMwWD4YLqrn1/tp8WnID+a4Sqx0sssS
  110. ECHO mJNkgL7SxLUsIZVes5koYYSWJJsD7gsvsHnTlZFU9muu6SXlCJn5cLpcqCc39auP
  111. ECHO BwdbChex/FswEAUqybXUKXzqhmttXga8nrYUqSeriz/6J3uyK7OjG/OgrN/0ZqNn
  112. ECHO J6c4SMXoWQeC+Ap5netzzjDgxUtQ5U6TlHvafkM/LGLZO2Vm4qynpT2Wb9be+gNW
  113. ECHO 7AcUCFzqIwlKBY6KWaFkmZ2QfG1uUm9aQATHn/5vabQYbTONbJTMl+4ApY+dGjDJ
  114. ECHO ss+ISCyYDc/UdJgeGDwZfhhf1L0kvUHc0eVwZ6V5WQKBgQD0NHeOaun5cm1YarNK
  115. ECHO g9VuKcPHJ2lCqJcHFWzekiN0iegKTIiNsdD86h5iUz0keK64LOCcRknsFBaqhlyM
  116. ECHO 7Tk5wguGHpjIQcelxzCBwyhi2NjV/cI3j+pps3jYrvPVFP9aqDhCfTmc1e+9MIZH
  117. ECHO AsWEBZH652mlo+1w2CMJ6pjTBwKBgQDxvSR0MjTTET9mFhfO8z/PP6/yNn0STMSz
  118. ECHO +g4rNqiTYQYvWIrIxg7jUAcuHlBLQPj2cs+7MYrDr84ee1FJiKd+x5RtXtDFCsF+
  119. ECHO Yza+cyLnVRY7D+UluqlcXOCtwCPujSTN9ReQdoHN6K2tqA3/2IwDVNlNJiebCY3M
  120. ECHO kIhMfdS/RQKBgCgik1+pvKiNoOD+MFdX0XUYkh+iH4+gC6pTYCA4XnFh1OwUZgD7
  121. ECHO r4BRrgq06YCcAQMuBQBKIQ4Wwx7llEJpHpWaibBSSQPoo7pgQV2iSHnub7zDxu7A
  122. ECHO zWLv5zWdk1964vjwWsa6tARNuOgcGIWFNBcdnz9gVyGtDnIUY7XWg6VzAoGBAMiv
  123. ECHO VD8emxoKfI58kuFcscGVRrUXJTf3AWnEktSvOL25U5Akunq5agyuGHfh9Ji05Lp8
  124. ECHO UBZAp8mS/tPxXmdkimDGwWMWzsx2BHKvXPg4z2YrDhyUMpDi6Mzj0iaMl4foJwDQ
  125. ECHO kvJ8X4CYxO6g0JZwqLPvUcMphMHB6bVE29JcuCzdAoGBALY0epEYNARqmhYdILrd
  126. ECHO eK2e0c24dsY7XiLnMxGUY7RhLp4pTpy6bvlI2GN84DB/yTMTrxGE7e+om5LTW5at
  127. ECHO UANwOx+nZ9oDF43mMDqgT22Q+KBgr19Ei4jT+/zzn3GXaNWGaTO08tKCa+pw2g5E
  128. ECHO NUacoS2LNYc1/oucAs94qgBT
  129. ECHO -----END PRIVATE KEY-----
  130. ECHO -----BEGIN CERTIFICATE-----
  131. ECHO MIIEQTCCAymgAwIBAgIUVPfyk0BzcKB2eYhXZ+W9WZRY5HEwDQYJKoZIhvcNAQEL
  132. ECHO BQAweTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRMwEQYDVQQHDApMb25nIEJl
  133. ECHO YWNoMQ4wDAYDVQQKDAVad2lmdDEUMBIGA1UEAwwLKi56d2lmdC5jb20xIjAgBgkq
  134. ECHO hkiG9w0BCQEWE3dlYm1hc3RlckB6d2lmdC5jb20wHhcNMjIwMTEyMjIwMDI5WhcN
  135. ECHO MzIwMTEwMjIwMDI5WjB5MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExEzARBgNV
  136. ECHO BAcMCkxvbmcgQmVhY2gxDjAMBgNVBAoMBVp3aWZ0MRQwEgYDVQQDDAsqLnp3aWZ0
  137. ECHO LmNvbTEiMCAGCSqGSIb3DQEJARYTd2VibWFzdGVyQHp3aWZ0LmNvbTCCASIwDQYJ
  138. ECHO KoZIhvcNAQEBBQADggEPADCCAQoCggEBAOaZ0g+PRgl9B9QeLWjHdfhe9uRlXT11
  139. ECHO gnrn6Nw6VqMP7IssLsUSxGviXemgikekSUJcw3ffFU8A/yygszDXhnzoHMoXGHeY
  140. ECHO cyV1JNChI1QS8+ZmyY46PfTpjYH2QNlibmLV6c5kDOuWM9tDBnzT/tCWKWc9F+/v
  141. ECHO E/h5TOqmONS3BtW7/RPKVflfoueIa7KU1+TnCf4XGxyTkLg8pRzpV146eFVgA3rD
  142. ECHO BDFtedB6DlPgVk3rPS26G1cNCKc213cX40xrMa6nphnGLkL4pT7oxcirKHXqI7DI
  143. ECHO 3RQOuPaOIhyFXra4nXWYtbqf3NJcfTTZnmmfkMYa0DXXpZMbYW1vGeMCAwEAAaOB
  144. ECHO wDCBvTAdBgNVHQ4EFgQUilrTM6VVDhGPOMkGaiBRBpanbYYwHwYDVR0jBBgwFoAU
  145. ECHO ilrTM6VVDhGPOMkGaiBRBpanbYYwCQYDVR0TBAIwADALBgNVHQ8EBAMCBeAwHQYD
  146. ECHO VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMDMBYGA1UdEQQPMA2CCyouendpZnQu
  147. ECHO Y29tMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0
  148. ECHO ZTANBgkqhkiG9w0BAQsFAAOCAQEA0B5lBps3UfixLFUWchEOOgU/bIl6AVr7bfgY
  149. ECHO tqJBv4r6aJi7OhLNx4iz+QszJpU5gePnYWJEvvuLo8FQMB9/4ZbD/Z5kM31I6khB
  150. ECHO OO6SvpGIjr8I576/ICCv8kv3A9pbjwgdIwkcHssjG03+hLU9j7Z1meep2pHRAYOe
  151. ECHO tajt/3ZS2isijJZHPPl5O0ObiE2n5G4+IHbaWhVR4lk85YuKrhrTeBBOHAX4YIhv
  152. ECHO ScDddr3aEIPguMwvbMDiBPnRewAFNCiUVpe9XuLX7thIbz23UxA8mB2lG4U9URd6
  153. ECHO CqZGFc8ss1RMWFYOZfjDam37wbQAw55h8QxsSu3jijMSy/75Sg==
  154. ECHO -----END CERTIFICATE-----
  155. )>>%CACERT%
  156. ) ELSE ( ECHO Certificate found in cacert.pem, no changes will be made )
  157. ECHO.
  158. TASKKILL /F /IM ZwiftLauncher.exe >nul 2>&1
  159. PAUSE