如何在没有私人图书馆的iOS中获得Wi-Fi加密模式?如何在iOS/iPhone/iPad上获得WiFi加密模式?
回答
从上面原本已经本网站上公布的答案代码:http://www.codeproject.com/Articles/621213/Non-Standard-Way-to-Get-Inaccessible-Data-from-iOS
顺便说一句,对于此代码的工作,你需要包括适当的头文件与#include <mach/mach.h>
,以便您的编译器识别NDR_record_t ndr
。
但是,这整个设置实际上没有返回当前WiFi的加密模式,而是AirPort的配置(上面的代码中的变量key
需要设置为NSString *key = @"Setup:/Network/Interface/en0/AirPort";
之前)。我尝试了不同的值,而不是机场,我在我的Mac的终端运行$scutil
了(如Setup:/Network/Interface/en0/IPv4
或Setup:/Network/Interface/en0/Modem
或this website)
希望帮助别人有类似的问题...
对于iOS 5:
aslmsg asl, message;
aslresponse searchResult;
int i;
const char *key, *val;
NSMutableArray *result_dicts = [NSMutableArray array];
asl = asl_new(ASL_TYPE_QUERY);
if (!asl)
{
DDLogCError(@"Failed creating ASL query");
}
asl_set_query(asl, "Sender", "kernel", ASL_QUERY_OP_EQUAL);
asl_set_query(asl, "Message", "AppleBCMWLAN Joined BSS:", ASL_QUERY_OP_PREFIX|ASL_QUERY_OP_EQUAL);
searchResult = asl_search(NULL, asl);
while (NULL != (message = aslresponse_next(searchResult)))
{
NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
for (i = 0; (NULL != (key = asl_key(message, i))); i++)
{
NSString *keyString = [NSString stringWithUTF8String:(char *)key];
val = asl_get(message, key);
NSString *string = [NSString stringWithUTF8String:val];
[tmpDict setObject:string forKey:keyString];
}
[result_dicts addObject:tmpDict];
}
aslresponse_free(searchResult);
asl_free(asl);
对于iOS 6:
#define kMachPortConfigd "com.apple.SystemConfiguration.configd"
-(NSDictionary *)getSCdata:(NSString *)key
{
if(SYSTEM_VERSION_LESS_THAN(@"6.0"))
{
// It does not work on iOS 5.*
return nil;
}
struct send_body {mach_msg_header_t header; int count; UInt8 *addr; CFIndex size0; int flags; NDR_record_t ndr; CFIndex size; int retB; int rcB; int f24; int f28;};
mach_port_t bootstrapport = MACH_PORT_NULL;
mach_port_t configport = MACH_PORT_NULL;
mach_msg_header_t *msg;
mach_msg_return_t msg_return;
struct send_body send_msg;
// Make request
CFDataRef extRepr;
extRepr = CFStringCreateExternalRepresentation(NULL, (__bridge CFStringRef)(key), kCFStringEncodingUTF8, 0);
// Connect to Mach MIG port of configd
task_get_bootstrap_port(mach_task_self(), &bootstrapport);
bootstrap_look_up2(bootstrapport, kMachPortConfigd, &configport, 0, 8LL);
// Make request
send_msg.count = 1;
send_msg.addr = (UInt8*)CFDataGetBytePtr(extRepr);
send_msg.size0 = CFDataGetLength(extRepr);
send_msg.size = CFDataGetLength(extRepr);
send_msg.flags = 0x1000100u;
send_msg.ndr = NDR_record;
// Make message header
msg = &(send_msg.header);
msg->msgh_bits = 0x80001513u;
msg->msgh_remote_port = configport;
msg->msgh_local_port = mig_get_reply_port();
msg->msgh_id = 20010;
// Request server
msg_return = mach_msg(msg, 3, 0x34u, 0x44u, msg->msgh_local_port, 0, 0);
if(msg_return)
{
if (msg_return - 0x10000002u >= 2 && msg_return != 0x10000010)
{
mig_dealloc_reply_port(msg->msgh_local_port);
}
else
{
mig_put_reply_port(msg->msgh_local_port);
}
}
else if (msg->msgh_id != 71 && msg->msgh_id == 20110 && msg->msgh_bits <= -1)
{
if ((send_msg.flags & 0xFF000000) == 0x1000000)
{
CFDataRef deserializedData = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, send_msg.addr,send_msg.size0, kCFAllocatorNull);
CFPropertyListRef proplist = CFPropertyListCreateWithData(kCFAllocatorDefault, deserializedData, kCFPropertyListImmutable, NULL, NULL);
mig_dealloc_reply_port(msg->msgh_local_port);
mach_port_deallocate(mach_task_self(), bootstrapport);
mach_port_deallocate(mach_task_self(), configport);
mach_msg_destroy(msg);
NSDictionary *property_list = (__bridge NSDictionary*)proplist;
if(proplist)
CFRelease(proplist);
CFRelease(deserializedData);
CFRelease(extRepr);
return property_list;
}
}
mig_dealloc_reply_port(msg->msgh_local_port);
mach_port_deallocate(mach_task_self(), bootstrapport);
mach_port_deallocate(mach_task_self(), configport);
mach_msg_destroy(msg);
CFRelease(extRepr);
return nil;
}
有谁知道这段代码将通过苹果的审查过程? –
有没有办法得到这个OS X的信息 –
@isox @chris \ conway我得到:隐式声明的bootstrap_look_up2不允许在C99中...它是什么修复? –
- 1. Android:如何获得当前的Wifi加密?
- 2. 如何获得wifi标准
- 3. 如何在ios上以编程方式获得wifi或3G上网速度
- 4. 如何检查iPhone上的wifi密码
- 5. 获取iDevices上的wifi网络密码
- 6. 如何获得加密方案UUID
- 7. 如何获得加密的资源包?
- 8. 如何在iPhone上获取Wifi的RSSI?
- 9. 如何获得像模模式的窦
- 10. 如何获得android上的wifi连接速率?
- 11. NFC切换WIFI +加密
- 12. 26模在山上密码加密
- 13. 谷歌家庭应用如何在Android上自动获取wifi密码?
- 14. 如何获得CSS的调试模式?
- 15. Bootstrap模式如何从url获得'id'
- 16. 如何获得nstagramApi直播模式?
- 17. 如何获得数组中的模式
- 18. 如何获得重复模式
- 19. Android - 获取IP,如果WiFi已经在AP模式下运行
- 20. Android获得wifi活动
- 21. 如何才能解密PHP中的加密模式ECB和填充模式PKCS7
- 22. 如何获得追加模式中的sprintf()
- 23. 如何获得在Facebook上
- 24. 在iPhone上添加wifi ssid和密码到iPhone的钥匙串
- 25. 如何获得laravel上的Bootstrap模式数据5
- 26. Raspberry PI - RT2870(内核模块mt7601Usta)WiFi SUB加密狗 - 充当WiFi接入点
- 27. 如何获得仅针对特定模式的空白模式
- 28. 如何获得在iPhone WiFi和蜂窝datausage?
- 29. iOS如何在我的手机周围获得wifi列表?
- 30. 如何在android中获得当前的wifi连接信息
除了mach.h之外,我还需要包括什么**我隐式声明函数'bootstrap_look_up2'在C99中无效** –