Skip to content

Commit

Permalink
Add the --quiet flag for the Android SSLpinning disable job.
Browse files Browse the repository at this point in the history
  • Loading branch information
leonjza committed Oct 22, 2017
1 parent 8fba5d3 commit aa85166
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
15 changes: 14 additions & 1 deletion objection/commands/android/pinning.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
from objection.utils.templates import android_hook


def _should_be_quiet(args: list) -> bool:
"""
Checks if --quiet is part of the
commands arguments.
:param args:
:return:
"""

return '--quiet' in args


def android_disable(args: list = None) -> None:
"""
Starts a new objection job that hooks common classes and functions,
Expand All @@ -13,5 +25,6 @@ def android_disable(args: list = None) -> None:

hook = android_hook('pinning/disable')

runner = FridaRunner(hook=hook)
runner = FridaRunner()
runner.set_hook_with_data(hook=hook, quiet=_should_be_quiet(args))
runner.run_as_job(name='pinning-disable')
1 change: 1 addition & 0 deletions objection/console/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
'commands': {
'disable': {
'meta': 'Attempt to disable SSL pinning in various Java libraries/classes',
'flags': ['--quiet'],
'exec': android_pinning.android_disable
}
}
Expand Down
18 changes: 15 additions & 3 deletions objection/hooks/android/pinning/disable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@

var X509TrustManager = Java.use('javax.net.ssl.X509TrustManager');
var SSLContext = Java.use('javax.net.ssl.SSLContext');
var quiet_output = ('{{ quiet }}'.toLowerCase() == 'true')

// Helper method to honor the quiet flag.
function quiet_send(data) {

if (quiet_output) {

return;
}

send(data)
}

// Implement a new TrustManager
// ref: https://gist.github.com/oleavr/3ca67a173ff7d207c6b8c3b0ca65a9d8
Expand Down Expand Up @@ -39,7 +51,7 @@ var SSLContext_init = SSLContext.init.overload(
// Override the init method, specifying our new TrustManager
SSLContext_init.implementation = function (keyManager, trustManager, secureRandom) {

send({
quiet_send({
status: 'success',
error_reason: NaN,
type: 'android-ssl-pinning-bypass',
Expand All @@ -66,7 +78,7 @@ try {

CertificatePinner.check.overload('java.lang.String', 'java.util.List').implementation = function () {

send({
quiet_send({
status: 'success',
error_reason: NaN,
type: 'android-ssl-pinning-bypass',
Expand Down Expand Up @@ -101,7 +113,7 @@ try {

PinningTrustManager.checkServerTrusted.implementation = function () {

send({
quiet_send({
status: 'success',
error_reason: NaN,
type: 'android-ssl-pinning-bypass',
Expand Down

0 comments on commit aa85166

Please sign in to comment.