emanuele-f / PCAPdroid

No-root network monitor, firewall and PCAP dumper for Android
https://emanuele-f.github.io/PCAPdroid
GNU General Public License v3.0
2.43k stars 286 forks source link

pcapdroid mitmproxy crashes with wireguard mode and transparency mode #464

Closed kevin0t closed 1 month ago

kevin0t commented 1 month ago

setup a tls decryption using normal steps . selected an app in decryption rule , then selected a target app. In settings in Additional mitmproxy options i have set the argument as --mode wireguard:/storage/emulated/0/Download/pcapdroid/wireguard.conf' ( i have specified directory for saving wg config as per the mitmproxy documentation). Without specifying the config file directory , i won't know from where to get the config. Also the client won't be able to connect without config keys. Here is its crash log - pcapdroid_crash.log

Also using --mode transparent gives an error and capture refuses to start and asks to check log. The log shows this. /Oct/2024 17:55:01 - mitmdump -q --set onboarding=false --listen-host 127.0.0.1 -p 7780 --mode socks5 --proxyauth UI3qrOfL:cMBOLJFf --ssl-insecure --mode transparent

emanuele-f commented 1 month ago

--mode wireguard:/storage/emulated/0/Download/pcapdroid/wireguard.conf'

The issue is that the mitm addon does not have files access by default, so it cannot access the Download directory.

You need to grant files access. Open the mitm app, click on Addons and then select "Enable files access" from the menu

2024-10-18_11-39

--mode transparent

The issue here is that it will try to use the same port as the sock5 mode, causing an error. To fix this you need to specify a different port, e.g. --mode transparent@9090

kevin0t commented 1 month ago

thanks for the answers ! , the config file did generate after i gave mitm addon file access permission. Though it just gave the private and public keys in the config. I had to enter the ip address config in it. Also i think pcapdroid still creates a socks server despite a wg server is running.

Though i also realize that the usage of these modes like transparency mode with pcapdroid wouldn't make much sense. Particularly the wireguard mode was made to be used by an external client. If in future a use case comes , this feature could be looked at deeply.