Skip to content

Commit

Permalink
Allow exporting the SSLKEYLOG after anomalous app stop
Browse files Browse the repository at this point in the history
Closes #324
  • Loading branch information
emanuele-f committed Jun 13, 2023
1 parent 1c36146 commit e357534
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,15 @@ public boolean onOptionsItemSelected(MenuItem item) {
private void initAppState() {
boolean is_active = CaptureService.isServiceActive();

if (!is_active)
if (!is_active) {
appStateReady();
else

// PCAPdroid could have been closed unexpectedly (e.g. due to low memory), try to export
// the keylog file if exists
mKeylogFile = MitmReceiver.getKeylogFilePath(MainActivity.this);
if(mKeylogFile.exists())
startExportSslkeylogfile();
} else
appStateRunning();
}

Expand Down Expand Up @@ -767,6 +773,13 @@ private void sslkeyfileExportResult(final ActivityResult result) {
Utils.showToastLong(this, R.string.export_failed);
}
}
mKeylogFile = null;

if(mKeylogFile != null) {
// upon closing the dialog, delete the keylog

//noinspection ResultOfMethodCallIgnored
mKeylogFile.delete();
mKeylogFile = null;
}
}
}

0 comments on commit e357534

Please sign in to comment.