importSwiftUIimportUIKitimportWebKitstructMastgTest{@inline(never)@_optimize(none)publicstaticfuncmastgTest(completion:@escaping(String)->Void){DispatchQueue.main.async{//Buildthealertcompletion("Showing WebView for 2s...")//1.CreatetheWebViewDispatchQueue.main.asyncAfter(deadline:.now()+1){letwebView=UIWebView()webView.loadRequest(URLRequest(url:URL(string:"https://owasp.org")!))//2.CreateaUIViewControllertoholdtheWebViewletviewControllerToPresent=UIViewController()viewControllerToPresent.view=webView//Presentfromthetopmostviewcontrollerifletpresenter=topViewController(){presenter.present(viewControllerToPresent,animated:true,completion:{})}else{completion("Failed to present web view (no active view controller).")}}}}//FindsthecurrentlyvisibleviewcontrollertopresentfromprivatestaticfunctopViewController(base:UIViewController?={letscenes=UIApplication.shared.connectedScenes.compactMap{$0as?UIWindowScene}letkeyWindow=scenes.flatMap{$0.windows}.first{$0.isKeyWindow}returnkeyWindow?.rootViewController}())->UIViewController?{ifletnav=baseas?UINavigationController{returntopViewController(base:nav.visibleViewController)}iflettab=baseas?UITabBarController{returntopViewController(base:tab.selectedViewController)}ifletpresented=base?.presentedViewController{returntopViewController(base:presented)}returnbase}}
Unzip the app package and locate the main binary file ( Exploring the App Package), which in this case is ./Payload/MASTestApp.app/MASTestApp.
Open the app binary with radare2 (iOS) with the -i option to run the script.
1 2 3 4 5 6 7 8 910111213141516171819
e asm.bytes=false
e scr.color=false
e asm.var=false
?e List all uses of the 'UIWebView' class:
f~UIWebView
?e
?e List all xrefs to the 'UIWebView' class:
axt @ 0x100010108
?e
?e Code snippet that contains the xref to 'UIWebView':
pd 10 @ 0x100004514