How to prevent ios system from being caught

How to prevent ios system from being caught

We know that ios system can get API s sent by APP, parameters transferred, etc. through the capture tools such as [fiddler][6], [charles][6], so what can we do to prevent this after going online?

We all know about packet-grabbing operation. We need the mobile phone and the package-grabbing tool on the same network segment, then set up an agent, and then we can do the operation you want to grab the package. Then the next thing is relatively simple. We can check if our network is under the proxy network, and then refuse to send any requests if it is under the proxy network at this time.

Then how to detect whether there is a proxy Here are several ways to detect a proxy

first:

The following code, if the proxy has a value, can tell that the current wifi uses http proxy.:

#import <SystemConfiguration/CaptiveNetwork.h>

- (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, there are other WiFi information available 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 methods are more convenient:

- (BOOL) checkProxySetting {
    NSDictionary *proxySettings = (__bridge NSDictionary *)(CFNetworkCopySystemProxySettings());
    NSArray *proxies = (__bridge NSArray *)(CFNetworkCopyProxiesForURL((__bridge CFURLRef _Nonnull)([NSURL URLWithString:@"https://www.baidu.com"]), (__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 set");
        return NO;
    }
    else
    {

        NSLog(@"Proxy set");
        return YES;
    }

}

Tags: network iOS Mobile

Posted on Wed, 03 Jun 2020 09:19:44 -0700 by rorobobo