@@ -25,177 +25,177 @@ Gui, Show, , Arturo's Account Extraction Tool ;'
25
25
Return
26
26
27
27
SaveSettings :
28
- Gui , Submit , NoHide
29
- Gui , Destroy
30
- IniWrite , %winTitle%, ExtractAccount.ini, UserSettings, winTitle
31
- IniWrite , %fileName%, ExtractAccount.ini, UserSettings, fileName
32
- IniWrite , %folderPath%, ExtractAccount.ini, UserSettings, folderPath
33
-
34
- MsgBox , Settings submitted! Extracting Account. `nIt takes a few seconds. You'll get another message box telling you it's ready.
35
-
36
- adbPath := folderPath . " \MuMuPlayerGlobal-12.0\shell\adb.exe"
37
- findAdbPorts(folderPath)
38
-
39
- if (! WinExist (winTitle)) {
40
- Msgbox , 16 , , Can't find instance: %winTitle%. Make sure that instance is running.;'
41
- ExitApp
42
- }
43
-
44
- if ! FileExist (adbPath) ; if international mumu file path isn't found look for chinese domestic path
45
- adbPath := folderPath . " \MuMu Player 12\shell\adb.exe"
46
-
47
- if ! FileExist (adbPath) {
48
- MsgBox , 16 , , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
49
- ExitApp
50
- }
51
-
52
- if (! adbPorts) {
53
- Msgbox , 16 , , Invalid port... Check the common issues section in the readme/ github guide.
54
- ExitApp
55
- }
56
-
57
- RunWait , %adbPath% connect 127.0.0.1 :%adbPorts%,, Hide
58
-
59
- MaxRetries := 10
60
- RetryCount := 0
61
- Loop {
62
- try {
63
- if (! adbShell) {
64
- adbShell := ComObjCreate (" WScript.Shell" ).Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell" )
65
- ; Extract the Process ID
66
- processID := adbShell.ProcessID
67
-
68
- ; Wait for the console window to open using the process ID
69
- WinWait , ahk_pid %processID%
70
-
71
- ; Minimize the window using the process ID
72
- WinMinimize , ahk_pid %processID%
73
-
74
- adbShell.StdIn.WriteLine (" su" )
75
- }
76
- else if (adbShell.Status ! = 0 ) {
77
- Sleep , 1000
78
- }
79
- else {
80
- Sleep , 1000
81
- break
82
- }
83
- }
84
- catch {
85
- RetryCount++
86
- if (RetryCount > MaxRetries) {
87
- Msgbox , Failed to connect to the shell. Try restarting your pc/ instances and try again.
88
- ExitApp
89
- }
90
- }
91
- Sleep , 1000
92
- }
93
-
94
- saveAccount()
28
+ Gui , Submit , NoHide
29
+ Gui , Destroy
30
+ IniWrite , %winTitle%, ExtractAccount.ini, UserSettings, winTitle
31
+ IniWrite , %fileName%, ExtractAccount.ini, UserSettings, fileName
32
+ IniWrite , %folderPath%, ExtractAccount.ini, UserSettings, folderPath
33
+
34
+ MsgBox , Settings submitted! Extracting Account. `nIt takes a few seconds. You'll get another message box telling you it's ready.
35
+
36
+ adbPath := folderPath . " \MuMuPlayerGlobal-12.0\shell\adb.exe"
37
+ findAdbPorts(folderPath)
38
+
39
+ if (! WinExist (winTitle)) {
40
+ Msgbox , 16 , , Can't find instance: %winTitle%. Make sure that instance is running.;'
41
+ ExitApp
42
+ }
43
+
44
+ if ! FileExist (adbPath) ; if international mumu file path isn't found look for chinese domestic path
45
+ adbPath := folderPath . " \MuMu Player 12\shell\adb.exe"
46
+
47
+ if ! FileExist (adbPath) {
48
+ MsgBox , 16 , , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
49
+ ExitApp
50
+ }
51
+
52
+ if (! adbPorts) {
53
+ Msgbox , 16 , , Invalid port... Check the common issues section in the readme/ github guide.
54
+ ExitApp
55
+ }
56
+
57
+ RunWait , %adbPath% connect 127.0.0.1 :%adbPorts%,, Hide
58
+
59
+ MaxRetries := 10
60
+ RetryCount := 0
61
+ Loop {
62
+ try {
63
+ if (! adbShell) {
64
+ adbShell := ComObjCreate (" WScript.Shell" ).Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell" )
65
+ ; Extract the Process ID
66
+ processID := adbShell.ProcessID
67
+
68
+ ; Wait for the console window to open using the process ID
69
+ WinWait , ahk_pid %processID%
70
+
71
+ ; Minimize the window using the process ID
72
+ WinMinimize , ahk_pid %processID%
73
+
74
+ adbShell.StdIn.WriteLine (" su" )
75
+ }
76
+ else if (adbShell.Status ! = 0 ) {
77
+ Sleep , 1000
78
+ }
79
+ else {
80
+ Sleep , 1000
81
+ break
82
+ }
83
+ }
84
+ catch {
85
+ RetryCount++
86
+ if (RetryCount > MaxRetries) {
87
+ Msgbox , Failed to connect to the shell. Try restarting your pc/ instances and try again.
88
+ ExitApp
89
+ }
90
+ }
91
+ Sleep , 1000
92
+ }
93
+
94
+ saveAccount()
95
95
96
96
ExitApp
97
97
return
98
98
99
99
findAdbPorts (baseFolder := "C:\Program Files\Netease" ) {
100
- global adbPorts, winTitle
101
- ; Initialize variables
102
- adbPorts := 0 ; Create an empty associative array for adbPorts
103
- mumuFolder = %baseFolder%\MuMuPlayerGlobal- 12.0 \vms\*
104
- if ! FileExist (mumuFolder)
105
- mumuFolder = %baseFolder%\MuMu Player 12 \vms\*
106
-
107
- if ! FileExist (mumuFolder){
108
- MsgBox , 16 , , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
109
- ExitApp
110
- }
111
- ; Loop through all directories in the base folder
112
- Loop , Files, %mumuFolder%, D ; D flag to include directories only
113
- {
114
- folder := A_LoopFileFullPath
115
- configFolder := folder " \configs" ; The config folder inside each directory
116
-
117
- ; Check if config folder exists
118
- IfExist , %configFolder%
119
- {
120
- ; Define paths to vm_config.json and extra_config.json
121
- vmConfigFile := configFolder " \vm_config.json"
122
- extraConfigFile := configFolder " \extra_config.json"
123
-
124
- ; Check if vm_config.json exists and read adb host port
125
- IfExist , %vmConfigFile%
126
- {
127
- FileRead , vmConfigContent, %vmConfigFile%
128
- ; Parse the JSON for adb host port
129
- RegExMatch (vmConfigContent, " "" host_port"" :\s*"" (\d+)"" " , adbHostPort)
130
- adbPort := adbHostPort1 ; Capture the adb host port value
131
- }
132
-
133
- ; Check if extra_config.json exists and read playerName
134
- IfExist , %extraConfigFile%
135
- {
136
- FileRead , extraConfigContent, %extraConfigFile%
137
- ; Parse the JSON for playerName
138
- RegExMatch (extraConfigContent, " "" playerName"" :\s*"" (.*?)"" " , playerName)
139
- if (playerName1 = winTitle) {
140
- adbPorts := adbPort
141
- }
142
- }
143
- }
144
- }
100
+ global adbPorts, winTitle
101
+ ; Initialize variables
102
+ adbPorts := 0 ; Create an empty associative array for adbPorts
103
+ mumuFolder = %baseFolder%\MuMuPlayerGlobal- 12.0 \vms\*
104
+ if ! FileExist (mumuFolder)
105
+ mumuFolder = %baseFolder%\MuMu Player 12 \vms\*
106
+
107
+ if ! FileExist (mumuFolder){
108
+ MsgBox , 16 , , Double check your folder path! It should be the one that contains the MuMuPlayer 12 folder! `nDefault is just C:\Program Files\Netease
109
+ ExitApp
110
+ }
111
+ ; Loop through all directories in the base folder
112
+ Loop , Files, %mumuFolder%, D ; D flag to include directories only
113
+ {
114
+ folder := A_LoopFileFullPath
115
+ configFolder := folder " \configs" ; The config folder inside each directory
116
+
117
+ ; Check if config folder exists
118
+ IfExist , %configFolder%
119
+ {
120
+ ; Define paths to vm_config.json and extra_config.json
121
+ vmConfigFile := configFolder " \vm_config.json"
122
+ extraConfigFile := configFolder " \extra_config.json"
123
+
124
+ ; Check if vm_config.json exists and read adb host port
125
+ IfExist , %vmConfigFile%
126
+ {
127
+ FileRead , vmConfigContent, %vmConfigFile%
128
+ ; Parse the JSON for adb host port
129
+ RegExMatch (vmConfigContent, " "" host_port"" :\s*"" (\d+)"" " , adbHostPort)
130
+ adbPort := adbHostPort1 ; Capture the adb host port value
131
+ }
132
+
133
+ ; Check if extra_config.json exists and read playerName
134
+ IfExist , %extraConfigFile%
135
+ {
136
+ FileRead , extraConfigContent, %extraConfigFile%
137
+ ; Parse the JSON for playerName
138
+ RegExMatch (extraConfigContent, " "" playerName"" :\s*"" (.*?)"" " , playerName)
139
+ if (playerName1 = winTitle) {
140
+ adbPorts := adbPort
141
+ }
142
+ }
143
+ }
144
+ }
145
145
}
146
146
147
147
saveAccount () {
148
- global adbShell, adbPath, adbPorts, fileName
149
- if (! adbShell) {
150
- adbShell := ComObjCreate (" WScript.Shell" ).Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell" )
151
- ; Extract the Process ID
152
- processID := adbShell.ProcessID
148
+ global adbShell, adbPath, adbPorts, fileName
149
+ if (! adbShell) {
150
+ adbShell := ComObjCreate (" WScript.Shell" ).Exec(adbPath . " -s 127.0.0.1:" . adbPorts . " shell" )
151
+ ; Extract the Process ID
152
+ processID := adbShell.ProcessID
153
153
154
- ; Wait for the console window to open using the process ID
155
- WinWait , ahk_pid %processID%
154
+ ; Wait for the console window to open using the process ID
155
+ WinWait , ahk_pid %processID%
156
156
157
- ; Minimize the window using the process ID
158
- WinMinimize , ahk_pid %processID%
159
- }
157
+ ; Minimize the window using the process ID
158
+ WinMinimize , ahk_pid %processID%
159
+ }
160
160
161
- saveDir := A_ScriptDir " \" . fileName . " .xml"
161
+ saveDir := A_ScriptDir " \" . fileName . " .xml"
162
162
163
- if (FileExist (saveDir)) {
164
- MsgBox , 16 , , File already exists! Delete it or input a different name then try again!
165
- ExitApp
166
- }
163
+ if (FileExist (saveDir)) {
164
+ MsgBox , 16 , , File already exists! Delete it or input a different name then try again!
165
+ ExitApp
166
+ }
167
167
168
- count := 0
168
+ count := 0
169
169
170
- Loop {
170
+ Loop {
171
171
172
- adbShell.StdIn.WriteLine (" rm /sdcard/deviceAccount.xml" )
172
+ adbShell.StdIn.WriteLine (" rm /sdcard/deviceAccount.xml" )
173
173
174
- Sleep , 500
174
+ Sleep , 500
175
175
176
- adbShell.StdIn.WriteLine (" cp /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml /sdcard/deviceAccount.xml" )
176
+ adbShell.StdIn.WriteLine (" cp /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml /sdcard/deviceAccount.xml" )
177
177
178
- Sleep , 500
178
+ Sleep , 500
179
179
180
- RunWait , % adbPath . " -s 127.0.0.1:" . adbPorts . " pull /sdcard/deviceAccount.xml "" " . saveDir,, Hide
180
+ RunWait , % adbPath . " -s 127.0.0.1:" . adbPorts . " pull /sdcard/deviceAccount.xml "" " . saveDir,, Hide
181
181
182
- Sleep , 500
182
+ Sleep , 500
183
183
184
- FileGetSize , OutputVar, %saveDir%
184
+ FileGetSize , OutputVar, %saveDir%
185
185
186
- if (OutputVar > 0 )
187
- break
186
+ if (OutputVar > 0 )
187
+ break
188
188
189
- if (count > 10 ) {
190
- MsgBox , 16 , , Tried 10 times. Failed to extract account.
191
- ExitApp
192
- }
193
- count ++
194
- }
189
+ if (count > 10 ) {
190
+ MsgBox , 16 , , Tried 10 times. Failed to extract account.
191
+ ExitApp
192
+ }
193
+ count ++
194
+ }
195
195
196
- adbShell.StdIn.WriteLine (" am force-stop jp.pokemon.pokemontcgp" )
196
+ adbShell.StdIn.WriteLine (" am force-stop jp.pokemon.pokemontcgp" )
197
197
198
- adbShell.StdIn.WriteLine (" rm /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml" ) ; delete account data
198
+ adbShell.StdIn.WriteLine (" rm /data/data/jp.pokemon.pokemontcgp/shared_prefs/deviceAccount:.xml" ) ; delete account data
199
199
200
- MsgBox , Success! Extracted account '%fileName%.xml' to the Accounts folder, closed the game, and deleted the local save from the instance.
200
+ MsgBox , Success! Extracted account '%fileName%.xml' to the Accounts folder, closed the game, and deleted the local save from the instance.
201
201
}
0 commit comments