WiFiManager.bundle WiFiManager returns NULL when I try to load by using dlopen, iOS

StackOverflow https://stackoverflow.com/questions/23245276

  •  08-07-2023
  •  | 
  •  

Question

For private usage I try to load WiFi Manager (iOS 6.1) by using following code:

    airportHandle = 0;
    libHandle = 0;

    libHandle = dlopen(
                       "/System/Library/SystemConfiguration/WiFiManager.bundle/WiFiManager"
                       //"/System/Library/SystemConfiguration/IPConfiguration.bundle/IPConfifuration"
                       , RTLD_LAZY);

    if(libHandle != 0)
    {
        disassociate    = (int (*)())dlsym(libHandle,   "Apple80211Disassociate");
        open            = (int (*)(void*))dlsym(libHandle,  "Apple80211Open");
        bind            = (int (*)(void*, NSString*))dlsym(libHandle,   "Apple80211BindToInterface");
        close           = (int (*)(void*))dlsym(libHandle,  "Apple80211Close");
        scan            = (int (*)(void*, NSArray**, void*))dlsym(libHandle,    "Apple80211Scan");
        associate       = (int (*)(void*, void*, NSString*))dlsym(libHandle,    "Apple80211Associate");
        info            = (int (*)(void*, NSDictionary**))dlsym(libHandle,  "Apple80211GetInfoCopy");
        GetPower        = (int (*)(void*, char*))dlsym(libHandle,   "Apple80211GetPower");
        SetPower        = (int (*)(void*, char))dlsym(libHandle,    "Apple80211SetPower");
        listinfo        = (int (*)(void*, NSDictionary**))dlsym(libHandle,  "Apple80211GetIfListCopy");

        open(&airportHandle);
        bind(airportHandle, @"en0");
    }

However libHandle is NULL.

Do I need to use jailbreak device or there is no way to stay with Private API only.

Thanks,

Était-ce utile?

La solution

This is not a answer, but rather a directions to look.

As I remember, Apple moved WiFi API's around (from one framework to another) several times. So, most likely this path ("/System/Library/SystemConfiguration/WiFiManager.bundle/WiFiManager") is obsolete.

You should be able to use dlopen and get a handle even on non jailbroken iOS device. So, this is not a problem. However, I am not sure whether these API's which you mentioned are not protected by entitlement.

If you have iOS 6 simulator, I would recommend to go there and try to grepr and find where these API's live.

BTW. Look at this question. He claims that his code works on iOS 6 - Iphone 802.11 Scan

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top