访问&使用MobileWiFi.framework [英] Accessing & Using the MobileWiFi.framework

查看:67
本文介绍了访问&使用MobileWiFi.framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的个人项目,我正在尝试检索iPhone WiFi信号强度。我完全清楚这是在无证件善良的土地上,所以请不要回答没有Appstore的答案。 :)

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,我一直在阅读以前的WiFi网络扫描仪应用程序( WiFi Stumbler ),但我担心大多数(如果不是全部)反映过时的SDK文档。希望这个问题还能为最新的iPhone SDK 3.1.2提供一些集中/有见地的材料。

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...


异常类型:EXC_BAD_ACCESS(SIGSEGV)

Exception Type: EXC_BAD_ACCESS (SIGSEGV)

我在想动态加载调用,没有加载任何东西。目录: / System / Library / PrivateFrameworks / 仅列出没有二进制文件或别名的Info.plist文件。

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!

另外,作为跟进。要提取WiFi信息,可以通过以下方式完成:

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

GetInfoCopy = dlsym(libHandle, "Apple80211GetInfoCopy");

我的问题是1)有人有运气吗? 2)你如何得到一个标题转储,就像我在Objective-C库中使用class-dump一样(因为MobileWifi在C中)?

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)?

推荐答案

对于任何偶然发现这个问题的人来说,这是我的图书馆访问802.11网络。虽然Apple声称拒绝任何使用私有框架的应用程序,但AppStore上有几个封闭源的WiFi应用程序。使用风险由您自行承担。

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.

此库适用于iPhone SDK 3.1.2。

This library works with iPhone SDK 3.1.2.

  • SOLStumbler.h
  • SOLStumbler.m

使用:

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

结果:


信息NSDictionary的网络NSDictionary。

An networks NSDictionary of a info NSDictionary.

使用CFShow探索包含信息的返回指针。或者调用示例输出的描述方法。

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

这篇关于访问&使用MobileWiFi.framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆