Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing & Using the MobileWiFi.framework

For a personal project of mine, I'm trying to retrieve iPhone WiFi signal strength. I'm fully aware that this in the land of undocumented goodness, so please refrain from the "No Appstore" answers. :)

Anywho, I've been reading up on previous WiFi Network Scanner Apps (WiFi Stumbler), but I'm afraid most (if not all) reflect outdated SDK documentation. Hopefully, this question will also provide some centralized / insightful material with the most recent iPhone SDK 3.1.2.

Here's my incomplete/not-working code:

.h

 void *libHandle;
 void *airportHandle; 
 int (*open)(void *);
 int (*bind)(void *, NSString *);
 int (*close)(void *);
 int (*scan)(void *, NSArray **, void *);

.m

libHandle = dlopen("/System/Library/PrivateFrameworks/MobileWiFi.framework/MobileWiFi",RTLD_LAZY);

open = dlsym(libHandle, "Apple80211Open");
bind = dlsym(libHandle, "Apple80211BindToInterface");
close = dlsym(libHandle, "Apple80211Close");
scan = dlsym(libHandle, "Apple80211Scan");

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

NSLog(@"Result %@",libHandle);

When executed on the device, it'll produce my ever-so-favorite...

Exception Type: EXC_BAD_ACCESS (SIGSEGV)

I'm thinking the dynamic loading call, isn't loading anything. The directory: /System/Library/PrivateFrameworks/ only lists a Info.plist file with no binaries or aliases.

Probably doing something terribly wrong (wrong directory?)... appreciate any help!

Also, as a follow up. To extract the WiFi information, it might be done by:

GetInfoCopy = dlsym(libHandle, "Apple80211GetInfoCopy");

And my questions are 1) Has anybody had any luck with this? 2) How do you get a header dump like I would using with class-dump on Objective-C libraries (because MobileWifi is in C)?

like image 930
Rev316 Avatar asked Jan 07 '10 03:01

Rev316


People also ask

Is accessing a real word?

n. 1. A means of approaching, entering, exiting, communicating with, or making use of: a store with easy access.

What is the synonym of accessing?

nounentering or allowing entry. acceptance. access. admittance.

What is a sentence for accessing?

That necklace will absorb new magic and prevent him from accessing the depths of his current store. A wireless card for accessing the Internet without wires. How do we prevent an attacker from accessing a level below our security mechanisms and thereby circumventing them?

What does access to someone mean?

1a : permission, liberty, or ability to enter, approach, or pass to and from a place or to approach or communicate with a person or thing Investigators wanted to get access to his home. consultants who have easy access to the president.


1 Answers

For anybody who stumbles upon this question, here's my library to access 802.11 networks. Although Apple claims to deny any applications that use private frameworks, there are several closed-sourced WiFi applications on the AppStore. Use at your own risk.

This library works with iPhone SDK 3.1.2.

  • SOLStumbler.h
  • SOLStumbler.m

Use:

SOLStumbler *networksManager = [[SOLStumbler alloc] init];
[networksManager scanNetworks];

Result:

An networks NSDictionary of a info NSDictionary.

Use CFShow to explore the returned pointer containing information. Or call the description method for sample output.

like image 167
Rev316 Avatar answered Nov 15 '22 20:11

Rev316