[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Socks v5 protocol

Tannev Vitaliy

6/11/2008 1:22:00 PM

Hello, only I start to study this language. And at once a greater
problem: ((

I can not understand connection under the report socks5 in any way, and
connection, inquiry of the version and methods of authorization passes
successfully, and here when I try to transfer the removed host and port
I socks-server does not see the address in inquiry, in broad gullies
writes, approximately it:

[11/Jun/2008:16:45:39 MSD] [19267] 192.168.0.9 "" "CONNECT" CONNREFUSED
0 0 - (192.168.0.9:51012 -> 210.199.9.0:0)
[11/Jun/2008:16:45:39 MSD] [19270] [ERRO] $ConnectServing$: (Connection
timed out).
[11/Jun/2008:16:45:39 MSD] [19270] 192.168.0.9 "" "CONNECT" CONNREFUSED
0 0 - (192.168.0.9:51014 -> 210.199.9.0:0)
[11/Jun/2008:16:45:39 MSD] [19272] [ERRO] $ConnectServing$: (Connection
timed out).
[11/Jun/2008:16:45:39 MSD] [19272] 192.168.0.9 "" "CONNECT" CONNREFUSED
0 0 - (192.168.0.9:51016 -> 210.199.9.0:0)


And here a code of connection:


................
sock.setHost("194.67.23.111",25)
..............
def hextobin(str)
temp = str.gsub("\s", "");
ret = []
(0...temp.size()/2).each{|index| ret[index] = [temp[index*2,
2]].pack("H2")}
return ret
end

def setHost(domain,port)
host=domain
h="05 01 00"
if host =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
ip=[$1.to_i,$2.to_i,$3.to_i,$4.to_i].pack('CCC')
h+=" 01 " +[host.size].pack('C')+ip
else
h+=" 03" + [host.size].pack('C') + host
end
h+=[port].pack('n')
@sock.write(hextobin(h))
t=@sock.recv(1).unpack("H*").to_s
return t[3..3]
end
.............



As we see, I ask ip: 194.67.23.111:25, and up to socks-server reaches:
210.199.9.0:0.... I Turn out somehow not so I pack data: (((.. Prompt
please, that can be not so: (((
--
Posted via http://www.ruby-....

2 Answers

Robert Klemme

6/11/2008 1:30:00 PM

0

2008/6/11 Tannev Vitaliy <444ert666@gmail.com>:
> Hello, only I start to study this language. And at once a greater
> problem: ((
>
> I can not understand connection under the report socks5 in any way, and
> connection, inquiry of the version and methods of authorization passes
> successfully, and here when I try to transfer the removed host and port
> I socks-server does not see the address in inquiry, in broad gullies
> writes, approximately it:
>
> [11/Jun/2008:16:45:39 MSD] [19267] 192.168.0.9 "" "CONNECT" CONNREFUSED
> 0 0 - (192.168.0.9:51012 -> 210.199.9.0:0)
> [11/Jun/2008:16:45:39 MSD] [19270] [ERRO] $ConnectServing$: (Connection
> timed out).
> [11/Jun/2008:16:45:39 MSD] [19270] 192.168.0.9 "" "CONNECT" CONNREFUSED
> 0 0 - (192.168.0.9:51014 -> 210.199.9.0:0)
> [11/Jun/2008:16:45:39 MSD] [19272] [ERRO] $ConnectServing$: (Connection
> timed out).
> [11/Jun/2008:16:45:39 MSD] [19272] 192.168.0.9 "" "CONNECT" CONNREFUSED
> 0 0 - (192.168.0.9:51016 -> 210.199.9.0:0)
>
>
> And here a code of connection:
>
>
> ................
> sock.setHost("194.67.23.111",25)
> ..............
> def hextobin(str)
> temp = str.gsub("\s", "");
> ret = []
> (0...temp.size()/2).each{|index| ret[index] = [temp[index*2,
> 2]].pack("H2")}
> return ret
> end
>
> def setHost(domain,port)
> host=domain
> h="05 01 00"
> if host =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
> ip=[$1.to_i,$2.to_i,$3.to_i,$4.to_i].pack('CCC')
> h+=" 01 " +[host.size].pack('C')+ip
> else
> h+=" 03" + [host.size].pack('C') + host
> end
> h+=[port].pack('n')
> @sock.write(hextobin(h))
> t=@sock.recv(1).unpack("H*").to_s
> return t[3..3]
> end
> .............
>
>
>
> As we see, I ask ip: 194.67.23.111:25, and up to socks-server reaches:
> 210.199.9.0:0.... I Turn out somehow not so I pack data: (((.. Prompt
> please, that can be not so: (((

I do not know SOCKS but "CONNREFUSED" usually indicates a network issue, namely:
- firewall blocks access
- there is nothing listening on the socket
- maybe even system is down.

Also, it seems weird that you want to access port 0 (the log says
"210.199.9.0:0") - AFAIK this is reserved and not possible anyways.

Cheers

robert


--
use.inject do |as, often| as.you_can - without end

Tannev Vitaliy

6/11/2008 1:39:00 PM

0

I wish to get access to:
194.67.23.111:25,
but probably data spoil, or I incorrectly send them as socks-server,
thinks, that I want will be connected to:
210.199.9.0:0....

sock.setHost (" 194.67.23.111", 25)

And up to a server why that other data reach: (
--
Posted via http://www.ruby-....