3

I am looking for a SOCKS proxy server I can run on my Android phone. I could only find some commercial apps, but would prefer a FOSS alternative.

It does not need to be an app: a binary I can run from adb shell would work as well, but I'd prefer it if it does not require root.

8
  • What about using ssh and it's -D option? ssh -D 8888 user@phone-ip on your PC, then use 127.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))
    – confetti
    Commented Feb 20, 2020 at 17:01
  • My phone does not currently have a SSHD. I found SimpleSSHD, but it does not support SOCKS: f-droid.org/en/packages/org.galexander.sshd
    – NanoBabo
    Commented Feb 20, 2020 at 17:15
  • Argh, SimpleSSHD is what I was referring to. I'm not aware of another FOSS SSH server for android (that also supports -D).
    – confetti
    Commented Feb 20, 2020 at 17:21
  • Ohh, so you're saying that SimpleSSHD includes a SOCKS proxy server? I did not try, just read that it didn't... Giving it a try now!
    – NanoBabo
    Commented Feb 20, 2020 at 17:31
  • 1
    @IrfanLatif I circumvent this by using a VPN service, port forwarding is done via the VPN (to a non-standard port for security reasons, specified on ssh using -p <port>.
    – confetti
    Commented Feb 20, 2020 at 19:25

2 Answers 2

4

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.

3
  • 1
    It performs poor with parallel TCP connections. And doesn't support UDP associate, right? So not useful with games, VoIP etc. Btw Termux does have sshd. A more clean CLI solution. Commented Feb 20, 2020 at 18:47
  • 1
    @IrfanLatif I'm not sure about the underlying techs of it, I used this solution before for rather low-bandwidth applications, but VoIP (with webcam) worked flawlessly.
    – confetti
    Commented Feb 20, 2020 at 19:26
  • Awesome! This helped me overcome the tethering blocking of my SIM card.
    – k_o_
    Commented Dec 22, 2022 at 22:39
0

If you want to get a SOCKS proxy of your mobile Internet, you can connect it over USB.

  1. Go to developer settings, enable USB debugging
  2. Connect USB cable
  3. Install adb. In Debian, this is sudo apt install adb
  4. Forward the port 2222 by doing adb forward tcp:2222 tcp:2222
  5. Start the sshd
  6. Set up proxy by doing ssh -D 8899 127.0.0.1 -p 2222, where 8899 is the desired port of your proxy.

Not the answer you're looking for? Browse other questions tagged .