ios hook开发打开 关闭wifi的操作
主要是hook SpringBoard
首先得到hook wifi的头文件
根据头文件进行找到 setWiFiEnabled 代表wifi的开关
1、判断wifi是否开启
[[SBWiFiManager sharedInstance ] wiFiEnabled]
2、开启或关闭wifi
[[SBWiFiManager sharedInstance ] setWiFiEnabled: YES] //打开
[[SBWiFiManager sharedInstance ] setWiFiEnabled: NO] //关闭
3、得到当前链接Wi-Fi 的名称
[[SBWiFiManager sharedInstance ] currentNetworkName]
头文件如下:
/** This header is generated by classdump-dyld 0.7* on Friday, November 7, 2014 at 1:51:21 AM Eastern European Standard Time* Operating System: Version 8.1 (Build 12B411)* Image Source: /System/Library/CoreServices/SpringBoard.app/SpringBoard* classdump-dyld is licensed under GPLv3, Copyright © 2013-2014 by Elias Limneos.*/@protocol OS_dispatch_source;
#import@class NSRecursiveLock, NSString, NSObject;
@interface SBWiFiManager : NSObject {
NSRecursiveLock* _lock;
WiFiManagerClientRef _manager;
WiFiDeviceClientRef _device;
NSString* _deviceInterfaceName;
BOOL _devicePresent;
WiFiNetworkRef _currentNetwork;
WiFiNetworkRef _previousNetwork;
BOOL _currentNetworkHasBeenSet;
BOOL _currentNetworkIsIOSHotspot;
BOOL _currentNetworkIsIOSHotspotHasBeenSet;
BOOL _powered;
BOOL _poweredHasBeenSet;
int _rssiThreshold;
int _signalStrengthBars;
int _signalStrengthRSSI;
BOOL _signalStrengthHasBeenSet;
SCDynamicStoreRef _SCDynamicStoreNetworkState;
NSObject*_SCUpdateTimeoutSource;
WiFiNetworkRef _primaryInterface;
BOOL _primaryInterfaceHasBeenSet;
BOOL _isPrimaryInterface;
BOOL _isPrimaryInterfaceChanging;
int linkToken;
int powerToken;
}
+(id)sharedInstance;
-(void)updateSignalStrength;
-(BOOL)isPowered;
-(BOOL)isPrimaryInterface;
-(BOOL)isAssociated;
-(id)currentNetworkName;
-(int)signalStrengthBars;
-(BOOL)wiFiEnabled;
-(WiFiManagerClientRef)_manager;
-(void)_linkDidChange;
-(void)_powerStateDidChange;
-(void)_updateWiFiDevice:(id)arg1 ;
-(void)updateDevicePresence;
-(void)_setWiFiDevice:(WiFiDeviceClientRef)arg1 ;
-(void)_updateCurrentNetwork;
-(void)_updateWiFiState;
-(void)_primaryInterfaceChanged:(BOOL)arg1 ;
-(BOOL)_cachedIsAssociated;
-(void)updateSignalStrengthFromRawRSSI:(int)arg1 andScaledRSSI:(float)arg2 ;
-(BOOL)wifiSupported;
-(BOOL)devicePresent;
-(BOOL)isAssociatedToIOSHotspot;
-(int)signalStrengthRSSI;
-(void)resetSettings;
-(id)_wifiInterface;
-(void)_setPrimaryInterfaceHasBeenSet;
-(id)init;
-(id)knownNetworks;
-(void)setPowered:(BOOL)arg1 ;
-(void)setWiFiEnabled:(BOOL)arg1 ;
@end