[jdev] Re: Implementing SOCKS5 file transfers

Alexander Wenckus awenckus at mindbridge.com
Tue Jun 28 15:35:55 CDT 2005

Magnus Henoch wrote:

>Alexander Wenckus <awenckus at mindbridge.com> writes:
>>I am having some trouble implementing file transfers i am using both 
>>exodus and PSI to test with. I am attempting to do a direct connection 
>>currently and as far as I know I am implementing the byte stream 
>>correctly because both PSI and Exodus are connecting to my socket 
>>successfully but my problem lies in that I am not sure why they are 
>>sending me what they are sending me and what to do with it. when exodus 
>>connects it sends me three bytes: 5 1 0. 5 I assume is for socks version 
>>5, 1 I assume is for command 1 but shouldn't that be followed with the 
>>addr type, the addr and then the port? Thats if I am reading the JEP 
>>correctly. Irregardless of whatever it means I send back two bytes, 0 0, 
>>as an acknowledgement of the connection but then exodus throws up an 
>>error message, unable to connect to any proxies. From PSI i recieve the 
>>output on the socket 5 2 0 2 and when i attempt to send the ack 0 0 i 
>>get the error,  unable to connect to peer for file transfer. Can anyone 
>>tell me what I am doing wrong? Any help is greatly appreciated.
>Have you read http://www.faqs.org/rfcs/rfc1928.html ?  It will be
>useful to you.
>But to your actual problem: Exodus sending the three bytes 5 1 0.  5
>is indeed the SOCKS version.  1 is the number of authentication
>methods supported - each of them being identified by one byte.  The
>following byte is therefore the only method supported, and 0 means "no
>authentication".  You're supposed to select one method by sending 5,
>X, where X is the number of the method.  Thus, send 5 0.
>Psi apparently supports username/password authentication in addition
>to no authentication... not sure why.
>jdev mailing list
>jdev at jabber.org
Hey thanks for the tip!

It go me through the next step but once again when I attempt to respond 
I hit a snag. Here from both PSI and Exodus i get the same response: 5 1 
0 3. 5 for socks version 5, 1 for command connect, 0 is reserved and 3 
is means address type domain. Then the next 41 bytes are SHA1(sid + 
target + initiator) and then 0 0 for the port. My question is how do I 
respond next? I attempted just changing the 1 in the Rep part of the 
message to 0 to specify success but neither PSI or Exodus liked this. 
What am I doing wrong here? Thanks again in advance for any help that 
can be provided.


More information about the JDev mailing list