tweaselORG / appstraction

An abstraction layer for common instrumentation functions (e.g. installing and starting apps, setting preferences, etc.) on Android and iOS.
MIT License
4 stars 1 forks source link

`setProxy()` function for Android and iOS #25

Closed baltpeter closed 1 year ago

baltpeter commented 1 year ago

The function should be able to set the device's proxy configuration but also disable the proxy.

baltpeter commented 1 year ago

On Android, there are a few settings related to this that can be set through adb (https://stackoverflow.com/a/73358866, https://stackoverflow.com/a/47476009):

adb shell settings put global http_proxy 192.168.225.100:3128
adb shell settings put global global_http_proxy_host 192.168.225.100
adb shell settings put global global_http_proxy_port 3128
adb shell settings put global global_http_proxy_username foo
adb shell settings put global global_http_proxy_password bar

adb shell settings delete global http_proxy
adb shell settings delete global global_http_proxy_host
adb shell settings delete global global_http_proxy_port
adb shell settings delete global global_http_proxy_username
adb shell settings delete global global_http_proxy_password
adb shell settings delete global global_http_proxy_exclusion_list
adb shell settings delete global global_proxy_pac_url

The interesting question will be which of these we actually need.

baltpeter commented 1 year ago

However, the Android emulator also seems to have its own proxy mechanism independent of that. If I start an emulator with -http-proxy 127.0.0.1:8080, none of these settings is set:

generic_x86_64_arm64:/ # settings get global http_proxy
null
generic_x86_64_arm64:/ # settings get global global_http_proxy_host
null
generic_x86_64_arm64:/ # settings get global global_http_proxy_port
null
generic_x86_64_arm64:/ # settings get global global_http_proxy_username
null
generic_x86_64_arm64:/ # settings get global global_http_proxy_password
null
generic_x86_64_arm64:/ # settings get global global_http_proxy_exclusion_list
null
generic_x86_64_arm64:/ # settings get global global_proxy_pac_url
null

It seems preferable to use this mechanism instead of the on-device settings. However, we need to be able to change this dynamically at runtime and not just through the emulator start command line.

In the graphical "extended controls" of the emulator, there is also a proxy setting (Might be different yet? Also shows "no proxy" despite the command line argument):

image

That can be set at runtime. Unfortunately, I haven't found a programmatic way to do that.

baltpeter commented 1 year ago

The interesting question will be which of these we actually need.

Proxy Toggle sets http_proxy, global_http_proxy_host, and global_http_proxy_port.

We should also set those three. global_http_proxy_username and global_http_proxy_password are obviously only needed when the proxy requires authentication (not the case for us). We don't want to exclude hosts from proxying (so we don't need global_http_proxy_exclusion_list). And we don't care about proxy auto configuration (so we don't need global_proxy_pac_url).

baltpeter commented 1 year ago

I haven't tested this yet but seems like we could also use the HTTP Toolkit app (which currently uses a VPN and supports only proxying individual apps):

https://github.com/httptoolkit/httptoolkit-server/blob/9658bef164fb5cfce13b2c4b1bedacc158767f57/src/interceptors/android/android-adb-interceptor.ts#L113C5-L117

baltpeter commented 1 year ago

I think we'll use the settings method for now, but should keep https://github.com/tweaselORG/meta/issues/19 in mind.

baltpeter commented 1 year ago

Doing settings delete global http_proxy is not enough to clear the proxy (without a restart). Instead, it should be set to :0—that applies immediately (see https://stackoverflow.com/a/47476009/3211062).

baltpeter commented 1 year ago

I didn't find any information on how to set the proxy programmatically on iOS, so I turned to frida-trace.

I had no idea what the responsible class is, but *etwork* (to match both an upper- and lower-case n) seemed like a good guess:

frida-trace -U -m "*[*etwork* *]" Preferences

Here's the output from disabling the proxy through the Settings app:

           /* TID 0x103 */
 89692 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 89692 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 89692 ms  -[WFNetworkSettingsConfig httpProxyAuthenticationRequired]
 89692 ms  -[WFNetworkSettingsConfig setHttpProxyConfig:0x0]
 89693 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 89693 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 89693 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 89693 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 89705 ms  -[WFNetworkSettingsConfig isEqual:0x1029e2240]
 89706 ms     | -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x1029e2240]
 89706 ms     |    | -[WFNetworkSettingsConfig ssid]
 89706 ms     |    | -[WFNetworkSettingsConfig ssid]
 89706 ms     |    | -[WFNetworkSettingsConfig current]
 89706 ms     |    | -[WFNetworkSettingsConfig current]
 89706 ms     |    | -[WFNetworkSettingsConfig forgetable]
 89706 ms     |    | -[WFNetworkSettingsConfig forgetable]
 89706 ms     |    | -[WFNetworkSettingsConfig joinable]
 89706 ms     |    | -[WFNetworkSettingsConfig joinable]
 89706 ms     |    | -[WFNetworkSettingsConfig manageable]
 89706 ms     |    | -[WFNetworkSettingsConfig manageable]
 89706 ms     |    | -[WFNetworkSettingsConfig cloudSyncable]
 89706 ms     |    | -[WFNetworkSettingsConfig cloudSyncable]
 89706 ms     |    | -[WFNetworkSettingsConfig canRenewLease]
 89706 ms     |    | -[WFNetworkSettingsConfig canRenewLease]
 89706 ms     |    | -[WFNetworkSettingsConfig autoJoinConfigurable]
 89706 ms     |    | -[WFNetworkSettingsConfig autoJoinConfigurable]
 89706 ms     |    | -[WFNetworkSettingsConfig autoJoinEnabled]
 89706 ms     |    | -[WFNetworkSettingsConfig autoJoinEnabled]
 89706 ms     |    | -[WFNetworkSettingsConfig autoLoginConfigurable]
 89706 ms     |    | -[WFNetworkSettingsConfig autoLoginConfigurable]
 89706 ms     |    | -[WFNetworkSettingsConfig autoLoginEnabled]
 89706 ms     |    | -[WFNetworkSettingsConfig autoLoginEnabled]
 89706 ms     |    | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 89706 ms     |    | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 89707 ms     |    | -[WFNetworkSettingsConfig isInSaveDataMode]
 89707 ms     |    | -[WFNetworkSettingsConfig isInSaveDataMode]
 89707 ms     |    | -[WFNetworkSettingsConfig privacyProxyTierStatus]
 89707 ms     |    | -[WFNetworkSettingsConfig privacyProxyTierStatus]
 89707 ms     |    | -[WFNetworkSettingsConfig privacyProxyEnabled]
 89707 ms     |    | -[WFNetworkSettingsConfig privacyProxyEnabled]
 89707 ms     |    | -[WFNetworkSettingsConfig wifiOutrankEnabled]
 89707 ms     |    | -[WFNetworkSettingsConfig wifiOutrankEnabled]
 89707 ms     |    | -[WFNetworkSettingsConfig networkQualityVisible]
 89707 ms     |    | -[WFNetworkSettingsConfig networkQualityVisible]
 89707 ms     |    | -[WFNetworkSettingsConfig networkQualityResponsiveness]
 89707 ms     |    | -[WFNetworkSettingsConfig networkQualityResponsiveness]
 89707 ms     |    | -[WFNetworkSettingsConfig networkQualityDate]
 89707 ms     |    | -[WFNetworkSettingsConfig networkQualityDate]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4Address]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4Address]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4Address]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4AddressManual]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4AddressManual]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4SubnetMask]
 89707 ms     |    | -[WFNetworkSettingsConfig ipv4SubnetMask]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4SubnetMask]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4SubnetMaskManual]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4SubnetMaskManual]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4RouterAddress]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4RouterAddress]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4RouterAddress]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4RouterAddressManual]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv4RouterAddressManual]
 89708 ms     |    | -[WFNetworkSettingsConfig dhcpClientID]
 89708 ms     |    | -[WFNetworkSettingsConfig dhcpClientID]
 89708 ms     |    | -[WFNetworkSettingsConfig dhcpLeaseExpirationDate]
 89708 ms     |    | -[WFNetworkSettingsConfig dhcpLeaseExpirationDate]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6Config]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6Config]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6Addresses]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6Addresses]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6Addresses]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6PrefixLengths]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6PrefixLengths]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6PrefixLengths]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6AddressManual]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6AddressManual]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6RouterAddress]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6RouterAddress]
 89708 ms     |    | -[WFNetworkSettingsConfig ipv6RouterAddress]
 89709 ms     |    | -[WFNetworkSettingsConfig ipv6RouterAddressManual]
 89709 ms     |    | -[WFNetworkSettingsConfig ipv6RouterAddressManual]
 89709 ms     |    | -[WFNetworkSettingsConfig ipv6PrefixLengthManual]
 89709 ms     |    | -[WFNetworkSettingsConfig ipv6PrefixLengthManual]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsConfig]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsConfig]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsSeverAddresses]
 89709 ms     |    |    | -[WFNetworkSettingsConfig dnsServerAddresses]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsSeverAddresses]
 89709 ms     |    |    | -[WFNetworkSettingsConfig dnsServerAddresses]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsSeverAddresses]
 89709 ms     |    |    | -[WFNetworkSettingsConfig dnsServerAddresses]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsSearchDomains]
 89709 ms     |    | -[WFNetworkSettingsConfig dnsSearchDomains]
 89709 ms     |    | -[WFNetworkSettingsConfig httpProxyConfigurable]
 89709 ms     |    | -[WFNetworkSettingsConfig httpProxyConfigurable]
 89709 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
 89709 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
 89709 ms  -[WFNetworkSettingsConfig validProxyConfiguration]
 89709 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
baltpeter commented 1 year ago

It's pretty easy to create such a WFNetworkSettingsConfig object and set some properties on it:

sc = ObjC.classes.WFNetworkSettingsConfig.alloc().init()
sc.setHttpProxyServerPort_(1111)
sc.httpProxyServerPort().toString() // "1111"

But that doesn't really help us. I don't know how to get the WFNetworkSettingsConfig for the current network, and much less how to save the changes made there.

I'm not even sure whether WFNetworkSettingsConfig is responsible for the actual network config or whether that's just some MVC thingy that only holds the data for the UI to display and the actual config is handled by something else entirely. shrug

baltpeter commented 1 year ago

Another angle: I've tried looking for functions that save the config. I used:

frida-trace -U -m "*[* *config*]/i" -M "*[*UI* *]"  Preferences

After clicking "apply" in the IP settings, this gave me (plus a lot more that I cut):

108144 ms  -[FBSSceneSettings displayConfiguration]
108144 ms  -[FBSSceneSettings displayConfiguration]
108197 ms  -[WFNetworkSettingsConfig changesBetweenConfig:0x119a716a0]
108197 ms     | -[WFNetworkSettingsConfig ipv4Config]
108197 ms     | -[WFNetworkSettingsConfig ipv4Config]
108197 ms     | -[WFNetworkSettingsConfig ipv4Config]
108197 ms     | -[WFNetworkSettingsConfig ipv6Config]
108197 ms     | -[WFNetworkSettingsConfig ipv6Config]
108197 ms     | -[WFNetworkSettingsConfig dnsConfig]
108197 ms     | -[WFNetworkSettingsConfig dnsConfig]
108197 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
108197 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
108197 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
108197 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
108197 ms  -[WFSettingsController networkSettingsViewController:0x10401a000 saveConfig:0x119a716a0 errorHandler:0x25d4e1818]
108197 ms     | -[WFSettingsController config]
108197 ms     | -[WFNetworkSettingsConfig changesBetweenConfig:0x119a716a0]
108197 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
108197 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
108197 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
108197 ms     |    | -[WFNetworkSettingsConfig ipv6Config]
108197 ms     |    | -[WFNetworkSettingsConfig ipv6Config]
108197 ms     |    | -[WFNetworkSettingsConfig dnsConfig]
108197 ms     |    | -[WFNetworkSettingsConfig dnsConfig]
108197 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
108197 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
108198 ms     |    | -[WFNetworkSettingsConfig httpProxyConfigPAC]
108198 ms     |    | -[WFNetworkSettingsConfig httpProxyConfigPAC]
108198 ms     | -[WFNetworkSettingsConfig validIPv4Configuration]
108198 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
108198 ms     | +[WFSettingsIPV4 automaticConfig]
108198 ms     | -[WFSettingsController config]
108198 ms     | -[WFNetworkSettingsConfig ipv4Config]
108198 ms     | +[WFUserConfigureEvent configureEventWithType:0x0 new:0x0 old:0x2]
108198 ms     |    | -[WFUserConfigureEvent _configureValueStringForType:0x0]
108198 ms     |    | -[WFUserConfigureEvent _configureValueStringForType:0x2]
108198 ms     | -[NSString formatConfiguration]
108198 ms     | -[NSString formatConfiguration]

-[WFSettingsController networkSettingsViewController:0x10401a000 saveConfig:0x119a716a0 errorHandler:0x25d4e1818] sounds interesting but again:

baltpeter commented 1 year ago

Another go at the same thing, this time with better filtering:

frida-trace -U -m "*[* *config*]/i" -M "*[*UI* *]" -M "*[NSString *]" -M "*[FBSSceneSettings *]" Preferences

After clicking on the "proxy port" input:

 28078 ms  -[NSTextLayoutManager _configureCoreTypesetter:0x282dfc280 forTextParagraph:0x282947720 textContainer:0x2837ba1c0]
 28078 ms  -[NSTextLayoutManager _configureCoreTypesetter:0x282dfc280 forTextParagraph:0x282947720 textContainer:0x2837ba1c0]
 28080 ms  -[NSTextLayoutManager _configureCoreTypesetter:0x282dfc480 forTextParagraph:0x282947720 textContainer:0x2837ba1c0]
 28086 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 28087 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 28087 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28088 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a700 configurationUUID:0x0]
 28088 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a700 configurationUUID:0x0]
 28089 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1c20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28097 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28106 ms  -[_CFXPreferences copyAppValueForKey:0x22c6763a0 identifier:0x23618c778 container:0x0 configurationURL:0x0]
 28106 ms  -[_CFXPreferences copyAppValueForKey:0x22c6763c0 identifier:0x23618c778 container:0x0 configurationURL:0x0]
 28107 ms  -[_CFXPreferences copyAppValueForKey:0x236157df8 identifier:0x23618c778 container:0x0 configurationURL:0x0]
 28117 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28118 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28118 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28126 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28127 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28128 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28131 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28131 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28131 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 28644 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 28644 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 28645 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]

After changing the number:

 50978 ms  -[__NSXPCInterfaceProxy_PDPaymentServiceExtendedExportedInterface augmentedProductForInstallmentConfiguration:0x280d4e070 experimentDetails:0x283a37260 withCompletion:0x280d4def0]
 51051 ms  -[__NSXPCInterfaceProxy_PDPaymentServiceExtendedExportedInterface augmentedProductForInstallmentConfiguration:0x2822c5f40 experimentDetails:0x283a375a0 withCompletion:0x2822c5900]
 51054 ms  -[NSTextLayoutManager _configureCoreTypesetter:0x282e7f680 forTextParagraph:0x282ae8af0 textContainer:0x2837ba1c0]
 51055 ms  -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x119b8fa70]
 51055 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 51055 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 51055 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 51055 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 51056 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 51056 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 51056 ms     | -[WFNetworkSettingsConfig ipv4Config]
 51056 ms     | -[WFNetworkSettingsConfig ipv4Config]
 51056 ms     | -[WFNetworkSettingsConfig ipv6Config]
 51056 ms     | -[WFNetworkSettingsConfig ipv6Config]
 51056 ms     | -[WFNetworkSettingsConfig dnsConfig]
 51056 ms     | -[WFNetworkSettingsConfig dnsConfig]
 51056 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 51056 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 51056 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 51056 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 51056 ms  -[WFNetworkSettingsConfig validProxyConfiguration]
 51056 ms     | -[WFNetworkSettingsConfig httpProxyConfig]

After pressing "save":

 55798 ms  -[WFNetworkSettingsConfig changesBetweenConfig:0x10121b470]
 55798 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55798 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55798 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55798 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55798 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55798 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55798 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55798 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55798 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55798 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55798 ms  -[WFSettingsController networkSettingsViewController:0x10202b400 saveConfig:0x10121b470 errorHandler:0x25d4e1818]
 55799 ms     | -[WFSettingsController config]
 55799 ms     | -[WFNetworkSettingsConfig changesBetweenConfig:0x10121b470]
 55799 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
 55799 ms     |    | -[WFNetworkSettingsConfig ipv4Config]
 55799 ms     |    | -[WFNetworkSettingsConfig ipv6Config]
 55799 ms     |    | -[WFNetworkSettingsConfig ipv6Config]
 55799 ms     |    | -[WFNetworkSettingsConfig dnsConfig]
 55799 ms     |    | -[WFNetworkSettingsConfig dnsConfig]
 55799 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
 55799 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
 55799 ms     |    | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55799 ms     |    | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55799 ms     | -[WFNetworkSettingsConfig validProxyConfiguration]
 55799 ms     |    | -[WFNetworkSettingsConfig httpProxyConfig]
 55799 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55799 ms     | +[WFSettingsProxy defaultProxyConfiguration]
 55799 ms     | -[WFSettingsController config]
 55799 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55845 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 55845 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 55845 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55847 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a700 configurationUUID:0x0]
 55847 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a700 configurationUUID:0x0]
 55847 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1c20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55854 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55855 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55861 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55868 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55869 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
           /* TID 0x1ec0b */
 55870 ms  +[WFSettingsProxy defaultProxyConfiguration]
           /* TID 0x103 */
 55872 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 55872 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 55872 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
           /* TID 0x1b30f */
 55874 ms  -[WFSettingsController config]
 55874 ms  -[WFSettingsController _refreshSettingsConfig:0x126725530]
           /* TID 0x103 */
 55874 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
           /* TID 0x1b30f */
 55874 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55874 ms     | -[WFNetworkSettingsConfig setAutoJoinConfigurable:0x1]
 55874 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55874 ms     | -[WFNetworkSettingsConfig setAutoLoginConfigurable:0x0]
 55874 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55874 ms     | -[WFNetworkSettingsConfig setSaveDataModeConfigurable:0x1]
 55874 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55874 ms     | -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55874 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55874 ms     | -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55874 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55874 ms     | -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55874 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55874 ms     | -[WFNetworkSettingsConfig setHttpProxyConfigurable:0x1]
 55874 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55874 ms     | -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55874 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55874 ms     | -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
           /* TID 0x103 */
 55875 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 55877 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 55878 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 55878 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
           /* TID 0x1ec0b */
 55886 ms  +[WFSettingsProxy defaultProxyConfiguration]
           /* TID 0x103 */
 55900 ms  -[NSTextLayoutManager _configureCoreTypesetter:0x282da2e80 forTextParagraph:0x282ae8af0 textContainer:0x2837ba1c0]
 55913 ms  -[NSTextLayoutManager _configureCoreTypesetter:0x282dd5500 forTextParagraph:0x282ae8af0 textContainer:0x2837ba1c0]
 55921 ms  -[WFSettingsController config]
 55921 ms  -[WFSettingsController _refreshSettingsConfig:0x126725530]
 55922 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setAutoJoinConfigurable:0x1]
 55922 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setAutoLoginConfigurable:0x0]
 55922 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setSaveDataModeConfigurable:0x1]
 55922 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55922 ms     | -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55922 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55922 ms     | -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55922 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55922 ms     | -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55922 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setHttpProxyConfigurable:0x1]
 55922 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55922 ms     | -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55922 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55922 ms     | -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55922 ms  -[WFSettingsController config]
 55922 ms  -[WFSettingsController _refreshSettingsConfig:0x119bbe7f0]
 55922 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setAutoJoinConfigurable:0x1]
 55922 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setAutoLoginConfigurable:0x0]
 55922 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setSaveDataModeConfigurable:0x1]
 55922 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55922 ms     | -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55922 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55922 ms     | -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55922 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55922 ms     | -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55922 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55922 ms     | -[WFNetworkSettingsConfig setHttpProxyConfigurable:0x1]
 55922 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55922 ms     | -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55922 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55922 ms     | -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55922 ms  -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55922 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4StateConfig]
 55923 ms  -[WFIPMonitor __ipv4SetupConfig]
 55923 ms  -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55923 ms  -[WFIPMonitor __ipv6StateConfig]
 55924 ms  -[WFIPMonitor __ipv6StateConfig]
 55924 ms  -[WFIPMonitor __ipv6StateConfig]
 55924 ms  -[WFIPMonitor __ipv6StateConfig]
 55924 ms  -[WFIPMonitor __dnsSetupConfig]
 55924 ms  -[WFIPMonitor __dnsSetupConfig]
 55924 ms  -[WFIPMonitor __dnsStateConfig]
 55924 ms  -[WFIPMonitor __ipv4SetupConfig]
 55924 ms  -[WFIPMonitor __dnsSetupConfig]
 55924 ms  -[WFIPMonitor __dnsStateConfig]
 55924 ms  -[WFIPMonitor __dnsSetupConfig]
 55924 ms  -[WFIPMonitor __dnsStateConfig]
 55924 ms  -[WFIPMonitor __dnsSetupConfig]
 55925 ms  -[WFIPMonitor __dnsStateConfig]
 55925 ms  -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55925 ms  -[WFSettingsProxy autoConfigured]
 55925 ms  -[WFSettingsProxy autoConfigureURL]
 55925 ms  -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55925 ms  -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55925 ms  -[WFSettingsController config]
 55925 ms  -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x126725530]
 55925 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55925 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55925 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55925 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55925 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55925 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55925 ms  -[WFSettingsController setConfig:0x126a9d0b0]
 55925 ms  -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x126a9d0b0]
 55925 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55925 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55925 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55925 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55925 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55925 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55925 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55925 ms  -[WFNetworkSettingsConfig autoJoinConfigurable]
 55925 ms  -[WFNetworkSettingsConfig setAutoJoinConfigurable:0x1]
 55925 ms  -[WFNetworkSettingsConfig autoLoginConfigurable]
 55925 ms  -[WFNetworkSettingsConfig setAutoLoginConfigurable:0x0]
 55925 ms  -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55925 ms  -[WFNetworkSettingsConfig setSaveDataModeConfigurable:0x1]
 55925 ms  -[WFNetworkSettingsConfig ipv4Config]
 55925 ms  -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55925 ms  -[WFNetworkSettingsConfig ipv6Config]
 55925 ms  -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55925 ms  -[WFNetworkSettingsConfig dnsConfig]
 55925 ms  -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55925 ms  -[WFNetworkSettingsConfig httpProxyConfigurable]
 55925 ms  -[WFNetworkSettingsConfig setHttpProxyConfigurable:0x1]
 55925 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 55925 ms  -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55925 ms  -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55925 ms  -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55925 ms  -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55925 ms  -[WFDetailsContext isWifiModeConfigurable]
 55925 ms  -[WFNetworkSettingsConfig httpProxyConfigurable]
 55928 ms  -[WFDetailsContext isAutoJoinConfigurable]
 55928 ms  -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55929 ms  -[WFNetworkSettingsConfig ipv4Config]
 55930 ms  -[WFIPMonitor ipv4ConfigMethod]
 55930 ms     | -[WFIPMonitor __ipv4SetupConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55931 ms  -[WFIPMonitor ipv4ConfigMethod]
 55931 ms     | -[WFIPMonitor __ipv4SetupConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55931 ms  -[WFIPMonitor ipv4ConfigMethod]
 55931 ms     | -[WFIPMonitor __ipv4SetupConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55931 ms  -[WFIPMonitor ipv4ConfigMethod]
 55931 ms     | -[WFIPMonitor __ipv4SetupConfig]
 55931 ms  -[WFIPMonitor __ipv4StateConfig]
 55932 ms  -[WFIPMonitor __ipv4StateConfig]
 55932 ms  -[WFIPMonitor ipv4ConfigMethod]
 55932 ms     | -[WFIPMonitor __ipv4SetupConfig]
 55932 ms  -[WFIPMonitor __ipv4StateConfig]
 55932 ms  -[WFIPMonitor __ipv4StateConfig]
 55932 ms  -[WFIPMonitor ipv4ConfigMethod]
 55932 ms     | -[WFIPMonitor __ipv4SetupConfig]
 55932 ms  -[WFIPMonitor __ipv4StateConfig]
 55932 ms  -[WFIPMonitor __ipv4StateConfig]
           /* TID 0x1b30f */
 55935 ms  +[WFSettingsProxy defaultProxyConfiguration]
           /* TID 0x103 */
 55938 ms  -[WFNetworkSettingsCellFactory ipv4AddressConfigCellAtIndexPath:0xbff62099085704fd]
 55938 ms  -[WFNetworkSettingsConfig ipv4Config]
 55941 ms  -[WFNetworkSettingsConfig ipv4Config]
           /* TID 0x1ec0b */
 55942 ms  +[WFSettingsProxy defaultProxyConfiguration]
           /* TID 0x103 */
 55942 ms  -[WFNetworkSettingsConfig ipv4Config]
 55943 ms  -[WFNetworkSettingsConfig ipv4Config]
 55947 ms  -[WFNetworkSettingsCellFactory dnsConfigureCellAtIndexPath:0xbff62099085714fd]
 55947 ms  -[WFNetworkSettingsConfig dnsConfig]
 55948 ms  -[WFNetworkSettingsCellFactory httpProxyConfigCellAtIndexPath:0xbff6209908576cfd]
 55949 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 55949 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 55949 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 55956 ms  -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55956 ms  -[WFIPMonitor __ipv4StateConfig]
 55957 ms  -[WFIPMonitor __ipv4SetupConfig]
 55957 ms  -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55957 ms  -[WFIPMonitor __ipv6StateConfig]
 55957 ms  -[WFIPMonitor __ipv6StateConfig]
 55957 ms  -[WFIPMonitor __ipv6StateConfig]
 55957 ms  -[WFIPMonitor __ipv6StateConfig]
 55957 ms  -[WFIPMonitor __dnsSetupConfig]
 55957 ms  -[WFIPMonitor __dnsSetupConfig]
 55957 ms  -[WFIPMonitor __dnsStateConfig]
 55957 ms  -[WFIPMonitor __ipv4SetupConfig]
 55957 ms  -[WFIPMonitor __dnsSetupConfig]
 55958 ms  -[WFIPMonitor __dnsStateConfig]
 55958 ms  -[WFIPMonitor __dnsSetupConfig]
 55958 ms  -[WFIPMonitor __dnsStateConfig]
 55958 ms  -[WFIPMonitor __dnsSetupConfig]
 55958 ms  -[WFIPMonitor __dnsStateConfig]
 55958 ms  -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55958 ms  -[WFSettingsProxy autoConfigured]
 55958 ms  -[WFSettingsProxy autoConfigureURL]
 55958 ms  -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55958 ms  -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55958 ms  -[WFSettingsController config]
 55958 ms  -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x126a9d0b0]
 55958 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55958 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55958 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55958 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55958 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55958 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55958 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55958 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55958 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55958 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55958 ms     | -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55958 ms  -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55958 ms  -[WFIPMonitor __ipv4StateConfig]
 55958 ms  -[WFIPMonitor __ipv4StateConfig]
 55959 ms  -[WFIPMonitor __ipv4StateConfig]
 55959 ms  -[WFIPMonitor __ipv4StateConfig]
 55959 ms  -[WFIPMonitor __ipv4StateConfig]
 55959 ms  -[WFIPMonitor __ipv4StateConfig]
 55959 ms  -[WFIPMonitor __ipv4StateConfig]
 55959 ms  -[WFIPMonitor __ipv4SetupConfig]
 55959 ms  -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55959 ms  -[WFIPMonitor __ipv6StateConfig]
 55959 ms  -[WFIPMonitor __ipv6StateConfig]
 55959 ms  -[WFIPMonitor __ipv6StateConfig]
 55960 ms  -[WFIPMonitor __ipv6StateConfig]
 55960 ms  -[WFIPMonitor __dnsSetupConfig]
 55960 ms  -[WFIPMonitor __dnsSetupConfig]
 55960 ms  -[WFIPMonitor __dnsStateConfig]
 55960 ms  -[WFIPMonitor __ipv4SetupConfig]
 55960 ms  -[WFIPMonitor __dnsSetupConfig]
 55960 ms  -[WFIPMonitor __dnsStateConfig]
 55960 ms  -[WFIPMonitor __dnsSetupConfig]
 55960 ms  -[WFIPMonitor __dnsStateConfig]
 55960 ms  -[WFIPMonitor __dnsSetupConfig]
 55960 ms  -[WFIPMonitor __dnsStateConfig]
 55960 ms  -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55961 ms  -[WFSettingsProxy autoConfigured]
 55961 ms  -[WFSettingsProxy autoConfigureURL]
 55961 ms  -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55961 ms  -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55961 ms  -[WFSettingsController config]
 55961 ms  -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x119bbe7f0]
 55961 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55961 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55961 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55961 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55961 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55961 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55961 ms  -[WFSettingsController setConfig:0x126978200]
 55961 ms  -[WFNetworkSettingsConfig isEqualToNetworkSettingsConfig:0x126978200]
 55961 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig autoJoinConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig autoLoginConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55961 ms     | -[WFNetworkSettingsConfig ipv4Config]
 55961 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55961 ms     | -[WFNetworkSettingsConfig ipv6Config]
 55961 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55961 ms     | -[WFNetworkSettingsConfig dnsConfig]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfigurable]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55961 ms     | -[WFNetworkSettingsConfig httpProxyConfig]
 55961 ms  -[WFNetworkSettingsConfig autoJoinConfigurable]
 55961 ms  -[WFNetworkSettingsConfig setAutoJoinConfigurable:0x1]
 55961 ms  -[WFNetworkSettingsConfig autoLoginConfigurable]
 55961 ms  -[WFNetworkSettingsConfig setAutoLoginConfigurable:0x0]
 55961 ms  -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55961 ms  -[WFNetworkSettingsConfig setSaveDataModeConfigurable:0x1]
 55961 ms  -[WFNetworkSettingsConfig ipv4Config]
 55961 ms  -[WFNetworkSettingsConfig setIpv4Config:0x0]
 55961 ms  -[WFNetworkSettingsConfig ipv6Config]
 55961 ms  -[WFNetworkSettingsConfig setIpv6Config:0x0]
 55961 ms  -[WFNetworkSettingsConfig dnsConfig]
 55961 ms  -[WFNetworkSettingsConfig setDnsConfig:0x0]
 55961 ms  -[WFNetworkSettingsConfig httpProxyConfigurable]
 55961 ms  -[WFNetworkSettingsConfig setHttpProxyConfigurable:0x1]
 55961 ms  -[WFNetworkSettingsConfig httpProxyConfig]
 55961 ms  -[WFNetworkSettingsConfig setHttpProxyConfig:0x1]
 55961 ms  -[WFNetworkSettingsConfig httpProxyConfigPAC]
 55962 ms  -[WFNetworkSettingsConfig setHttpProxyConfigPAC:0x0]
 55962 ms  -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55962 ms  -[WFDetailsContext isWifiModeConfigurable]
 55962 ms  -[WFNetworkSettingsConfig httpProxyConfigurable]
 55963 ms  -[WFDetailsContext isAutoJoinConfigurable]
 55964 ms  -[WFNetworkSettingsConfig saveDataModeConfigurable]
 55966 ms  -[WFNetworkSettingsConfig ipv4Config]
 56425 ms  -[MCProfileConnection effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 56425 ms     | -[MCRestrictionManager effectiveParametersForBoolSetting:0x22d59a340 configurationUUID:0x0]
 56425 ms  -[_CFXPreferences copyAppValueForKey:0x22c098f20 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
 56440 ms  -[_CFXPreferences copyAppValueForKey:0x22c0a1de0 identifier:0x22c0a18a0 container:0x0 configurationURL:0x0]
baltpeter commented 1 year ago

Searching for WFSettingsProxy led me here: https://bbs.kanxue.com/thread-275097.htm

That's super helpful! Most of these functions don't work as-is for me but definitely something to build on.

baltpeter commented 1 year ago

Based on https://bbs.kanxue.com/thread-275097.htm, here's a function to read the proxy settings of the current WiFi network:

function getProxySettingsForCurrentWifiNetwork() {
    var currentNetwork = ObjC.classes.WFClient.sharedInstance().interface().currentNetwork();
    var ssid = currentNetwork.ssid();

    var gso = ObjC.classes.WFGetSettingsOperation.alloc().initWithSSID_(ssid);
    gso.start();
    return gso.settings().proxySettings();
}

Example:

[iOS Device::Preferences ]-> getProxySettingsForCurrentWifiNetwork().toString()
"WFSettingsProxy- Server: 1.2.3.4  Port: 7890  Username: myuser  Password: <not nil>"
[iOS Device::Preferences ]-> getProxySettingsForCurrentWifiNetwork().password().toString()
"mypass"

This seems to only work in system apps, and you need to load WiFiKit if it wasn't loaded already. Trying to run it in SpringBoard otherwise gives me:

TypeError: cannot read property 'sharedInstance' of undefined
    at getProxySettingsForCurrentWifiNetwork (<input>:2)
    at <eval> (<input>:1)
    at eval (native)

But after Module.load('/System/Library/PrivateFrameworks/WiFiKit.framework/WiFiKit');, it does work[^1].

In non-system apps, it fails to get the WFClient instance:

TypeError: cannot read property 'currentNetwork' of null
    at getProxySettingsForCurrentWifiNetwork (<input>:2)
    at <eval> (<input>:1)
    at eval (native)

[^1]: You may need to wait a bit after loading the module. The first time, currentNetwork was null:

```
TypeError: cannot read property 'ssid' of null
    at getProxySettingsForCurrentWifiNetwork (<input>:3)
    at <eval> (<input>:1)
    at eval (native)
```

But on second try, it did work.
baltpeter commented 1 year ago

As far as writing the proxy settings goes, I'm not quite sure about where the keys in https://bbs.kanxue.com/thread-275097.htm come from. For example, why are we setting some of the settings with both an HTTP and an HTTPS prefix (e.g. HTTPEnable and HTTPSEnable, HTTPPort and HTTPSPort), but not all of them (e.g. we are setting HTTPProxyUsername but not HTTPSProxyUsername)? Also, why are we not setting the password as part of the dictionary but later in a separate call?

So, let's try to verify that ourselves.

We'll configure a proxy with known values in the UI and then read the proxy settings using the function from above. The proxy settings are a WFSettingsProxy object:

[iOS Device::Preferences ]-> getProxySettingsForCurrentWifiNetwork().$class.toString()
"WFSettingsProxy"

But the function in the source operates on a dictionary. We can turn the WFSettingsProxy object into a dictionary by calling .items() on it:

[iOS Device::Preferences ]-> getProxySettingsForCurrentWifiNetwork().items().toString()
"{\n    ExceptionsList =     (\n        \"*.local\",\n        \"169.254/16\"\n    );\n    FTPPassive = 1;\n    HTTPEnable = 1;\n    HTTPPort = 1234;\n    HTTPProxy = \"0.0.0.0\";\n    HTTPProxyAuthenticated = 1;\n    HTTPProxyUsername = abc;\n    HTTPSEnable = 1;\n    HTTPSPort = 1234;\n    HTTPSProxy = \"0.0.0.0\";\n}"

To make that a little easier to read, we can use the dictFromNSDictionary function from our existing getPrefs script:

https://github.com/tweaselORG/appstraction/blob/57010b53db0f67bb076d39ba6d7f3d9d75046325/src/ios.ts#L7-L19

With that, we get:

[iOS Device::Preferences ]-> dictFromNSDictionary(getProxySettingsForCurrentWifiNetwork().items())
{
    "ExceptionsList": "(\n    \"*.local\",\n    \"169.254/16\"\n)",
    "FTPPassive": "1",
    "HTTPEnable": "1",
    "HTTPPort": "1234",
    "HTTPProxy": "0.0.0.0",
    "HTTPProxyAuthenticated": "1",
    "HTTPProxyUsername": "abc",
    "HTTPSEnable": "1",
    "HTTPSPort": "1234",
    "HTTPSProxy": "0.0.0.0"
}

Note that ExceptionsList and FTPPassive come from the default proxy configuration:

[iOS Device::Preferences ]-> dictFromNSDictionary(ObjC.classes.WFSettingsProxy.defaultProxyConfiguration())
{
    "ExceptionsList": "(\n    \"*.local\",\n    \"169.254/16\"\n)",
    "FTPPassive": "1"
}

OK, seems like the source is actually correct.

baltpeter commented 1 year ago

What if we wanted a proxy without authentication?

[iOS Device::Preferences ]-> dictFromNSDictionary(getProxySettingsForCurrentWifiNetwork().items())

{
    "ExceptionsList": "(\n    \"*.local\",\n    \"169.254/16\"\n)",
    "FTPPassive": "1",
    "HTTPEnable": "1",
    "HTTPPort": "5678",
    "HTTPProxy": "1.2.3.4",
    "HTTPSEnable": "1",
    "HTTPSPort": "5678",
    "HTTPSProxy": "1.2.3.4"
}

And if we wanted to use an automatic proxy configuration?

[iOS Device::Preferences ]-> dictFromNSDictionary(getProxySettingsForCurrentWifiNetwork().items())

{
    "ExceptionsList": "(\n    \"*.local\",\n    \"169.254/16\"\n)",
    "FTPPassive": "1",
    "ProxyAutoConfigEnable": "1",
    "ProxyAutoConfigURLString": "pac.url"
}

And finally, how do we disable the proxy?

[iOS Device::Preferences ]-> dictFromNSDictionary(getProxySettingsForCurrentWifiNetwork().items())

{
    "ExceptionsList": "(\n    \"*.local\",\n    \"169.254/16\"\n)",
    "FTPPassive": "1"
}
baltpeter commented 1 year ago

Here's the Frida function to set the proxy settings:

// If `options` is falsy, the proxy will be disabled. Otherwise, it has to have the following properties:
// `host`, `port`, `username`, `password`. `username` and `password` are optional. If both of them are provided, the
// proxy will be configured to use authentication.
function setProxySettingsForCurrentWifiNetwork(options) {
    var NSString = ObjC.classes.NSString;
    var NSNumber = ObjC.classes.NSNumber;

    var authenticated = options && options.username && options.password;

    var defaultProxySettings = ObjC.classes.WFSettingsProxy.defaultProxyConfiguration();
    var ssid = ObjC.classes.WFClient.sharedInstance().interface().currentNetwork().ssid();

    var newSettingsDict = ObjC.classes.NSMutableDictionary.alloc().initWithDictionary_(defaultProxySettings);
    if (options) {
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(1), NSString.stringWithString_('HTTPEnable'));
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(options.port), NSString.stringWithString_('HTTPPort'));
        newSettingsDict.setObject_forKey_(NSString.stringWithString_(options.host), NSString.stringWithString_('HTTPProxy'));
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(1), NSString.stringWithString_('HTTPSEnable'));
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(options.port), NSString.stringWithString_('HTTPSPort'));
        newSettingsDict.setObject_forKey_(NSString.stringWithString_(options.host), NSString.stringWithString_('HTTPSProxy'));

        if (authenticated) {
            newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(1), NSString.stringWithString_('HTTPProxyAuthenticated'));
            newSettingsDict.setObject_forKey_(NSString.stringWithString_(options.username), NSString.stringWithString_('HTTPProxyUsername'));
        }
    }

    var newSettings = ObjC.classes.WFSettingsProxy.alloc().initWithDictionary_(newSettingsDict);
    if (authenticated) newSettings.setPassword_(options.password);

    var arrayWithNewSettings = ObjC.classes.NSMutableArray.alloc().init();
    arrayWithNewSettings.addObject_(newSettings);

    var saveSettingsOperation = ObjC.classes.WFSaveSettingsOperation.alloc().initWithSSID_settings_(ssid, arrayWithNewSettings);
    saveSettingsOperation.setCurrentNetwork_(1);
    saveSettingsOperation.start();
}
baltpeter commented 1 year ago

getProxySettingsForCurrentWifiNetwork() and setProxySettingsForCurrentWifiNetwork() confirmed working on iOS 15 and 16. But annoyingly, the currentNetwork problem also sometimes occurs in the Settings app. We may need to integrate a workaround that tries to read that a couple of times.

baltpeter commented 1 year ago

Here's the updated setProxySettingsForCurrentWifiNetwork function that re-tries to read the SSID if currentNetwork is null:

// If `options` is falsy, the proxy will be disabled. Otherwise, it has to have the following properties:
// `host`, `port`, `username`, `password`. `username` and `password` are optional. If both of them are provided, the
// proxy will be configured to use authentication.
function setProxySettingsForCurrentWifiNetwork(options) {
    var NSString = ObjC.classes.NSString;
    var NSNumber = ObjC.classes.NSNumber;

    var authenticated = options && options.username && options.password;

    var defaultProxySettings = ObjC.classes.WFSettingsProxy.defaultProxyConfiguration();

    // Sometimes, `currentNetwork()` returns `null`, so we have to try a few times.
    // See: https://github.com/tweaselORG/appstraction/issues/25#issuecomment-1447996021
    var ssid;
    for (let i = 0; i < 100; i++) {
        var currentNetwork = ObjC.classes.WFClient.sharedInstance().interface().currentNetwork();
        if (currentNetwork) { 
            ssid = currentNetwork.ssid();
            break;
        }
    }

    var newSettingsDict = ObjC.classes.NSMutableDictionary.alloc().initWithDictionary_(defaultProxySettings);
    if (options) {
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(1), NSString.stringWithString_('HTTPEnable'));
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(options.port), NSString.stringWithString_('HTTPPort'));
        newSettingsDict.setObject_forKey_(NSString.stringWithString_(options.host), NSString.stringWithString_('HTTPProxy'));
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(1), NSString.stringWithString_('HTTPSEnable'));
        newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(options.port), NSString.stringWithString_('HTTPSPort'));
        newSettingsDict.setObject_forKey_(NSString.stringWithString_(options.host), NSString.stringWithString_('HTTPSProxy'));

        if (authenticated) {
            newSettingsDict.setObject_forKey_(NSNumber.numberWithInt_(1), NSString.stringWithString_('HTTPProxyAuthenticated'));
            newSettingsDict.setObject_forKey_(NSString.stringWithString_(options.username), NSString.stringWithString_('HTTPProxyUsername'));
        }
    }

    var newSettings = ObjC.classes.WFSettingsProxy.alloc().initWithDictionary_(newSettingsDict);
    if (authenticated) newSettings.setPassword_(options.password);

    var arrayWithNewSettings = ObjC.classes.NSMutableArray.alloc().init();
    arrayWithNewSettings.addObject_(newSettings);

    var saveSettingsOperation = ObjC.classes.WFSaveSettingsOperation.alloc().initWithSSID_settings_(ssid, arrayWithNewSettings);
    saveSettingsOperation.setCurrentNetwork_(1);
    saveSettingsOperation.start();
}
baltpeter commented 1 year ago

Updated getProxySettingsForCurrentWifiNetwork() with the currentNetwork fix, and it now returns a JS object:

// Taken from: https://codeshare.frida.re/@dki/ios-app-info/
function dictFromNSDictionary(nsDict) { 
    var jsDict = {}; 
    var keys = nsDict.allKeys(); 
    var count = keys.count(); 
    for (var i = 0; i < count; i++) { 
        var key = keys.objectAtIndex_(i); 
        var value = nsDict.objectForKey_(key); 
        jsDict[key.toString()] = value.toString(); 
    } 

    return jsDict; 
} 

function getProxySettingsForCurrentWifiNetwork() {
    var ssid;
    for (let i = 0; i < 100; i++) {
        var currentNetwork = ObjC.classes.WFClient.sharedInstance().interface().currentNetwork();
        if (currentNetwork) {
            ssid = currentNetwork.ssid();
            break;
        }
    }

    var gso = ObjC.classes.WFGetSettingsOperation.alloc().initWithSSID_(ssid);
    gso.start();
    var settings = gso.settings().proxySettings();

    var dict = dictFromNSDictionary(settings.items());
    if (settings.password()) dict.HTTPProxyPassword = settings.password().toString();

    return dict;
}