wifiutil

连接特定Wi-Fi

Posted by kunnan on May 13, 2018

前期准备

Wi-Fi的切换和控制

code

  • [%c(SpringBoard) setupwifi];//连接特定Wi-Fi
%new
 + (void) setupwifi{	
 	     NSArray* args = @[@"enable-wifi"];
        [KNnoZombieRunobjc noZombieRun:@"/usr/bin/wifiutil" withParams:args];       
        NSArray* args1 = @[@"disassociate"];
        [KNnoZombieRunobjc noZombieRun:@"/usr/bin/wifiutil" withParams:args1];        
        NSArray* args2 = @[@"associate",@"@PHICOMM_08",@"-p",@"password"];
        [KNnoZombieRunobjc noZombieRun:@"/usr/bin/wifiutil" withParams:args2];
 }

另外一种实现思路:tweak

  • AirPortSettings
    //dlopen("/System/Library/PreferenceBundles/AirPortSettings.bundle/AirPortSettings",RTLD_NOW);
    

See Also

/Users/devzkn/bin/knpost wifiutil 连接特定Wi-Fi -t iosre
#原来""的参数,需要自己加上""

转载请注明: > wifiutil