Use SSH!
You can use the FOSS application SimpleSSHD for this! You can get it directly from that link, the Google Play Store or using the F-droid app store on your phone.
Once setup you can connect to your device using either your LAN or WAN IP from your PC like this:
ssh -D 8899 <PHONE-IP> -p <SSD PHONE PORT>
The -D
option sets up a local "dynamic" application-level port forwarding
, which essentially makes ssh act like a SOCKS5 (SOCKS4 is supported as well) proxy server. SimpleSSHD will show the IP, selected port and password.
After this, you can set your proxy to 127.0.0.1:8899
on your PC. I've tested it with curl:
curl --socks5 127.0.0.1:8899 https://myip.is
And it worked! Note that I did not even need root for this, it worked as the normal android user.
Note that if you want to use your mobile network for this your cell provider might not let you connect to SSHD using the WAN IP. A VPN can circumvent this if necessary.
-D
option?ssh -D 8888 user@phone-ip
on your PC, then use127.0.0.1:8888
as proxy server. Tested on iOS but should work on Android aswell. (An SSH server must be installed on the phone, of course. (A FOSS one is on F-Droid))-D
).ssh
using-p <port>
.