mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-06-16 21:10:57 +08:00
Show warning if no app data is exchanged
This commit is contained in:
parent
37955540f2
commit
3ca3603ed0
@ -1111,7 +1111,7 @@ public class Utils {
|
||||
case NOT_DECRYPTABLE:
|
||||
color = R.color.warning;
|
||||
break;
|
||||
case TLS_ERROR:
|
||||
case ERROR:
|
||||
color = R.color.danger;
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -101,9 +101,9 @@ public class EditFilterActivity extends BaseActivity {
|
||||
|
||||
mDecChips = new ArrayList<>(Arrays.asList(
|
||||
new Pair<>(DecryptionStatus.DECRYPTED, findViewById(R.id.dec_status_decrypted)),
|
||||
new Pair<>(DecryptionStatus.DECRYPTION_IN_PROGRESS, findViewById(R.id.dec_status_in_progress)),
|
||||
new Pair<>(DecryptionStatus.WAITING_DATA, findViewById(R.id.dec_status_waiting_data)),
|
||||
new Pair<>(DecryptionStatus.NOT_DECRYPTABLE, findViewById(R.id.dec_status_not_decryptable)),
|
||||
new Pair<>(DecryptionStatus.TLS_ERROR, findViewById(R.id.dec_status_error))
|
||||
new Pair<>(DecryptionStatus.ERROR, findViewById(R.id.dec_status_error))
|
||||
));
|
||||
|
||||
if(CaptureService.isDecryptingTLS()) {
|
||||
|
||||
@ -54,7 +54,7 @@ public class ConnectionOverview extends Fragment implements ConnectionDetailsAct
|
||||
private ConnectionDescriptor mConn;
|
||||
private TableLayout mTable;
|
||||
private TextView mBytesView;
|
||||
private TextView mPayload;
|
||||
private TextView mPayloadLen;
|
||||
private TextView mPacketsView;
|
||||
private TextView mDurationView;
|
||||
private TextView mBlockedPkts;
|
||||
@ -106,7 +106,7 @@ public class ConnectionOverview extends Fragment implements ConnectionDetailsAct
|
||||
FlagImageView country_flag = view.findViewById(R.id.country_flag);
|
||||
TextView asn = view.findViewById(R.id.asn);
|
||||
mTable = view.findViewById(R.id.table);
|
||||
mPayload = view.findViewById(R.id.detail_payload);
|
||||
mPayloadLen = view.findViewById(R.id.detail_payload);
|
||||
mBytesView = view.findViewById(R.id.detail_bytes);
|
||||
mPacketsView = view.findViewById(R.id.detail_packets);
|
||||
mBlockedPkts = view.findViewById(R.id.blocked_pkts);
|
||||
@ -227,7 +227,7 @@ public class ConnectionOverview extends Fragment implements ConnectionDetailsAct
|
||||
public void connectionUpdated() {
|
||||
Context context = mBytesView.getContext();
|
||||
|
||||
mPayload.setText(Utils.formatBytes(mConn.payload_length));
|
||||
mPayloadLen.setText(Utils.formatBytes(mConn.payload_length));
|
||||
mBytesView.setText(String.format(getResources().getString(R.string.rcvd_and_sent), Utils.formatBytes(mConn.rcvd_bytes), Utils.formatBytes(mConn.sent_bytes)));
|
||||
mPacketsView.setText(String.format(getResources().getString(R.string.rcvd_and_sent), Utils.formatIntShort(mConn.rcvd_pkts), Utils.formatIntShort(mConn.sent_pkts)));
|
||||
|
||||
@ -254,6 +254,11 @@ public class ConnectionOverview extends Fragment implements ConnectionDetailsAct
|
||||
mError.setTextColor(ContextCompat.getColor(context, R.color.warning));
|
||||
mError.setText(context.getString(R.string.connection_start_not_seen));
|
||||
mError.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if(mConn.payload_length == 0) {
|
||||
mError.setTextColor(ContextCompat.getColor(context, R.color.warning));
|
||||
mError.setText(context.getString(R.string.warn_no_app_data));
|
||||
mError.setVisibility(View.VISIBLE);
|
||||
} else
|
||||
mError.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ public class ConnectionDescriptor {
|
||||
CLEARTEXT,
|
||||
DECRYPTED,
|
||||
NOT_DECRYPTABLE,
|
||||
DECRYPTION_IN_PROGRESS,
|
||||
TLS_ERROR,
|
||||
WAITING_DATA,
|
||||
ERROR,
|
||||
}
|
||||
|
||||
/* Metadata */
|
||||
@ -136,7 +136,6 @@ public class ConnectionDescriptor {
|
||||
public void processUpdate(ConnectionUpdate update) {
|
||||
// The "update_type" is used to limit the amount of data sent via the JNI
|
||||
if((update.update_type & ConnectionUpdate.UPDATE_STATS) != 0) {
|
||||
payload_length = update.payload_length;
|
||||
sent_bytes = update.sent_bytes;
|
||||
rcvd_bytes = update.rcvd_bytes;
|
||||
sent_pkts = update.sent_pkts;
|
||||
@ -152,6 +151,10 @@ public class ConnectionDescriptor {
|
||||
// see MitmReceiver.handlePayload
|
||||
if((status == ConnectionDescriptor.CONN_STATUS_CLOSED) && (decryption_error != null))
|
||||
status = ConnectionDescriptor.CONN_STATUS_CLIENT_ERROR;
|
||||
|
||||
// with mitm we account the TLS payload length instead
|
||||
if(!mitm_decrypt)
|
||||
payload_length = update.payload_length;
|
||||
}
|
||||
if((update.update_type & ConnectionUpdate.UPDATE_INFO) != 0) {
|
||||
info = update.info;
|
||||
@ -228,13 +231,13 @@ public class ConnectionDescriptor {
|
||||
if(isCleartext())
|
||||
return DecryptionStatus.CLEARTEXT;
|
||||
else if(decryption_error != null)
|
||||
return DecryptionStatus.TLS_ERROR;
|
||||
return DecryptionStatus.ERROR;
|
||||
else if(isNotDecryptable())
|
||||
return DecryptionStatus.NOT_DECRYPTABLE;
|
||||
else if(isDecrypted())
|
||||
return DecryptionStatus.DECRYPTED;
|
||||
else
|
||||
return DecryptionStatus.DECRYPTION_IN_PROGRESS;
|
||||
return DecryptionStatus.WAITING_DATA;
|
||||
}
|
||||
|
||||
public static String getDecryptionStatusLabel(DecryptionStatus status, Context ctx) {
|
||||
@ -244,7 +247,7 @@ public class ConnectionDescriptor {
|
||||
case CLEARTEXT: resid = R.string.not_encrypted; break;
|
||||
case NOT_DECRYPTABLE: resid = R.string.not_decryptable; break;
|
||||
case DECRYPTED: resid = R.string.decrypted; break;
|
||||
case DECRYPTION_IN_PROGRESS: resid = R.string.in_progress; break;
|
||||
case WAITING_DATA: resid = R.string.waiting_application_data; break;
|
||||
default: resid = R.string.error;
|
||||
}
|
||||
|
||||
@ -289,6 +292,7 @@ public class ConnectionDescriptor {
|
||||
if(payload_chunks == null)
|
||||
payload_chunks = new ArrayList<>();
|
||||
payload_chunks.add(chunk);
|
||||
payload_length += chunk.payload.length;
|
||||
}
|
||||
|
||||
private boolean hasHttp(boolean is_sent) {
|
||||
|
||||
@ -121,11 +121,11 @@
|
||||
android:text="@string/decrypted"/>
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/dec_status_in_progress"
|
||||
android:id="@+id/dec_status_waiting_data"
|
||||
style="@style/Widget.MaterialComponents.Chip.Choice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/in_progress"/>
|
||||
android:text="@string/waiting_application_data"/>
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/dec_status_not_decryptable"
|
||||
|
||||
@ -310,7 +310,8 @@
|
||||
<string name="decrypted">Decrypted</string>
|
||||
<string name="decryption">Decryption</string>
|
||||
<string name="decryption_filter">Decryption: %1$s</string>
|
||||
<string name="in_progress">In progress</string>
|
||||
<string name="connection_start_not_seen">PCAPdroid has not seen the start of this connection. Some information may be missing</string>
|
||||
<string name="network_traffic">Traffic</string>
|
||||
<string name="warn_no_app_data">No application data has been exchanged</string>
|
||||
<string name="waiting_application_data">Waiting data</string>
|
||||
</resources>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user