控制sim卡

def control_sim(enable=True):
    if enable:
        command = "netsh interface set interface name=grantSim admin=enable"
        subprocess.run(command, shell=True)
        time.sleep(15)
    else:
        command = "netsh interface set interface name=grantSim admin=disable"
        subprocess.run(command, shell=True, capture_output=True, text=True)
        time.sleep(2)

def re_connect():
    control_sim(enable=False)
    control_sim(enable=True)

  

run as admin

posted @ 2025-07-27 20:26  CrossPython  阅读(11)  评论(0)    收藏  举报