From e221fad3740fca21ed1f8e9cdefd0f123d912da5 Mon Sep 17 00:00:00 2001 From: emanuele-f Date: Mon, 30 May 2022 23:20:32 +0200 Subject: [PATCH] Enable the TLS decryption switch on setup done --- .../remote_capture/activities/SettingsActivity.java | 13 +++++++++++++ .../remote_capture/fragments/mitmwizard/Done.java | 1 - app/src/main/res/values/strings.xml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java b/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java index 85804878..bcf66e00 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java +++ b/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java @@ -132,6 +132,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment private DropDownPreference mCapInterface; private SwitchPreference mMalwareDetectionEnabled; private Billing mIab; + private boolean mHasStartedMitmWizard; private final ActivityResultLauncher requestPermissionLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> @@ -162,6 +163,17 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment } } + @Override + public void onResume() { + super.onResume(); + + if(mHasStartedMitmWizard && !MitmAddon.needsSetup(requireContext())) { + Log.d(TAG, "mitm setup complete, enabling"); + mTlsDecryption.setChecked(true); + } + mHasStartedMitmWizard = false; + } + private @NonNull T requirePreference(String key) { T pref = findPreference(key); if(pref == null) @@ -258,6 +270,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment Context ctx = requireContext(); if(enabled && MitmAddon.needsSetup(ctx)) { + mHasStartedMitmWizard = true; Intent intent = new Intent(ctx, MitmSetupWizard.class); startActivity(intent); return false; diff --git a/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/Done.java b/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/Done.java index 6433a5d6..ddc2d199 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/Done.java +++ b/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/Done.java @@ -32,7 +32,6 @@ public class Done extends StepFragment { @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - mStepIcon.setVisibility(View.GONE); mStepLabel.setText(R.string.mitm_setup_wizard_done); MitmAddon.setDecryptionSetupDone(requireContext(), true); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5ce5c27b..5e43fea7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -346,7 +346,7 @@ Block private DNS Detect and possibly block private DNS to inspect DNS traffic. Disabling this can hinder detection This wizard will guide you through the installation of the PCAPdroid mitm addon and certification authority, which are needed to perform the TLS decryption - PCAPdroid is now ready to decrypt TLS traffic\n\nCheck out the user guide to know more about the security measures which may prevent decryption and how to bypass them + PCAPdroid is now ready to decrypt the TLS traffic\n\nCheck out the user guide to know more about the security measures which may prevent decryption and how to bypass them Skip Next Back