Slide 17
Slide 17 text
toggle_proxy.py
import subprocess
filepath, line_number = "lib/system/http/dio_provider.dart", 22
with open(filepath, "r+") as file:
lines = file.readlines()
line_content = lines[line_number].strip()
if line_content == ": null,":
lines[line_number] = " : Constants.of().proxyUrl,\n"
state = "ON"
elif line_content == ": Constants.of().proxyUrl,":
lines[line_number] = " : null,\n"
state = "OFF"
file.seek(0)
file.writelines(lines)
file.truncate()
is_proxyman_running = bool(subprocess.run(["pgrep", "Proxyman"], capture_output=True).stdout)
if state == "ON" and not is_proxyman_running:
subprocess.run(["open", "-a", "Proxyman"])
elif state == "OFF" and is_proxyman_running:
subprocess.run(["pkill", "Proxyman"])
print(f"Proxy is now {state}")
ࢦఆͨ͠ϑΝΠϧͷ
ࢦఆߦΛॻ͖͑
1SPYZNBO͕ىಈ͍ͯ͠
ͳ͔ͬͨΒىಈ͢Δ