How to prevent the ios system from being caught?
We know that the ios system can obtain the API sent by the APP and the parameters transmitted through packet capture tools such as [fiddler][6], [charles][6]. So how can we prevent the situation after it is launched?
We all have a general understanding of the operation of packet capture. We need the mobile phone and packet capture tool to be in the same network segment, and then set up a proxy, and then you can perform the operation of packet capture. Then the next thing we need to do is relatively simple. We can check whether our network is under the proxy network. If it is under the proxy network at this time, we refuse to send any request.
So how to detect whether there is a proxy? The following provide several methods to detect a proxy
first:
In the following code, if proxy has a value, you can judge that the current wifi uses http proxy.
#import <SystemConfiguration/> - (id)fetchHttpProxy { CFDictionaryRef dicRef = CFNetworkCopySystemProxySettings(); const CFStringRef proxyCFstr = (const CFStringRef)CFDictionaryGetValue(dicRef, (const void*)kCFNetworkProxiesHTTPProxy); NSString* proxy = (__bridge NSString *)proxyCFstr; return proxy; }
second:
In addition, some other WiFi information can also be obtained through code, such as: ssid, broadcast address, subnet mask, port, etc.
- (id)fetchSSIDInfo { NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); NSLog(@"Supported interfaces: %@", ifs); id info = nil; for (NSString *ifnam in ifs) { info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam); NSLog(@"%@ => %@", ifnam, info); if (info && [info count]) { break; } } return info; }
three:
The following method is more convenient:
- (BOOL) checkProxySetting { NSDictionary *proxySettings = (__bridge NSDictionary *)(CFNetworkCopySystemProxySettings()); NSArray *proxies = (__bridge NSArray *)(CFNetworkCopyProxiesForURL((__bridge CFURLRef _Nonnull)([NSURL URLWithString:@""]), (__bridge CFDictionaryRef _Nonnull)(proxySettings))); NSLog(@"\n%@",proxies); NSDictionary *settings = proxies[0]; NSLog(@"%@",[settings objectForKey:(NSString *)kCFProxyHostNameKey]); NSLog(@"%@",[settings objectForKey:(NSString *)kCFProxyPortNumberKey]); NSLog(@"%@",[settings objectForKey:(NSString *)kCFProxyTypeKey]); if ([[settings objectForKey:(NSString *)kCFProxyTypeKey] isEqualToString:@"kCFProxyTypeNone"]) { NSLog(@"No proxy is set"); return NO; } else { NSLog(@"Proxy set"); return YES; } }
How to prevent the ios system from being caught? The method to prevent the ios system from being caught is all the content I share with you. I hope you can give you a reference and I hope you can support me more.