-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemu_control.py
66 lines (54 loc) · 3.48 KB
/
memu_control.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import subprocess
import config
import re
import time
CREATE_NO_WINDOW = 0x08000000
def create_memu(path):
cer_path = config.sett_folder + '\\bin\\' + 'c8750f0d.0'
result = subprocess.run([path, "create"],
shell=True, stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
text = result.stdout.decode('utf-8')
index = re.findall(r'([\d]+)', text)[0]
st = subprocess.run([path, "setconfigex", "-i", index, "is_customed_resolution", "1"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
sw = subprocess.run([path, "setconfigex", "-i", index, "resolution_width", "720"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
sh = subprocess.run([path, "setconfigex", "-i", index, "resolution_height", "1280"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
time.sleep(2)
subprocess.run([path, "start", "-i", index], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
subprocess.run([path, "-i", index, "adb", "shell", "input", "keyevent", "3"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
time.sleep(10)
subprocess.run([path, "-i", index, "adb", "shell", "input", "keyevent", "3"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
time.sleep(10)
# input('set cấu hinh: ')
subprocess.run([path, "-i", index, "adb", "root"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
subprocess.run([path, "-i", index, "adb", "remount"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
subprocess.run([path, "-i", index, "adb", "push", cer_path, "/sdcard/"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
subprocess.run([path, "-i", index, "adb", "shell", "mv", "/sdcard/c8750f0d.0", "/system/etc/security/cacerts/"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
subprocess.run([path, "-i", index, "adb", "shell", "chmod", "644", "/system/etc/security/cacerts/c8750f0d.0"], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
config.memu_index = str(index)
def add_proxy(path, index, proxy):
subprocess.run([path, "-i", index, "adb", "shell", "settings", "put", "global", "http_proxy", proxy], stdout =subprocess.PIPE,
stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
# subprocess.call([path, "-i", index, "adb", "install", "-r", "tiktok.apk"],stdout=subprocess.PIPE,stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL)
# memuc setconfigex -i 20 resolution_width 720
# memuc setconfigex -i 20 resolution_height 1280
# memuc start -i 20
# memuc -i 20 adb root
# adb remount
# adb push 9a5ba575.0 /sdcard/
# adb shell mv /sdcard/9a5ba575.0 /system/etc/security/cacerts/
# adb shell chmod 644 /system/etc/security/cacerts/9a5ba575.0
# adb shell settings put global http_proxy 192.168.1.19:8082
# adb install -r tiktok.apk
# adb shell input keyevent 82