hmgle / graftcp

A flexible tool for redirecting a given program's TCP traffic to SOCKS5 or HTTP proxy.
GNU General Public License v3.0
2.07k stars 174 forks source link

Hello, does graftcp support redirect traffic on android or iOS platform ? and UDP packets? #35

Closed fuqiangleon closed 3 years ago

fuqiangleon commented 3 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

hmgle commented 3 years ago

We were aiming for ARM/Linux support for Android, but no plan for iOS and UDP.

fuqiangleon commented 3 years ago

@hmgle Could you share the release date of ARM/Linux? Actually, we are trying to find a way to redirect an App's traffic to a socks5 proxy on Android, but we have not found a suitable method. could you give us some points?

Finally, Graftcp is really a good project, well done.

Thank you very much .

hmgle commented 3 years ago

@fuqiangleon For ARM/Linux, the way of getting or setting values of registers and system calls is different from x86-64, we need to update some functions in util.c to port to ARM architecture, but I have no time to do anything about it right now.

I don't know if proxychains-ng is right for you, if you don't need to support the static link compiled program.

Maybe you can alse take a look at cproxy.

fuqiangleon commented 3 years ago

@hmgle Understood. many thx for your work!

adrianmihalko commented 11 months ago

Hi, is arm now supported? I see some references in the code. If yes, how to compile for arm platform? I want to use on an embedded device, but compile on x86 machine.

hmgle commented 11 months ago

Hi, is arm now supported? I see some references in the code. If yes, how to compile for arm platform? I want to use on an embedded device, but compile on x86 machine.

Yes, arm is supported. You can install the gcc-aarch64-linux compiler toolchain for your embedded device on your X86 machine, and modify the CROSS_COMPILE by make CROSS_COMPILE=your-cross-compile-name. I have tested the program on a Google Cloud arm64 virtual machine before, and it runs normally.

adrianmihalko commented 11 months ago

@hmgle thanks for the fast reply, I compiled using your method, but I have problem with running:

root@vuzero4k:~# ./graftcp
-bash: ./graftcp: No such file or directory
root@vuzero4k:~# file graftcp 
graftcp: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, BuildID[sha1]=26a417bf045a74745bfdd8c2cfbe224d62b6327e, for GNU/Linux 3.2.0, not stripped
root@vuzero4k:~# uname -a
Linux vuzero4k 4.1.20-1.9 #1 SMP Sat May 9 23:16:53 UTC 2020 armv7l GNU/Linux

Maybe the interptreter ld-linux.so.3 is incompatible? For example curl on the same machine using interpreter ld-linux-armhf.so.3.

root@vuzero4k:~# file /usr/bin/curl
/usr/bin/curl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=9976e04eb55d774e1bf77a8b2002f53e565691be, for GNU/Linux 3.2.0, stripped

If this is the case, do you know how to set interpreter /lib/ld-linux-armhf.so.3 for graftcp?

hmgle commented 11 months ago

@adrianmihalko There are many reasons. Does the program have executable permissions? Does the file /lib/ld-linux.so.3 exist on the target machine? If not, you can find the so file from the cross compiler toolchain directory and copy it to the target machine.

You can also try compiling with static linking way:

graftcp: main.o graftcp.o util.o string-set.o conf.o
    $(CC) $^ -o $@ -static

Maybe cross-compiling a simple "hello world" program and testing it first could help troubleshoot this issue.