checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb07bd5b043baa9c23a210d3b69a63bfa1a4659b21431402aa52cf4def01a3aa
4
+ data.tar.gz: e99b79f9638840da4aeda3dc8991482ebe2c5f2f91ad262596c7c2d3b7ee9107
5
+ SHA512:
6
+ metadata.gz: d31e65816117bd0bb460098f0f694d3ca3663b04f67054b44577ae76dc27cdec8b3fa1ba8944616ee5282a94c55a53577100fdcaeac7e076907cb1e91fd62e18
7
+ data.tar.gz: 9aa60e5d9fa736118e394292a12f185864de809ba8335add50f5ad1885c993c1b4c84476b1a8d7b2c395a814da7d580b4a43474cc9b8f3805181fad6b489045e
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rspec_status ADDED
@@ -0,0 +1,3 @@
1
+ example_id | status | run_time |
2
+ ---------------------------- | ------ | --------------- |
3
+ ./spec/socket_spec.rb[1:1:1] | passed | 0.04133 seconds |
data/Changelog.md ADDED
@@ -0,0 +1,3 @@
1
+ # Changelog
2
+
3
+ 11-30-2019: Project created
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in dress_socks.gemspec
6
+ gemspec
7
+
8
+ gem "pry", "~> 0.12.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dress_socks (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ diff-lcs (1.3)
11
+ method_source (0.9.2)
12
+ pry (0.12.2)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.9.0)
15
+ rake (10.5.0)
16
+ rspec (3.9.0)
17
+ rspec-core (~> 3.9.0)
18
+ rspec-expectations (~> 3.9.0)
19
+ rspec-mocks (~> 3.9.0)
20
+ rspec-core (3.9.0)
21
+ rspec-support (~> 3.9.0)
22
+ rspec-expectations (3.9.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.9.0)
25
+ rspec-mocks (3.9.0)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.9.0)
28
+ rspec-support (3.9.0)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ bundler (~> 1.17)
35
+ dress_socks!
36
+ pry (~> 0.12.2)
37
+ rake (~> 10.0)
38
+ rspec (~> 3.0)
39
+
40
+ BUNDLED WITH
41
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Justin McNally
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # DressSocks
2
+
3
+ A pure ruby implementation of SOCKSSocket, allowing tunneling a socket through a SOCKS proxy.
4
+
5
+ Based heavily on Socksify, we needed more flexibility in how we setup the tcp connection and only setting it up for certain pieces of code.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'dress_socks'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install dress_socks
22
+
23
+ ## Usage
24
+
25
+ DressSocks::Socket.new(remote_host, remote_port, socks_username: nil, socks_password: nil, socks_server: nil, socks_port: nil, socks_ignore: [], socks_version: '5')
26
+
27
+ Creates a new TCP Socket that tunnels through the socks configuration passed.
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chowly/dress_socks.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dress_socks"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=#x27;\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/dress_socks-0.1.0.gem ADDED
Binary file
data/dress_socks.gemspec ADDED
@@ -0,0 +1,42 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "dress_socks/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dress_socks"
8
+ spec.version = DressSocks::VERSION
9
+ spec.authors = ["Justin McNally"]
10
+ spec.email = ["justin@chowlyinc.com"]
11
+
12
+ spec.summary = 'A pure ruby implementation of SOCKSSocket'
13
+ spec.description = 'SOCKSSocket is great but require a lot of C gymnastics. This aims to do the same thing in all Ruby code.'
14
+ spec.homepage = 'https://github.com/chowly/dress_socks'
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = 'https://rubygems.org'
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://github.com/chowly/dress_socks"
24
+ spec.metadata["changelog_uri"] = "https://github.com/Chowly/dress_socks/blob/master/Changelog.md"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 1.17"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "rspec", "~> 3.0"
42
+ end
data/lib/dress_socks.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "socket"
2
+ require "resolv"
3
+
4
+ require "dress_socks/version"
5
+ require "dress_socks/socket"
6
+ require 'dress_socks/errors'
7
+
8
+ module DressSocks
9
+
10
+ end
data/lib/dress_socks/errors.rb ADDED
@@ -0,0 +1,71 @@
1
+ module DressSocks
2
+ class SOCKSError < RuntimeError
3
+ def initialize(msg)
4
+ super
5
+ end
6
+
7
+ class ServerFailure < SOCKSError
8
+ def initialize
9
+ super("general SOCKS server failure")
10
+ end
11
+ end
12
+ class NotAllowed < SOCKSError
13
+ def initialize
14
+ super("connection not allowed by ruleset")
15
+ end
16
+ end
17
+ class NetworkUnreachable < SOCKSError
18
+ def initialize
19
+ super("Network unreachable")
20
+ end
21
+ end
22
+ class HostUnreachable < SOCKSError
23
+ def initialize
24
+ super("Host unreachable")
25
+ end
26
+ end
27
+ class ConnectionRefused < SOCKSError
28
+ def initialize
29
+ super("Connection refused")
30
+ end
31
+ end
32
+ class TTLExpired < SOCKSError
33
+ def initialize
34
+ super("TTL expired")
35
+ end
36
+ end
37
+ class CommandNotSupported < SOCKSError
38
+ def initialize
39
+ super("Command not supported")
40
+ end
41
+ end
42
+ class AddressTypeNotSupported < SOCKSError
43
+ def initialize
44
+ super("Address type not supported")
45
+ end
46
+ end
47
+
48
+ def self.for_response_code(code)
49
+ case code
50
+ when 1
51
+ ServerFailure
52
+ when 2
53
+ NotAllowed
54
+ when 3
55
+ NetworkUnreachable
56
+ when 4
57
+ HostUnreachable
58
+ when 5
59
+ ConnectionRefused
60
+ when 6
61
+ TTLExpired
62
+ when 7
63
+ CommandNotSupported
64
+ when 8
65
+ AddressTypeNotSupported
66
+ else
67
+ self
68
+ end
69
+ end
70
+ end
71
+ end
data/lib/dress_socks/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module DressSocks
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dress_socks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin McNally
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: SOCKSSocket is great but require a lot of C gymnastics. This aims to
56
+ do the same thing in all Ruby code.
57
+ email:
58
+ - justin@chowlyinc.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".rspec"
64
+ - ".rspec_status"
65
+ - Changelog.md
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - bin/console
72
+ - bin/setup
73
+ - dress_socks-0.1.0.gem
74
+ - dress_socks.gemspec
75
+ - lib/dress_socks.rb
76
+ - lib/dress_socks/errors.rb
77
+ - lib/dress_socks/version.rb
78
+ homepage: https://github.com/chowly/dress_socks
79
+ licenses:
80
+ - MIT
81
+ metadata:
82
+ allowed_push_host: https://rubygems.org
83
+ homepage_uri: https://github.com/chowly/dress_socks
84
+ source_code_uri: https://github.com/chowly/dress_socks
85
+ changelog_uri: https://github.com/Chowly/dress_socks/blob/master/Changelog.md
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.0.6
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: A pure ruby implementation of SOCKSSocket
105
+ test_files: []