forked from MD-Levitan/fridas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathios_ssl_pinning.js
35 lines (30 loc) · 1.27 KB
/
ios_ssl_pinning.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var tls_helper_create_peer_trust;
var version = ObjC.classes.UIDevice.currentDevice().systemVersion().toString();
if (version.startsWith("12.")) { // iOS 11
/* OSStatus nw_tls_create_peer_trust(tls_handshake_t hdsk, bool server, SecTrustRef *trustRef); */
tls_helper_create_peer_trust = new NativeFunction(
Module.findExportByName(null, "nw_tls_create_peer_trust"),
'int', ['pointer', 'bool', 'pointer']
);
} else if (version.startsWith("10.")) { // iOS 10
/* OSStatus tls_helper_create_peer_trust(tls_handshake_t hdsk, bool server, SecTrustRef *trustRef); */
tls_helper_create_peer_trust = new NativeFunction(
Module.findExportByName(null, "tls_helper_create_peer_trust"),
'int', ['pointer', 'bool', 'pointer']
);
} else {
console.log("Unsupported OS version!");
}
var errSecSuccess = 0;
function bypassSSL() {
Interceptor.replace(tls_helper_create_peer_trust, new NativeCallback(function(hdsk, server, trustRef) {
console.log("Called nw_tls_create_peer_trust()");
return errSecSuccess;
}, 'int', ['pointer', 'bool', 'pointer']));
console.log("SSL certificate validation bypass active");
}
function revertSSL() {
Interceptor.revert(tls_helper_create_peer_trust);
console.log("SSL certificate validation bypass disabled");
}
bypassSSL();