Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Routing WKWebView through TOR swift

I currently have an app based inside of a WKWebView in ios swift. I was wondering if it is possible to route all of the outgoing connections from that webview through TOR. Ive seen projects like ICepa and Tor.framework but am a little clueless on how to use them for a web view.

All help is appreciated.

Thanks

like image 613
Agoose Banwatti Avatar asked Aug 31 '19 07:08

Agoose Banwatti


People also ask

What is WKWebView in Swift?

A WKWebView object is a platform-native view that you use to incorporate web content seamlessly into your app's UI. A web view supports a full web-browsing experience, and presents HTML, CSS, and JavaScript content alongside your app's native views.

What is the difference between UIWebView and WKWebView?

One major architectural difference between UIWebView and WKWebView is that the methods of WKWebView tend to be asynchronous, while the methods of UIWebView were synchronous. This difference requires code and architecture changes in your app.

What browser does WKWebView use?

WKWebView uses the Nitro JavaScript engine, also used by mobile Safari, which comes with significant performance improvements over UIWebView's older JavaScript engine.


1 Answers

You can't control how a WKWebView (or the newer Safari View Controller) accesses the internet; it always uses the system WAN connection.

One approach might be to build a VPN service that 1) is available to the operating system and can easily be switched on 2) routes the VPN tunnel through TOR instead of a traditional VPN system. You could then use your web view as usual, knowing that the data will be routed through a virtual tunnel into TOR instead of using the regular internet connection.

I suggest you start here: https://developer.apple.com/documentation/networkextension/nevpnmanager

like image 105
chris stamper Avatar answered Sep 18 '22 23:09

chris stamper