Commit Graph

310 Commits

Author SHA1 Message Date
emanuele-f
12727bdb24 Add ability to export the SSL/TLS master secrets
When the TLS decryption is enabled, it's now possible to export the
SSLKEYLOGFILE to decrypt the PCAP file in Wireshark. The export only
works when the capture is running.
2022-03-08 23:47:57 +01:00
emanuele-f
0482b066f4 Use the stop command before starting the mitm addon 2022-02-17 12:33:58 +01:00
emanuele-f
0ea7574b41 Add mitm addon version check 2022-02-16 23:51:04 +01:00
emanuele-f
1c0ea6e696 Fix TLS payload sometimes missing with mitm addon
Also report the TLS errors in the connection details
2022-02-16 22:57:00 +01:00
emanuele-f
bfa8a1243d Fix capture termination with the mitm addon 2022-02-16 15:18:30 +01:00
emanuele-f
61330c4fb4 Ability to install the CA certificate via Intent
This works before Android 11. If the installation fails, fall back to
export
2022-02-16 15:10:13 +01:00
emanuele-f
9d5660f2f9 Add mitm addon install link 2022-02-15 19:56:53 +01:00
emanuele-f
00984fc224 Certificate export now uses the MitmService API 2022-02-15 19:02:54 +01:00
emanuele-f
6f42015873 Initial support for built-in TLS decryption
PCAPdroid can now decrypt TLS connections and show the decrypted data
with the help of a separate mitm addon
2022-02-13 00:00:07 +01:00
emanuele-f
b4b172e540 Fix possible NULL pointer access in isRootCapture 2022-02-10 10:11:37 +01:00
emanuele-f
695af4889e Merge branch 'master' into dev 2022-02-09 22:42:49 +01:00
emanuele-f
a9653054ef Avoid ANR when stopping the capture
The threads are now joinined in the background, avoiding to delay the main
thread. This fixes ANR while stopping the capture.

Fixes #186
2022-02-09 22:36:48 +01:00
emanuele-f
955f36b881 Fix start/stop icons appearance when disabled 2022-02-09 22:07:02 +01:00
emanuele-f
e0ccce12c9 Fix CaptureService not stopped properly
When stopping the service, only stopForeground was called, but not
stopSelf. If the process was destroyed (e.g. by swiping the app
from the recent apps), in some cases it would be restarted due to
START_STICKY, causing ForegroundServiceStartNotAllowedException in
Android 12.

Fixes #175
2022-02-09 16:26:38 +01:00
emanuele-f
558e20aef0 Remove the CSV header from translated strings 2022-02-06 11:53:38 +01:00
emanuele-f
c2ad297005 Initial mitmproxy plugin implementation
The pcapdroid_mitm.py plugin allows PCAPdroid to receive the decrypted data from
mitmproxy and display it into the GUI (currently limited to the HTTP request)
2022-02-06 00:27:09 +01:00
emanuele-f
7a1a0e6981 Reaching max_dump_size does not stop the capture
Now only the PCAP dump is stopped when max_dump_size is reached
2022-02-03 11:59:40 +01:00
emanuele-f
f5e0fbd417 Improve HTTP server termination
This prevents synchronization issues on clients not ReadyForData
2022-02-03 11:56:33 +01:00
emanuele-f
18ffc2c374 Fix memory leak in HTTP server mode
When a client stopped the PCAP download, the isCloseConnection did not
detect the close. As a result, the PCAP dump would still be enqueued to
the ChunkedInputStream, causing the memory allocation to raise and never
be free.

Since NanoHTTPD does not seem to provide a way to detect connection close
and since it is not actively maintained, the HTTP server has been
replaced with an ad-hoc implementation which provides the minimal
features PCAPdroid needs to export the PCAP over HTTP.
2022-02-01 17:40:23 +01:00
emanuele-f
987839858d Fix crash on stop with no dump after 672e810 2022-01-29 11:55:21 +01:00
emanuele-f
9052bd8f5f Return the PCAPdroid version in get_status 2022-01-28 18:29:37 +01:00
emanuele-f
672e810bec Improve capture performance with PCAP dump
PCAP dump is now performed into a separate thread. This greatly reduces
the chance for packet loss in root mode as well as preventing latency
spikes in VPN mode.
2022-01-28 18:08:37 +01:00
emanuele-f
e00870b23e New dump parameters for the Intent-based API
- snaplen: limit the size of a every packet
- max_pkts_per_flow
- max_dump_size: stop the capture when the size limit is reached
2022-01-25 15:57:38 +01:00
emanuele-f
41f76486b4 Add requirePreference 2022-01-21 11:36:50 +01:00
emanuele-f
3364a4946e Fix SecurityException with PCAP file dump on Android TV
When no file manager was available, takePersistableUriPermission
was called without an Intent (and the corresponding
FLAG_GRANT_PERSISTABLE_URI_PERMISSION flag), causing a
SecurityException.

Fixes #176
2022-01-21 00:17:14 +01:00
emanuele-f
e76499d02a Add proper support for always-on VPN
The VPN can now be started by the system when the always-on VPN is
enabled. In this case, the stop button is hidden and the previous
configuration is used.

Closes #165

Null intents (e.g. due to START_STICKY) are now handled, which prevents
ForegroundServiceStartNotAllowedException in Android 12.

Fixes #175
2022-01-20 23:12:00 +01:00
emanuele-f
fcd5f34355 Improve app strings
- Remove ending periods and exclamation marks (Material guidelines)
- Improve some apps strings (credits: @comradekingu)
- Improve labels of external projects

Closes #174
2022-01-14 19:52:10 +01:00
emanuele-f
cebeb37a38 Fix CaptureCtrl crash on Android 11/12
The CaptureCtrl is only started when the PCAPdroid control API is
invoked. The crash occurred because getInsetsController was called
before setContentView.

Fixes #179
2022-01-14 12:51:19 +01:00
emanuele-f
e7bc6ba8d1 Fix tests execution 2022-01-11 00:27:00 +01:00
emanuele-f
bd2f85f876 Detect build type to customize error reporting
The error reporting dialog now shows the build type. The dialog is now
shown only on unsupported builds.

Closes #177
2022-01-10 23:23:47 +01:00
emanuele-f
9dc0e1ec83 Add redeem string 2022-01-05 17:01:38 +01:00
emanuele-f
6952e05618 Changes for the billing activity 2022-01-04 01:19:06 +01:00
emanuele-f
d35364dc69 Remove unnecessary app icon drawables copies
This reduces the memory usage when the app is in foreground
2022-01-03 00:32:54 +01:00
emanuele-f
12e4975e66 Workaround for crash in RecyclerView dispatchLayout
In some rare cases the RecyclerView dispatchLayout crashes with an IndexOutOfBoundsException. This seems a bug in the androidx library. The provided workaround should fix it.
2022-01-02 22:26:06 +01:00
emanuele-f
52af258a02 Fix bad ordering of pending updates
Swapping two pending updates with new connections could cause a crash
due to non incremental connection IDs. Also fix crash in case of full
queue.
2022-01-02 22:25:34 +01:00
emanuele-f
b08da2686f Improve connections rollover notice layout 2022-01-02 12:08:47 +01:00
emanuele-f
1ba0d8008f Improve fragments consistency while swiping
While swiping in the viewpager, the fragments onResume may haven't been
called yet. This commit initializes the status fragment before onResume and
also fixes the "No Connections" shown just briefly after the connections
fragment is shown
2022-01-02 11:36:34 +01:00
emanuele-f
ca25ca97fb Add missing synchronization in some methods 2021-12-25 12:44:17 +01:00
emanuele-f
148bfbf617 Add tests for the ConnectionsAdapter 2021-12-25 11:26:37 +01:00
emanuele-f
0c016e30e4 Improve Connections bound checks 2021-12-21 10:43:34 +01:00
emanuele-f
b8276e5233 Fix long click on chatty connections
The RecyclerView animator cancels the touch events whenever a view is
updated, which is a problem when trying to long click an active
connection to show its contextual menu.
2021-12-20 18:38:51 +01:00
emanuele-f
3fc333647b Fix whitelisted connections being blocked
The whitelist logic is now moved to the native side
2021-12-20 17:14:32 +01:00
emanuele-f
49361d05a2 Rework blocklist loading
The new ListDescriptor class now encapsulates the lists
2021-12-20 12:37:32 +01:00
emanuele-f
6846630406 Use memory-wise Android collections
These collections perform generally worse than the Java counterparts but
occupy less memory. The extra computational overhead is mainly visible
for large collections.

- SparseArray/SparseIntArray replaces HashMap
- ArraySet replaces HashSet
2021-12-15 12:26:27 +01:00
emanuele-f
43d9279467 Improve seen interfaces logic 2021-12-14 22:40:23 +01:00
emanuele-f
9140e0b236 Add ability to filter by interface in root mode
When the capture interface is set to "All Interfaces", it is now
possible to filter connections by interface. The interface is also shown
into the connection details.

Closes #163
2021-12-14 22:33:24 +01:00
emanuele-f
63a5826e80 Improve navigation on Android TV 2021-12-14 16:36:51 +01:00
emanuele-f
ef53b36f7a Make wifi hardware not mandatory
Fixes #152
2021-12-14 15:30:50 +01:00
emanuele-f
a9b90d5ff2 Fix deprecation/warning messages
Closes #151
2021-12-14 15:13:16 +01:00
emanuele-f
0d377f757e Remove the DNS server from the Stats if private
If the private DNS is used, remove the it from the Stats activity to
avoid reporting wrong information.

Closes #160
2021-12-14 12:26:57 +01:00