-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compilation #16
Comments
First of all, I would like to mention, that when you forward UDP over Socks5 you still work via UDP. Second. You'll need cross-compiler to compile redsocks for android. It includes gcc/binutils toolchain (it's probably shipped with android SDK) and headers for libevent. Third. As soon as it does not look like bug in redsocks, it may be more productive to discuss the issue in mailing list - someone else beside me will be able to answer your questions. :) |
I think to well understand the Socks5 protocol. here is the configuration file : // dest_ip = 127.0.0.1; This is the flow :
I am not sure is a bug or not, but what is correct adress/port ? :1984 or :9500 or :8123 in my case ? I will see how to use binutils toochain. That work on windows ? I will also try to use the dnstc I suppose that I have to forward udp 53 to redsocks port 5300 in place of 8123? Android should use TCP 53 after some times ? |
Ok, my best guess is that your UDP ASSOCIATE reply is wrong. Android NDK works on windows: http://developer.android.com/sdk/ndk/index.html Dnstc will not probably work in your case, I'm almost sure that android will not fallback to TCP on truncated reply. |
Thanks for the suggestion. The UDP ASSOCIATE reply was wrong !!!! ,see step H) For other peoples that want to understand how socks client - server work, here are some steps I followed : STEP A) resocks parameter file. Only redudp section is interresting. I don't use redsocks section for nowbase { redudp { // dest_ip = 127.0.0.1; //dnstc { STEP B) Iptablesiptables -t nat -N TETHER iptables -t nat -A TETHER -j LOG --log-uid --log-level debug --log-prefix "MYPREROUTING " --log-ip-options iptables -t nat -A TETHER -p udp --dport 53 -j REDIRECT --to 8123 iptables -t nat -A OUTPUT -j TETHER DNS is then send to redudp port 8123 STEP C) DNS send a queryredudp receive it on port 8123 STEP D) resocks connect to my TCP server (not udp) on port 1984.Local port is random (58148) STEP E) resocks send first packet (startSession)data : 05 01 00 -> VER5 , 1 method , method 0 STEP F) server responsedata : 05 00 -> VER5 , use method 0 (AuthenticatorNone) STEP G) resocks send SOCKS_CMD_UDP_ASSOCIATEdata : 05 03 00 01 00 00 00 00 00 00 -> VER5 , Command3 (UDP_ASSOCIATE) , reserved0 , addrType1 , adress (00 00 00 00) , port (00 00) STEP H) My server send the UDP relay adressfrom rfc1928-socks5 :In the reply to a UDP ASSOCIATE request, the BND.PORT and BND.ADDR -> This was my error : I used the 0.0.0.0 adress ->VER5 , SOCKS_SUCCESS(0) , reserved0 , adress (127.0.0.1), port (9500) STEP I) redsocks send the datagram with an headerData : 00 00 00 01 7F 00 00 01 25 1C 01 95 01 00 00 01 00 00 00 00 00 00 03 77 77 77 06 67 6F 6F ... STEP J) relay process the DNS query and replay to resocksData : 00 00 00 01 7F 00 00 01 25 1C 01 95 81 80 00 01 00 07 00 00 00 00 03 77 77 77 06 67 6F 6F ... from rfc1928-socks5 :When a UDP relay server receives a reply datagram from a remote host, it I am not sure what to put in adress and port, so I put the same value as the request. Just the data is different. |
That's great that you've learned some bits of Socks5 protocol, but... I think, it is easier to rely on conntrack to do address rewriting and REDIRECT UDP packet directly to your application, that implements DNS over USB :) Just FYI. |
Hi.
I work since 3 months on a reverse tethering program for android.
I have problem with the redsocks program .I want to forward UDP (DNS)
The packet send from redsocks is well received in my java program. (rfc1928-socks5.txt -> UDP ASSOCIATE)
I decode the stream (reserved2 frag1 addrType1 adrN port2 dataN) send by redsocks to remove the header and pass the buffer to my host .
Host respond correctly (with dns answer),
I add an header (reserved2 frag1 addrType1 adrN port2 dataN) and send back to redsocks.
I got this error in redsock log :
1320607466.643320 redudp.c:471 redudp_pkt_from_socks(...) [192.168.1.2:62473->127.0.0.1:9500]: Got packet from unexpected address 127.0.0.1:9500.
It seams that redudp_pkt_from_socks() don't parse the header correctly
So I would like to compile the library to add traces (client->udprelayaddr) to understand the problem.
The question is how to compile redsocks (for android) ???
I am a basically a windows developper.
I installed kunbuntu on a virtual machine to compile, but when I run 'make' I have this error :
utils.h:6:19: fatal error: event.h: No such file or directory
Libevent is required. Do I need to add an "include" tag somewhere with the correct path ?
Do I have to compile libevent first and how ?
Any help ???
Thanks in adance
The text was updated successfully, but these errors were encountered: