Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify sslpinning bypass for okhttp3 library #572

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions agent/src/android/pinning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,18 @@ const okHttp3CertificatePinnerCheckOkHttp = (ident: string): any | undefined =>
// Response response = client.newCall(request).execute();
return wrapJavaPerform(() => {
try {
const certificatePinner: CertificatePinner = Java.use("okhttp3.CertificatePinner");
send(c.blackBright(`Found okhttp3.CertificatePinner, overriding CertificatePinner.check$okhttp()`));

const CertificatePinnerCheckOkHttp = certificatePinner.check$okhttp.overload("java.lang.String", "u15");

// tslint:disable-next-line:only-arrow-functions
CertificatePinnerCheckOkHttp.implementation = function () {
qsend(quiet,
c.blackBright(`[${ident}] `) + `Called check$okhttp ` +
c.green(`OkHTTP 3.x CertificatePinner.check$okhttp()`) +
`, not throwing an exception.`,
);
};

const certificatePinner = Java.use("okhttp3.CertificatePinner");
certificatePinner["check$okhttp"].overloads.forEach((m) => {
// get the argument types for this overload
var calleeArgTypes = m.argumentTypes.map((arg) => arg.className);
send(color_1.colors.blackBright(`Found okhttp3.CertificatePinner.check$okhttp(${calleeArgTypes.join(", ")}), overriding ...`));

m.implementation = function () {
helpers_1.qsend(quiet, color_1.colors.blackBright(`[${ident}] `) + `Called check$okhttp ` +
color_1.colors.green(`OkHTTP 3.x CertificatePinner.check$okhttp()`) +
`, not throwing an exception.`);
}
});
return CertificatePinnerCheckOkHttp;

} catch (err) {
Expand Down