socksify 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/socksify.rb +22 -18
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24bd364bbfc92b361cbd76623e0394476141f9f8
|
4
|
+
data.tar.gz: 72d2a6761ee659f0b96773048c6f1834d205e7a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9cf647a3dacbf545aad7e89779b34098b624614548572aee91210ca3387320b1b549db82ecebf84d236679a631f6bf87b7ad37883de3ad132427ebc50a98ea
|
7
|
+
data.tar.gz: 4011606be7484d050d32b37825f3fe5c340557b50c5be0eb3f25588d89ecbe22bc82b7e13833030f860d70e5a20ef7079219e296c24836b117ca4672b02444ca
|
data/lib/socksify.rb
CHANGED
@@ -221,40 +221,42 @@ class TCPSocket
|
|
221
221
|
# Connect
|
222
222
|
def socks_connect(host, port)
|
223
223
|
port = Socket.getservbyname(port) if port.is_a?(String)
|
224
|
+
req = String.new
|
224
225
|
Socksify::debug_debug "Sending destination address"
|
225
|
-
|
226
|
+
req << TCPSocket.socks_version
|
226
227
|
Socksify::debug_debug TCPSocket.socks_version.unpack "H*"
|
227
|
-
|
228
|
-
|
229
|
-
|
228
|
+
req << "\001"
|
229
|
+
req << "\000" if @@socks_version == "5"
|
230
|
+
req << [port].pack('n') if @@socks_version =~ /^4/
|
230
231
|
|
231
232
|
if @@socks_version == "4"
|
232
233
|
host = Resolv::DNS.new.getaddress(host).to_s
|
233
234
|
end
|
234
235
|
Socksify::debug_debug host
|
235
236
|
if host =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ # to IPv4 address
|
236
|
-
|
237
|
+
req << "\001" if @@socks_version == "5"
|
237
238
|
_ip = [$1.to_i,
|
238
239
|
$2.to_i,
|
239
240
|
$3.to_i,
|
240
241
|
$4.to_i
|
241
242
|
].pack('CCCC')
|
242
|
-
|
243
|
+
req << _ip
|
243
244
|
elsif host =~ /^[:0-9a-f]+$/ # to IPv6 address
|
244
245
|
raise "TCP/IPv6 over SOCKS is not yet supported (inet_pton missing in Ruby & not supported by Tor"
|
245
|
-
|
246
|
+
req << "\004"
|
246
247
|
else # to hostname
|
247
248
|
if @@socks_version == "5"
|
248
|
-
|
249
|
+
req << "\003" + [host.size].pack('C') + host
|
249
250
|
else
|
250
|
-
|
251
|
-
|
251
|
+
req << "\000\000\000\001"
|
252
|
+
req << "\007\000"
|
252
253
|
Socksify::debug_notice host
|
253
|
-
|
254
|
-
|
254
|
+
req << host
|
255
|
+
req << "\000"
|
255
256
|
end
|
256
257
|
end
|
257
|
-
|
258
|
+
req << [port].pack('n') if @@socks_version == "5"
|
259
|
+
write req
|
258
260
|
|
259
261
|
socks_receive_reply
|
260
262
|
Socksify::debug_notice "Connected to #{host}:#{port} over SOCKS"
|
@@ -321,21 +323,23 @@ module Socksify
|
|
321
323
|
s = TCPSocket.new
|
322
324
|
|
323
325
|
begin
|
326
|
+
req = String.new
|
324
327
|
Socksify::debug_debug "Sending hostname to resolve: #{host}"
|
325
|
-
|
328
|
+
req << "\005"
|
326
329
|
if host =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ # to IPv4 address
|
327
|
-
|
330
|
+
req << "\xF1\000\001" + [$1.to_i,
|
328
331
|
$2.to_i,
|
329
332
|
$3.to_i,
|
330
333
|
$4.to_i
|
331
334
|
].pack('CCCC')
|
332
335
|
elsif host =~ /^[:0-9a-f]+$/ # to IPv6 address
|
333
336
|
raise "TCP/IPv6 over SOCKS is not yet supported (inet_pton missing in Ruby & not supported by Tor"
|
334
|
-
|
337
|
+
req << "\004"
|
335
338
|
else # to hostname
|
336
|
-
|
339
|
+
req << "\xF0\000\003" + [host.size].pack('C') + host
|
337
340
|
end
|
338
|
-
|
341
|
+
req << [0].pack('n') # Port
|
342
|
+
s.write req
|
339
343
|
|
340
344
|
addr, _port = s.socks_receive_reply
|
341
345
|
Socksify::debug_notice "Resolved #{host} as #{addr} over SOCKS"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socksify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Maka
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description:
|
19
19
|
email: stephan@spaceboyz.net
|
@@ -21,8 +21,8 @@ executables:
|
|
21
21
|
- socksify_ruby
|
22
22
|
extensions: []
|
23
23
|
extra_rdoc_files:
|
24
|
-
- doc/index.html
|
25
24
|
- doc/index.css
|
25
|
+
- doc/index.html
|
26
26
|
- COPYING
|
27
27
|
files:
|
28
28
|
- COPYING
|
@@ -33,7 +33,9 @@ files:
|
|
33
33
|
- lib/socksify/debug.rb
|
34
34
|
- lib/socksify/http.rb
|
35
35
|
homepage: http://socksify.rubyforge.org/
|
36
|
-
licenses:
|
36
|
+
licenses:
|
37
|
+
- Ruby
|
38
|
+
- GPL-3.0
|
37
39
|
metadata: {}
|
38
40
|
post_install_message:
|
39
41
|
rdoc_options: []
|
@@ -51,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
53
|
version: '0'
|
52
54
|
requirements: []
|
53
55
|
rubyforge_project: socksify
|
54
|
-
rubygems_version: 2.
|
56
|
+
rubygems_version: 2.5.2
|
55
57
|
signing_key:
|
56
58
|
specification_version: 4
|
57
59
|
summary: Redirect all TCPSockets through a SOCKS5 proxy
|