Skip to content

Commit cd408b0

Browse files
authored
Merge pull request #18 from fa0311/develop
v3.1
2 parents 2bec4b3 + f5f25fc commit cd408b0

File tree

2 files changed

+70
-28
lines changed

2 files changed

+70
-28
lines changed

DMMGamePlayerFastLauncher.py

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import json
66
import glob
77
import win32crypt
8+
import random
9+
import hashlib
810

911
requests.packages.urllib3.disable_warnings()
1012

@@ -24,26 +26,22 @@
2426
argpar.add_argument("--non-kill", action="store_true")
2527
argpar.add_argument("--debug", action="store_true")
2628
argpar.add_argument("--login-force", action="store_true")
29+
argpar.add_argument("--anonymous", action="store_true")
2730
arg = argpar.parse_args()
2831

29-
headers = {
30-
"Host": "apidgp-gameplayer.games.dmm.com",
31-
"Connection": "keep-alive",
32-
"User-Agent": "DMMGamePlayer5-Win/17.1.2 Electron/17.1.2",
33-
"Client-App": "DMMGamePlayer5",
34-
"Client-version": "17.1.2",
35-
}
3632

37-
params = {
38-
"product_id": arg.product_id,
39-
"game_type": "GCL",
40-
"game_os": "win",
41-
"launch_type": "LIB",
42-
"mac_address": "00:11:22:33:44:55",
43-
"hdd_serial": "0000000011111111222222223333333344444444555555556666666677777777",
44-
"motherboard": "0000000011111111222222223333333344444444555555556666666677777777",
45-
"user_os": "win",
46-
}
33+
def gen_rand_hex():
34+
return hashlib.sha256(str(random.random()).encode()).hexdigest()
35+
36+
37+
def gen_rand_address():
38+
hex = gen_rand_hex()
39+
address = ""
40+
for x in range(12):
41+
address += hex[x]
42+
if x % 2 == 1:
43+
address += ":"
44+
return address[:-1]
4745

4846

4947
class dgp5_process:
@@ -66,6 +64,16 @@ def get_install_data(self):
6664
return install_data
6765
self._end_stdout()
6866

67+
def get_client_data(self):
68+
for line in self.process.stdout:
69+
text = self._decode(line)
70+
if (
71+
"https://apidgp-gameplayer.games.dmm.com/v5/gameplayer/agreement/check"
72+
in text
73+
):
74+
return self._req_body_to_dict(text)
75+
self._end_stdout()
76+
6977
def get_cookie(self):
7078
for line in self.process.stdout:
7179
text = self._decode(line)
@@ -81,6 +89,9 @@ def wait(self):
8189
def kill(self):
8290
self.process.terminate()
8391

92+
def _req_body_to_dict(self, line):
93+
return json.loads(line.split(" :: Request body is ")[1][:-1])
94+
8495
def _decode(self, line):
8596
text = line.decode("utf-8").strip()
8697
if self.debug:
@@ -91,6 +102,30 @@ def _end_stdout(self):
91102
raise Exception("DMMGamePlayerの実行中にエラーが発生しました\n既に実行されているか実行中に終了した可能性があります")
92103

93104

105+
headers = {
106+
"Host": "apidgp-gameplayer.games.dmm.com",
107+
"Connection": "keep-alive",
108+
"User-Agent": "DMMGamePlayer5-Win/17.1.2 Electron/17.1.2",
109+
"Client-App": "DMMGamePlayer5",
110+
"Client-version": "17.1.2",
111+
}
112+
113+
params = {
114+
"product_id": arg.product_id,
115+
"game_type": "GCL",
116+
"game_os": "win",
117+
"launch_type": "LIB",
118+
}
119+
120+
if arg.anonymous:
121+
client_data = {
122+
"mac_address": gen_rand_address(),
123+
"hdd_serial": gen_rand_hex(),
124+
"motherboard": gen_rand_hex(),
125+
"user_os": "win",
126+
}
127+
128+
94129
open("cookie.bytes", "a+")
95130
with open("cookie.bytes", "rb") as f:
96131
blob = f.read()
@@ -99,6 +134,9 @@ def _end_stdout(self):
99134
process.debug = arg.debug
100135
install_data = process.get_install_data()
101136

137+
if not arg.anonymous:
138+
client_data = process.get_client_data()[0]
139+
102140
if blob == b"" or arg.login_force:
103141
cookie = process.get_cookie()
104142
new_blob = win32crypt.CryptProtectData(cookie.encode(), "DMMGamePlayerFastLauncher")
@@ -107,8 +145,6 @@ def _end_stdout(self):
107145
else:
108146
_, cookie = win32crypt.CryptUnprotectData(blob)
109147

110-
headers["cookie"] = cookie
111-
112148
if not arg.game_path:
113149
for contents in install_data["contents"]:
114150
if contents["productId"] == arg.product_id:
@@ -137,6 +173,11 @@ def _end_stdout(self):
137173
+ " ".join([contents["productId"] for contents in install_data["contents"]])
138174
+ "から選択して下さい"
139175
)
176+
177+
headers["cookie"] = cookie
178+
params.update(client_data)
179+
print(params)
180+
140181
response = requests.post(
141182
"https://apidgp-gameplayer.games.dmm.com/v5/launch/cl",
142183
headers=headers,
@@ -156,4 +197,4 @@ def _end_stdout(self):
156197
if arg.non_kill:
157198
process.wait()
158199
else:
159-
process.kill()
200+
process.kill()

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ DMM Game Player のゲームを高速かつセキュアに起動できるラン
2424
## 引数
2525
`DMMGamePlayerFastLauncher.exe <product_id>`
2626

27-
| オプション | エイリアス | デフォルト | 備考 | タイプ |
28-
|----------------------|------------|--------------------------------------------------|-----------------------------------|--------|
29-
| --help | -h | False | | bool |
30-
| --game-path | | False | Falseにすると自動 | |
31-
| --dmmgameplayer-path | -dgp-path | C:/Program Files/DMMGamePlayer/DMMGamePlayer.exe | | |
32-
| --non-kill | | False | DMMGamePlayerが起動したままになる | bool |
33-
| --debug | | False | デバッグモード | bool |
34-
| --login-force | | False | ログインを強制する | bool |
27+
| オプション | エイリアス | デフォルト | 備考 | タイプ |
28+
|----------------------|------------|--------------------------------------------------|-----------------------------------------|--------|
29+
| --help | -h | False | | bool |
30+
| --game-path | | False | Falseにすると自動 | |
31+
| --dmmgameplayer-path | -dgp-path | C:/Program Files/DMMGamePlayer/DMMGamePlayer.exe | | |
32+
| --non-kill | | False | DMMGamePlayerが起動したままになる | bool |
33+
| --debug | | False | デバッグモード | bool |
34+
| --login-force | | False | ログインを強制する | bool |
35+
| --anonymous | | False | ハードウェアの情報をDMMに送信しなくなる | bool |
3536

3637
## ヘルプ
3738

0 commit comments

Comments
 (0)