diff --git a/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java b/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java index f07a5bae..17b28532 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java +++ b/app/src/main/java/com/emanuelef/remote_capture/activities/CaptureCtrl.java @@ -42,6 +42,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.emanuelef.remote_capture.AppsResolver; +import com.emanuelef.remote_capture.BuildConfig; import com.emanuelef.remote_capture.CaptureHelper; import com.emanuelef.remote_capture.CaptureService; import com.emanuelef.remote_capture.PCAPdroid; @@ -207,6 +208,8 @@ public class CaptureCtrl extends AppCompatActivity { Log.d(TAG, "Returning status"); res.putExtra("running", CaptureService.isServiceActive()); + res.putExtra("version_name", BuildConfig.VERSION_NAME); + res.putExtra("version_code", BuildConfig.VERSION_CODE); } else { Log.e(TAG, "unknown action: " + action); abort(); diff --git a/docs/app_api.md b/docs/app_api.md index 4df7cba6..b7649b00 100644 --- a/docs/app_api.md +++ b/docs/app_api.md @@ -69,30 +69,38 @@ Applications interfacing with PCAPdroid should use the `startActivityForResult` As shown above, the capture settings can be specified by using intent extras. The updated list of all the supported parameters is available in [CaptureSettings.java](https://github.com/emanuele-f/PCAPdroid/blob/master/app/src/main/java/com/emanuelef/remote_capture/model/CaptureSettings.java). -| Parameter | Type | Value | -|-------------------------|--------|-------------------------------------------------------------------| -| pcap_dump_mode | string | none \| http_server \| udp_exporter \| pcap_file | -| app_filter | string | the package name of the app to capture | -| collector_ip_address | string | the IP address of the collector in udp_exporter mode | -| collector_port | int | the UDP port of the collector in udp_exporter mode | -| http_server_port | int | the HTTP server port in http_server mode | -| pcap_uri | string | the URI for the PCAP dump in pcap_file mode | -| tls_decryption_enabled | bool | true to enable the SOCKS5 proxy (e.g. for TLS decryption) | -| socks5_proxy_ip_address | string | the IP address of the SOCKS5 proxy | -| socks5_proxy_port | int | the TCP port of the SOCKS5 proxy | -| ipv6_enabled | bool | true to enable IPv6 support in non-root mode | -| root_capture | bool | true to capture packets in root mode, false to use the VPNService | -| pcapdroid_trailer | bool | true to enable the PCAPdroid trailer | -| capture_interface | string | @inet \| any \| ifname - network interface to use in root mode | -| snaplen | int | max size in bytes for each individual packet in the PCAP dump | -| max_pkts_per_flow | int | only dump the first max_pkts_per_flow packets per flow | -| max_dump_size | int | PCAP dump max bytes before the capture is automatically stopped | +| Parameter | Type | Ver | Value | +|-------------------------|--------|-----|--------------------------------------------------------------------| +| pcap_dump_mode | string | | none \| http_server \| udp_exporter \| pcap_file | +| app_filter | string | | the package name of the app to capture | +| collector_ip_address | string | | the IP address of the collector in udp_exporter mode | +| collector_port | int | | the UDP port of the collector in udp_exporter mode | +| http_server_port | int | | the HTTP server port in http_server mode | +| pcap_uri | string | | the URI for the PCAP dump in pcap_file mode | +| tls_decryption_enabled | bool | | true to enable the SOCKS5 proxy (e.g. for TLS decryption) | +| socks5_proxy_ip_address | string | | the IP address of the SOCKS5 proxy | +| socks5_proxy_port | int | | the TCP port of the SOCKS5 proxy | +| ipv6_enabled | bool | | true to enable IPv6 support in non-root mode | +| root_capture | bool | | true to capture packets in root mode, false to use the VPNService | +| pcapdroid_trailer | bool | | true to enable the PCAPdroid trailer | +| capture_interface | string | 42 | @inet \| any \| ifname - network interface to use in root mode | +| snaplen | int | 43 | max size in bytes for each individual packet in the PCAP dump | +| max_pkts_per_flow | int | 43 | only dump the first max_pkts_per_flow packets per flow | +| max_dump_size | int | 43 | PCAP dump max bytes before the capture is automatically stopped | + +The `Ver` column indicates the minimum PCAPdroid version required to use the given parameter. The PCAPdroid version can be queried via the `get_status` action as explained below. *NOTE*: due to [file storage restrictions](https://developer.android.com/about/versions/11/privacy/storage), the `pcap_uri` must point to an app internal directory, e.g. `file:///data/user/0/com.emanuelef.remote_capture/cache/dump.pcap`. ## Query the Capture Status -It is possible to check if the capture is currently running by sending an Intent with the `get_status` action. The response Intent contains the `running` extra, which is `true` if the capture is running. +It is possible to check if the capture is currently running by sending an Intent with the `get_status` action. The response Intent contains the following extras: + +| Field | Type | Value | +|---------------------|--------|-------------------------------------------------------------------| +| version_name | string | the PCAPdroid versionName (e.g. "1.4.5") | +| version_code | int | the PCAPdroid versionCode, an incremental number for the release | +| running | bool | true if the capture is running | Other than via the API, the capture may be manually stopped by the user from the PCAPdroid app. In order to be notified when the capture is stopped, you can create a `BroadcastReceiver` and subscribe to the `com.emanuelef.remote_capture.CaptureStatus` action. Here is an example: