ssl_scan 0.0.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.
@@ -0,0 +1,83 @@
1
+ # -*- coding: binary -*-
2
+ require 'timeout'
3
+
4
+ module SSLScan
5
+
6
+ ###
7
+ #
8
+ # This module provides a set of methods for performing various blocking
9
+ # operations in a manner that is compatible with ruby style threads.
10
+ #
11
+ ###
12
+ module ThreadSafe
13
+
14
+ DefaultCycle = 0.2
15
+
16
+ #
17
+ # Wraps calls to select with a lower timeout period and does the
18
+ # calculations to walk down to zero timeout. This has a little room for
19
+ # improvement in that it should probably check how much time actually
20
+ # elapsed during the select call considering ruby threading wont be exactly
21
+ # accurate perhaps.
22
+ #
23
+ def self.select(rfd = nil, wfd = nil, efd = nil, t = nil)
24
+ left = t
25
+
26
+ # Immediately raise a StreamClosedError if the socket was closed. This
27
+ # prevents a bad fd from being passed downstream and solves an issue
28
+ # with Ruby on Windows.
29
+ rfd.each { |fd| raise StreamClosedError.new(fd) if (fd.closed?) } if rfd
30
+
31
+ begin
32
+ orig_size = rfd.length if (rfd)
33
+
34
+ # Poll the set supplied to us at least once.
35
+ begin
36
+ rv = ::IO.select(rfd, wfd, efd, DefaultCycle)
37
+ rescue ::IOError, ::Errno::EBADF, ::Errno::ENOTSOCK
38
+ # If a stream was detected as being closed, re-raise the error as
39
+ # a StreamClosedError with the specific file descriptor that was
40
+ # detected as being closed. This is to better handle the case of
41
+ # a closed socket being detected so that it can be cleaned up and
42
+ # removed.
43
+ rfd.each { |fd| raise StreamClosedError.new(fd) if (fd.closed?) } if rfd
44
+
45
+ # If the original rfd length is not the same as the current
46
+ # length, then the list may have been altered and as such may not
47
+ # contain the socket that caused the IOError. This is a bad way
48
+ # to do this since it's possible that the array length could be
49
+ # back to the size that it was originally and yet have had the
50
+ # socket that caused the IOError to be removed.
51
+ return nil if (rfd and rfd.length != orig_size)
52
+
53
+ # Re-raise the exception since we didn't handle it here.
54
+ raise $!
55
+ # rescue ::Exception => e
56
+ # $stderr.puts "SELECT(#{t}) #{[rfd,wfd,efd].inspect} #{e.class} #{e} #{e.backtrace}"
57
+ end
58
+
59
+ return rv if (rv)
60
+
61
+ # Decrement the amount of time left by the polling cycle
62
+ left -= DefaultCycle if (left)
63
+
64
+ # Keep chugging until we run out of time, if time was supplied.
65
+ end while ((left == nil) or (left > 0))
66
+
67
+ # Nothin.
68
+ nil
69
+ end
70
+
71
+ #
72
+ # Simulates a sleep operation by selecting on nil until a timeout period
73
+ # expires.
74
+ #
75
+ def self.sleep(seconds=nil)
76
+ self.select(nil, nil, nil, seconds)
77
+
78
+ seconds
79
+ end
80
+
81
+ end
82
+
83
+ end
@@ -0,0 +1,9 @@
1
+ module SSLScan
2
+ module VERSION
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ STRING = [MAJOR,MINOR,PATCH].join('.')
8
+ end
9
+ end
data/lib/ssl_scan.rb ADDED
@@ -0,0 +1,11 @@
1
+ require "socket"
2
+ require "openssl"
3
+
4
+ require "ssl_scan/version"
5
+ require "ssl_scan/compat"
6
+ require "ssl_scan/scanner"
7
+ require "ssl_scan/result"
8
+ require "ssl_scan/client"
9
+
10
+ module SSLScan
11
+ end
data/sslscan.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ssl_scan/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ssl_scan"
8
+ spec.version = SSLScan::VERSION::STRING
9
+ spec.authors = ["John Faucett"]
10
+ spec.email = ["jwaterfaucett@gmail.com"]
11
+ spec.summary = %q{Ruby SSL Scanner}
12
+ spec.description = %q{An SSL Scanner Library and Utility in pure Ruby}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ssl_scan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Faucett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-04 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.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: An SSL Scanner Library and Utility in pure Ruby
42
+ email:
43
+ - jwaterfaucett@gmail.com
44
+ executables:
45
+ - ssl_scan
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/ssl_scan
55
+ - lib/ssl_scan.rb
56
+ - lib/ssl_scan/client.rb
57
+ - lib/ssl_scan/compat.rb
58
+ - lib/ssl_scan/exceptions.rb
59
+ - lib/ssl_scan/io/bidirectional_pipe.rb
60
+ - lib/ssl_scan/io/datagram_abstraction.rb
61
+ - lib/ssl_scan/io/ring_buffer.rb
62
+ - lib/ssl_scan/io/stream.rb
63
+ - lib/ssl_scan/io/stream_abstraction.rb
64
+ - lib/ssl_scan/io/stream_server.rb
65
+ - lib/ssl_scan/result.rb
66
+ - lib/ssl_scan/scanner.rb
67
+ - lib/ssl_scan/socket.rb
68
+ - lib/ssl_scan/socket/comm.rb
69
+ - lib/ssl_scan/socket/comm/local.rb
70
+ - lib/ssl_scan/socket/ip.rb
71
+ - lib/ssl_scan/socket/parameters.rb
72
+ - lib/ssl_scan/socket/range_walker.rb
73
+ - lib/ssl_scan/socket/ssl_tcp.rb
74
+ - lib/ssl_scan/socket/ssl_tcp_server.rb
75
+ - lib/ssl_scan/socket/subnet_walker.rb
76
+ - lib/ssl_scan/socket/switch_board.rb
77
+ - lib/ssl_scan/socket/tcp.rb
78
+ - lib/ssl_scan/socket/tcp_server.rb
79
+ - lib/ssl_scan/socket/udp.rb
80
+ - lib/ssl_scan/sync/thread_safe.rb
81
+ - lib/ssl_scan/version.rb
82
+ - sslscan.gemspec
83
+ homepage: ''
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.0.3
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Ruby SSL Scanner
107
+ test_files: []