socksify 1.6.0 → 1.7.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/socksify.rb +8 -1
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a86f51b885a36af4bf34d20dbc8476485a583635
4
- data.tar.gz: 0b6b59f257862b1f8010288321b1407ea7efdfd0
3
+ metadata.gz: de7d71ec280f514fb083bd26f34b76ce14a2c82d
4
+ data.tar.gz: 10454a02092c6e14884441f90997b17ed92ee27a
5
5
  SHA512:
6
- metadata.gz: 282b936cdf5c9d21b9a6fbec35e58e8923f17bbf3a6e073a8d70c78d2abf7421147c9bc79670af9bb90e70245c34b8bff4b9a75ac274b179977f2efa15b8189c
7
- data.tar.gz: 39051b34bb2ab7b0524d016c3dbb3815f89e3f6048c4b2d75f5af08d85bfc35276dedb20f0687620d8a023d5592911fb525e4d334d16fca701f12379f4d2cb6b
6
+ metadata.gz: 9bb3836afe02eadd52465295fe8428e3e9424a139271abf08951722a3195bf56b0093611c80a557e1d836faf0a498f3795953caf63e9a32ec0175562e9dc4b6c
7
+ data.tar.gz: 00deeb904f05fe9be737fbae6b2633ecc234b81c9841c4fd99718076b0b657b3d24399b5e890ff884e7e5899644191b7272a0f59b22e59beb6324230fa109210
@@ -191,6 +191,9 @@ class TCPSocket
191
191
  end
192
192
  Socksify::debug_debug "Waiting for authentication reply"
193
193
  auth_reply = recv(2)
194
+ if auth_reply.empty?
195
+ raise SOCKSError.new("Server doesn't reply authentication")
196
+ end
194
197
  if auth_reply[0..0] != "\004" and auth_reply[0..0] != "\005"
195
198
  raise SOCKSError.new("SOCKS version #{auth_reply[0..0]} not supported")
196
199
  end
@@ -217,6 +220,7 @@ class TCPSocket
217
220
 
218
221
  # Connect
219
222
  def socks_connect(host, port)
223
+ port = Socket.getservbyname(port) if port.is_a?(String)
220
224
  Socksify::debug_debug "Sending destination address"
221
225
  write TCPSocket.socks_version
222
226
  Socksify::debug_debug TCPSocket.socks_version.unpack "H*"
@@ -261,6 +265,9 @@ class TCPSocket
261
265
  Socksify::debug_debug "Waiting for SOCKS reply"
262
266
  if @@socks_version == "5"
263
267
  connect_reply = recv(4)
268
+ if connect_reply.empty?
269
+ raise SOCKSError.new("Server doesn't reply")
270
+ end
264
271
  Socksify::debug_debug connect_reply.unpack "H*"
265
272
  if connect_reply[0..0] != "\005"
266
273
  raise SOCKSError.new("SOCKS version #{connect_reply[0..0]} is not 5")
@@ -330,7 +337,7 @@ module Socksify
330
337
  end
331
338
  s.write [0].pack('n') # Port
332
339
 
333
- addr, port = s.socks_receive_reply
340
+ addr, _port = s.socks_receive_reply
334
341
  Socksify::debug_notice "Resolved #{host} as #{addr} over SOCKS"
335
342
  addr
336
343
  ensure
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.6.0
4
+ version: 1.7.0
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: 2014-08-25 00:00:00.000000000 Z
16
+ date: 2015-07-31 00:00:00.000000000 Z
17
17
  dependencies: []
18
18
  description:
19
19
  email: stephan@spaceboyz.net
@@ -51,9 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  version: '0'
52
52
  requirements: []
53
53
  rubyforge_project: socksify
54
- rubygems_version: 2.2.2
54
+ rubygems_version: 2.4.5
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: Redirect all TCPSockets through a SOCKS5 proxy
58
58
  test_files: []
59
- has_rdoc: false