Commit Graph

383 Commits

Author SHA1 Message Date
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
emanuele-f
a924ee5073 Remove symlinks and update dbip to 2021_12 2021-12-14 11:42:55 +01:00
emanuele-f
e270ee8670 Use memory-mapped file for geolocation lookups
This saves ~14 MB of RAM usage due to the loading of mmdb files
2021-12-13 19:41:17 +01:00
emanuele-f
29612b389c Small memory usage improvements
For the foreground, the Loader for the target apps dialog doesn't load
the bitmaps anymore and is destroyed once finished. Bitmaps take lots of
memory, so they should only be loaded when necessary.

For the backgroud, the AppsResolver now loads the virtual/unknown app
icons only if necessary, saving ~0.5 MB when the app is in background.
2021-12-13 18:57:03 +01:00
emanuele-f
e3ecd253ea Fix crash after 28ff23e 2021-12-08 18:33:17 +01:00
emanuele-f
41460fe9cf Add checks in startActivity/ActivityResultLauncher
This prevents crashes when no activity is found to handle the specified
Intent
2021-12-08 11:07:30 +01:00
emanuele-f
c079474917 Rename vpnproxy to pcapdroid 2021-12-06 16:29:37 +01:00
emanuele-f
f78cec5c9f Fix blocking by host not working 2021-12-03 11:58:57 +01:00
emanuele-f
62bb11b251 Improve ID comments 2021-12-02 23:20:13 +01:00
emanuele-f
cc11790f0e Implement features unlock via unlock code 2021-12-02 23:07:53 +01:00
emanuele-f
62c84f9663 Initial firewall implementation (no-root mode)
- Block connections by IP, domain or app
- Add filter to show blocked connections
- Migrate IP matching to ndpi_ptree_t API
- IPv6 addresses now supported in blacklists
- Duplicate IP address rules now only counted once
2021-11-29 22:40:35 +01:00
emanuele-f
8cf67378f5 Fix crash in Android 7
The getParameterCount is only available since API level 26. Using a
patched MaxMind-DB-Reader-java to avoid crashing.

https://developer.android.com/reference/java/lang/reflect/Method#getParameterCount()

java.lang.NoSuchMethodError: No virtual method getParameterCount()I in class Ljava/lang/reflect/Constructor; or its super classes (declaration of 'java.lang.reflect.Constructor' appears in /system/framework/core-oj.jar)
 at com.maxmind.db.Decoder.decodeMapIntoObject(Decoder.java:397)
 at com.maxmind.db.Decoder.decodeMap(Decoder.java:342)
 at com.maxmind.db.Decoder.decodeByType(Decoder.java:162)
 at com.maxmind.db.Decoder.decode(Decoder.java:151)
 at com.maxmind.db.Decoder.decode(Decoder.java:76)
 at com.maxmind.db.Reader.<init>(Reader.java:133)
 at com.maxmind.db.Reader.<init>(Reader.java:90)
 at com.emanuelef.remote_capture.Geolocation.openDb(Geolocation.java:67)
2021-11-23 22:42:08 +01:00
emanuele-f
fafd42f07f Fix bad debug version hyperlink 2021-11-23 11:20:53 +01:00
emanuele-f
2c86fc312d Restart catpure on consecutive start requests
This prevents crashes
2021-11-23 10:22:15 +01:00
emanuele-f
51474d8e12 Sort control permissions by package name
Control permissions is now only shown in the settings if any permission
is set
2021-11-22 19:56:57 +01:00
emanuele-f
b1cd5c77ae Change action name 2021-11-22 19:28:38 +01:00
emanuele-f
6c084e6d81 Add ability to receive Intent on capture stopped 2021-11-22 19:04:07 +01:00
emanuele-f
67c3c7bb99 Add CaptureCtrl status request 2021-11-22 18:19:16 +01:00
emanuele-f
00bfb81dbf Add warning in SOCKS5 mode with no app filter
Closes #143
2021-11-22 16:47:05 +01:00
emanuele-f
a61d8af4c1 Add malware detection warning with private DNS on 2021-11-22 16:15:23 +01:00
emanuele-f
3e522a1786 Properly handle private DNS
PCAPdroid now tracks the private DNS state. Secure DNS queries are now
only blocked when set in opportunistic mode. A notice is now shown when
PCAPdroid has no visibility on the DNS query.

Fixes #130
2021-11-22 15:38:56 +01:00
emanuele-f
6700463155 Remove getBilling from app class 2021-11-22 11:44:55 +01:00
emanuele-f
71a8adda30 Add country flag in the connection details 2021-11-19 22:34:46 +01:00
emanuele-f
b10096bfbe Add malware detection docs link to the app
Closes #140
2021-11-19 18:21:44 +01:00
emanuele-f
ebfcea7217 Ability to manually update the blacklists
The update status is now also shown
2021-11-19 18:21:44 +01:00
emanuele-f
0edba60206 Remove unneded check 2021-11-19 18:21:44 +01:00
MZM
b330f5915d fix some deprecations (#156)
Co-authored-by: mazm <marcel.zipaj-misko@student.tuke.sk>
2021-11-19 18:21:44 +01:00
emanuele-f
3d5ce803a0 Improve layout 2021-11-19 18:21:44 +01:00
emanuele-f
3366a778c6 Improve malware detection overview
- Refresh malware status and blacklists views
- Serialize blacklists info
- Improve layout
2021-11-19 18:21:44 +01:00
emanuele-f
e7b8811f23 Initial malware detection overview (wip)
- Overall status of malware detection
- Show the blacklists used, check their status
- Whitelist moved to this activity
2021-11-19 18:21:44 +01:00
emanuele-f
8399e30fab Add ability to start at boot
Closes #100
2021-11-19 18:21:44 +01:00
emanuele-f
d27334d640 Add button to send crash report via email
Closes #154
2021-11-19 18:21:44 +01:00
emanuele-f
df71db9c89 Use different app id for the debug build 2021-11-19 18:21:44 +01:00
emanuele-f
61a3d24993 Offload connection updates processing
Connection updates are now processed into a separate thread, reducing
the packet processing delay.
2021-11-19 18:21:44 +01:00
emanuele-f
095b301897 Add ability to hide connections matching country 2021-11-19 18:21:44 +01:00
emanuele-f
51a18f3d43 Report full country name and improve conn. layout 2021-11-19 18:21:44 +01:00
emanuele-f
586b26b0b6 Initial geolocation support
Needed for #106
2021-11-19 18:21:36 +01:00
emanuele-f
74056dd36e Add licenses links in about 2021-11-05 22:22:16 +01:00
emanuele-f
eb295f1c04 Improve CaptureCtrl
- The app theme is now honored
- The caller app name and icon is now shown in the request dialog
- It's now possible to grant/deny control requests via permissions
- Control permissions rules can be deleted from the settings activity

Needed for #138
2021-11-04 19:09:25 +01:00
emanuele-f
d7d905b269 Merge branch 'master' into dev 2021-11-04 16:30:52 +01:00
emanuele-f
aff7b0d420 Fix ads webview crash 2021-11-04 14:26:46 +01:00
emanuele-f
184a5c3dd3 Fix past day hours shown as today
Fixes #145
2021-11-03 18:03:58 +01:00
emanuele-f
94d4b7963f Replace "show help" label with "hint" 2021-11-03 16:43:17 +01:00
Stanislav
14424a84ae Changed Help popup to use AlertDialog instead of Toaster. 2021-11-03 16:41:23 +01:00
emanuele-f
0496eec74e Remove edit strings 2021-10-29 16:31:42 +02:00
emanuele-f
2c52eb2bda Hide malware filter if malware detection is off 2021-10-29 16:25:01 +02:00
emanuele-f
aedb505063 Add sku 2021-10-28 14:50:21 +02:00
emanuele-f
c8af0ff7a2 Update Italian localization 2021-10-28 14:10:01 +02:00
emanuele-f
1416328aae Add malware detection ad strings 2021-10-28 12:50:45 +02:00
emanuele-f
f7ac4bc730 Fix hide protocol not working after bd18c5e 2021-10-27 09:45:40 +02:00
emanuele-f
f1cdbebeff Add whois lookup button 2021-10-26 18:17:39 +02:00
emanuele-f
b0698b6246 Add ability to filter plaintext connections
Also add copy request plaintext option in the contextual menu
2021-10-26 16:50:02 +02:00
emanuele-f
431bcd6ba2 Ability to copy host/IP/URL without opening details 2021-10-26 16:24:53 +02:00
emanuele-f
c82b884b87 Current connections filter now shown with chips
Clicking a chip removes the corresponding filter
2021-10-26 15:50:55 +02:00
emanuele-f
eba3eaa572 Add lists help text 2021-10-26 12:12:35 +02:00
emanuele-f
dcdbd527e0 Show blacklisted status in the connection details 2021-10-26 10:46:58 +02:00
emanuele-f
f018c82cc3 If enabled, show allocs summary in the Stats 2021-10-25 17:46:48 +02:00
emanuele-f
dae0f26da9 Upgrade to Android 12 SDK 2021-10-25 12:06:16 +02:00
emanuele-f
c54c5e06fd Add osint.digitalside.it IP blacklist 2021-10-25 11:49:12 +02:00
emanuele-f
875304b918 Billing strings 2021-10-22 18:04:31 +02:00
emanuele-f
903816e836 Fix downloadFile connections not closed 2021-10-21 19:01:53 +02:00
emanuele-f
eece3e8cce Fix domain detection with www prefix
Also add the internetbadguys.com test domain
2021-10-21 16:14:54 +02:00
emanuele-f
bd18c5e195 Add ability to whitelist malicious connections
Needed for #105
2021-10-21 14:49:23 +02:00
emanuele-f
c20b56a4ac Remove apply from EditFilterActivity, add reset 2021-10-21 11:01:17 +02:00
emanuele-f
82850d5680 Implement blacklists reloading from URLs
The blacklists state is shown in the Stats activity.

Needed for #105
2021-10-20 22:02:00 +02:00
emanuele-f
e32b4713a6 Add missing notice 2021-10-20 16:00:21 +02:00
emanuele-f
cb4bbc454d Implement blacklist-based malware detection
A notification is generated when a connection matches known malicious
domains or IP addresses. The connections view reports malicious
connections with a skull icon. A filter can be set to only show them.

Needed for #105
2021-10-20 15:32:29 +02:00
emanuele-f
6b623ea34d Fix bad locale used in Edit Rules 2021-10-19 23:35:02 +02:00
emanuele-f
bb55072f45 Improve buttons style 2021-10-19 22:58:17 +02:00
emanuele-f
79ad691e73 Rename whitelist to hidden connections 2021-10-19 22:07:05 +02:00
emanuele-f
91d3194542 Implement "Edit Filter" activity
- Ability to filter connections by status
- Fix search button sometimes disappearing

Fixes #126
2021-10-19 19:59:50 +02:00
emanuele-f
bb477f9760 Make the whitelist a singleton 2021-10-19 16:08:41 +02:00
emanuele-f
ac77f5a47f Rename MatchList 2021-10-19 15:26:33 +02:00
emanuele-f
9c3c4ba121 Catch SecurityException to prevent crash with URI
A SecurityException occurs when the app does not have the permissions to
write the specified URI
2021-09-15 11:46:27 +02:00
emanuele-f
24f10dd24c Take persistable URI to write PCAPs from cli 2021-09-15 11:17:38 +02:00
emanuele-f
8bb1ff3caf Fix SearchView text not updated on filter 2021-09-11 16:24:47 +02:00
emanuele-f
a083a05f43 Fix boolean Intent options parsing 2021-09-11 15:55:18 +02:00
emanuele-f
ca3889fab9 Improve control via Intent
- Fix app state not refreshed
- Fix VPNService.prepare not called
- Add missing pcap_uri parameter
2021-09-11 15:45:31 +02:00
emanuele-f
8181575f82 Fix wrong app filter shown when started via intents 2021-09-11 12:44:28 +02:00
emanuele-f
b56327af5c Copy action now also dumps request plaintext 2021-09-07 15:50:13 +02:00
emanuele-f
ce941d3999 Add null check 2021-09-07 10:44:15 +02:00
emanuele-f
25f495335a Add ability to select interface in root mode
Closes #110
2021-08-25 21:48:48 +02:00
emanuele-f
bdba16562d Add PCAPdroid API documentation
See #33
2021-08-20 15:21:26 +02:00
emanuele-f
1c5995e01e Implement start via intent
User permission is asked every time the intent is fired. Stopping capure
is allowed to the same app which started it without asking permission.

See #33
2021-08-20 00:58:22 +02:00
emanuele-f
dc1b5dc1b5 Remove "rate app" menu entry 2021-07-19 18:39:57 +02:00
emanuele-f
479aeb794b Add search by source port via exact match 2021-07-16 12:21:55 +02:00
emanuele-f
5637191b13 Add TCP flags for debugging 2021-07-16 12:15:28 +02:00
emanuele-f
bc28244e21 Rework time handling
Periodic tasks are now based on a monotonic timer. The timestamp in
the exported PCAP now corresponds to the original timestamp when using
root. Moreover, in-app first/last seen time now displays the milliseconds.

Closes #89
2021-07-06 15:54:26 +02:00
emanuele-f
4846a0b546 Add preference to toggle the PCAPdroid trailer
Closes #36
2021-07-04 15:08:08 +02:00
emanuele-f
0a935be6e4 Initial export of app info in PCAP
Initial work for #36
2021-07-02 00:45:19 +02:00
emanuele-f
da141fa8df Cleanup pcap_utils 2021-07-01 18:58:37 +02:00
emanuele-f
51dc0dde7e Fix bogus connections with root due to fragments
Connections with random ports sometimes appeared while capturing packets
as root, in particular while exporting data via the UDP exporter. These
were actually IP fragments, whose data was misinterpreted due to the
lack of L4 headers.
2021-07-01 18:27:28 +02:00
emanuele-f
9d427461cb Fix UDP exporter and HTTP dump modes with root
When exporting traffic over the network, we must exclude this traffic
from the monitoring, otherwise the traffic will be captured in a loop
2021-07-01 14:30:37 +02:00
emanuele-f
91cc995eff Refactor PCAP dump
PCAP dump now always occurs in Java
2021-07-01 11:01:15 +02:00
emanuele-f
258930d110 Fix multiple issues with ICMP connections
- Fix ping to known DNS servers being blocked
- Hide port number for ICMP connections
- Fix monodirectional ICMP connnections in root mode
2021-06-30 17:31:41 +02:00
emanuele-f
ca7c8127d9 Hide connections matching whitelist after delay
Some info of the connections, such as the host and the protocol, can
become available after the connection has been shown. Such info could
determine a match with the whitelist, in which case the connection must
be hidden.
2021-06-29 19:39:11 +02:00
emanuele-f
5b50e3e8a1 Optimize JNI calls on connections updates
Connections data is now split into three groups:

- The connection identifier (e.g. 5 tuple)
- The connection statistics
- The connection L7 information (e.g. HTTP URL and request data)

With this optimization, most updates will only pass the connection
statistics throught the JNI interface. The connection identifier will
only be passed for new connections and the L7 information will only be
passed when needed (e.g. after extracting the URL).

Closes #82
2021-06-29 15:31:30 +02:00
emanuele-f
f1a69ccfa7 Fix missing save button with open search bar 2021-06-29 01:01:17 +02:00
emanuele-f
69f21be864 Allow searching by destination port 2021-06-28 23:55:04 +02:00
emanuele-f
a1f96c08ed Implement separate connections activity
This allows filtering by app by keeping activities navigation
consistent
2021-06-28 23:50:55 +02:00
emanuele-f
762b09620e Add copy/share to the App Details activity 2021-06-28 23:12:34 +02:00
emanuele-f
b308666687 Add packet drops for root capture 2021-06-27 19:43:18 +02:00
emanuele-f
bfb1390499 Implement app details
Show information about an app, including its target SDK version,
install/update date and its requested permissions. Also add a button to
quickly open the app info/settings in android.

Closes #45
2021-06-25 14:50:38 +02:00
emanuele-f
6b3fb1c2d0 Fix root domain rule label 2021-06-25 09:22:56 +02:00
emanuele-f
01b4fa1a60 Add null check 2021-06-14 18:34:38 +02:00
emanuele-f
0c4b33c4ba Implement ability yo search connections
Through the search bar is now possible to search connections by host,
IP, protocol, uid, app name or package name.

Closes #67
2021-06-14 18:25:58 +02:00
emanuele-f
209b24ccd6 Remove leftover 2021-06-14 15:47:35 +02:00
emanuele-f
66f27ff805 Add ability to copy/share whitelist 2021-06-14 15:38:29 +02:00
emanuele-f
f49c34ddec Rework whitelist
The whitelist editor is now a separate activity. Whitelist removed from
the ConnectionRegister.
2021-06-14 15:21:57 +02:00
emanuele-f
9b7675d6e2 Rename "exclusions" to "whitelist" 2021-06-14 11:15:36 +02:00
emanuele-f
c5ef7caf31 Fix label for apps exclusions 2021-06-11 21:19:27 +02:00
emanuele-f
a642ddbd0d Optimize connections matching 2021-06-11 21:01:17 +02:00
emanuele-f
8701eb9145 Add ability to exclude a root domain 2021-06-11 18:53:09 +02:00
emanuele-f
2983be8ecf Optimize adapter ops with connections filters 2021-06-11 18:22:25 +02:00
emanuele-f
c190caadfd Fix app filter not working when using exclusions 2021-06-11 15:29:10 +02:00
emanuele-f
4a4886b0ed Make exclusions persistent 2021-06-09 16:52:46 +02:00
emanuele-f
404f5e0238 Implement ability to ignore connections
An exclusion list can now be created to hide connections matching the
specified host, app, IP address or protocol.

Closes #68
2021-06-09 15:35:45 +02:00
emanuele-f
0d48c1f141 Fix deprecations 2021-06-05 13:06:02 +02:00
Taco
c28acd2804
Fix several deprecations (#63)
* Update Gradle and RecyclerView
* Use FragmentContainerView
* Fix onActivityResult deprecations
* Fix onRequestPermissionsResult deprecation

Co-authored-by: emanuele-f <black.silver@hotmail.it>
2021-06-05 11:47:31 +02:00
emanuele-f
50bc81e575 Show request plaintext regardless of the protocol 2021-06-03 12:27:28 +02:00
emanuele-f
78d2e12233 Add ads placeholders 2021-06-03 11:36:06 +02:00
emanuele-f
e65ff93972 Add ability to read the root daemon log 2021-06-02 00:01:10 +02:00
emanuele-f
f777ed16c2 String trailing newlines from HTTP request data 2021-06-01 22:39:07 +02:00
emanuele-f
1f32813f1f HTTP requests data is now shown in the details
Also move to the material theme

Closes #38
2021-06-01 19:02:17 +02:00
emanuele-f
2ff3fec947 Fix URL when an HTTP proxy is used
Also show the proxy URL in the connection details
2021-05-01 16:42:53 +02:00
emanuele-f
c2df8436ab Implement ability to capture packets as root
This requires a rooted device. It allows PCAPdroid to run with other VPN
apps.
2021-05-01 12:02:48 +02:00
emanuele-f
72949b0284 Update zdtun 2021-04-14 12:32:42 +02:00
emanuele-f
b02989598f Implement SOCKS5 proxy support
When enabled, all the TCP connections will be redirected to a SOCKS5
proxy. This also removes the need to use a customized mitmproxy to
perform the TLS decryption.
2021-04-09 10:52:25 +02:00