ssl_info 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.rubocop.yml +33 -0
- data/.travis.yml +66 -0
- data/CHANGELOG.md +5 -0
- data/CODEOWNERS +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +66 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/ssl-info +63 -0
- data/lib/ssl_info/version.rb +3 -0
- data/lib/ssl_info.rb +99 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/ssl_info_spec.rb +5 -0
- data/ssl_info.gemspec +30 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7997c4976109e8990c2bbe7812bdcd6244be75c5d77fee2704757c0326cfd38c
|
4
|
+
data.tar.gz: d4924340ac0ce2ec021cee896c4d98ae95130272c91d15c9e6b96e5018678ad6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '09d0b6c51a355ac373b1675ef450baa17f5d58fc99de42ff5ab407389e543e62ebd85d005306dbee78ab47b429d58e5a8fb6f1b55794376c18336ce683ea88cb'
|
7
|
+
data.tar.gz: b52ffdeeedc2d6be9d43f3553de1d2cf707774552a22c9651cb8379c812c889b190aa52170d3b215940a0bc34d0b6789a09ede6d8e5967ab56f8da1f6810ac64
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Layout/IndentationWidth:
|
2
|
+
Width: 4
|
3
|
+
|
4
|
+
Metrics/AbcSize:
|
5
|
+
Max: 50
|
6
|
+
|
7
|
+
Metrics/LineLength:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/BlockLength:
|
11
|
+
Max: 40
|
12
|
+
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Max: 20
|
15
|
+
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 60
|
18
|
+
|
19
|
+
Metrics/PerceivedComplexity:
|
20
|
+
Max: 20
|
21
|
+
|
22
|
+
Style/GlobalVars:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/RaiseArgs:
|
26
|
+
EnforcedStyle: compact
|
27
|
+
|
28
|
+
Style/RedundantBegin:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/WordArray:
|
32
|
+
EnforcedStyle: brackets
|
33
|
+
|
data/.travis.yml
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
matrix:
|
2
|
+
include:
|
3
|
+
- language: ruby
|
4
|
+
name: "Bundler (rvm 2.4.4 & bundler 1.17.3)"
|
5
|
+
rvm: 2.4.4
|
6
|
+
before_install:
|
7
|
+
- gem install bundler -v 1.17.3
|
8
|
+
- language: ruby
|
9
|
+
name: "Bundler (rvm 2.4.4 & bundler 2.0.1)"
|
10
|
+
rvm: 2.4.4
|
11
|
+
before_install:
|
12
|
+
- gem install bundler -v 2.0.1
|
13
|
+
- language: ruby
|
14
|
+
name: "Bundler (rvm 2.5.3 & bundler 2.0.1)"
|
15
|
+
rvm: 2.5.3
|
16
|
+
before_install:
|
17
|
+
- gem install bundler -v 2.0.1
|
18
|
+
- language: ruby
|
19
|
+
name: "Bundler (rvm 2.6.1 & bundler 2.0.1)"
|
20
|
+
rvm: 2.6.1
|
21
|
+
before_install:
|
22
|
+
- gem install bundler -v 2.0.1
|
23
|
+
- language: ruby
|
24
|
+
name: "Rubocop (rvm 2.4.4)"
|
25
|
+
env: SKIP_INTERPRETER=true
|
26
|
+
rvm: 2.4.4
|
27
|
+
before_install:
|
28
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git
|
29
|
+
install:
|
30
|
+
- ./rubocop-travis/install.sh
|
31
|
+
script:
|
32
|
+
- ./rubocop-travis/scan.sh
|
33
|
+
- language: ruby
|
34
|
+
name: "Rubocop (rvm 2.5.3)"
|
35
|
+
env: SKIP_INTERPRETER=true
|
36
|
+
rvm: 2.5.3
|
37
|
+
before_install:
|
38
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git
|
39
|
+
install:
|
40
|
+
- ./rubocop-travis/install.sh
|
41
|
+
script:
|
42
|
+
- ./rubocop-travis/scan.sh
|
43
|
+
- language: ruby
|
44
|
+
name: "Rubocop (rvm 2.6.1)"
|
45
|
+
env: SKIP_INTERPRETER=true
|
46
|
+
rvm: 2.6.1
|
47
|
+
before_install:
|
48
|
+
- git clone https://github.com/TravisToolbox/rubocop-travis.git
|
49
|
+
install:
|
50
|
+
- ./rubocop-travis/install.sh
|
51
|
+
script:
|
52
|
+
- ./rubocop-travis/scan.sh
|
53
|
+
- language: ruby
|
54
|
+
name: "Link Checker (rvm 2.6.1)"
|
55
|
+
rvm: 2.6.1
|
56
|
+
before_install:
|
57
|
+
- mkdir travis
|
58
|
+
- git clone https://github.com/TravisToolbox/awesomebot-travis.git travis/awesomebot
|
59
|
+
install:
|
60
|
+
- ./travis/awesomebot/install.sh
|
61
|
+
script:
|
62
|
+
- ./travis/awesomebot/scan.sh
|
63
|
+
notifications:
|
64
|
+
email: false
|
65
|
+
slack:
|
66
|
+
secure: SaC6p3IOApNKL267eyWKHyEHvWLpGLU1H1qCMzzABN2lTspuiqjOsD4uMgOQ9LwGf7lw7Uprb+8oFVq5VaBITbFAEsZ6N0goxN/CZ74K4sekEsXMeMQGQJgTFZBIOvZT7kKpJZQtpwIMVyWSp8LjWfijS6cWvV+vvYW1/uDMS4+SMslqwhysoWED3dNJaNz0O2asujHmOMyOn/MKYHTiUb4lfSu6Vyq1pZ/bbxN6f7ltBgsBxm5V6BWBKq4lbumsa5wK0ozRUm4vAonLGsigkw0JpAGHQG7jz398uWgWlGEzAdz4x5/WEWopHDktpVld36z2TQmp7OUmJCNbpIgZcrCIUUMNMzUu+dDxY9E0CRmxC+D5OTM/VEI7CLdoLq/fL40tKr1kTnXVqojUXPfRqrY/GGFtd8Y6SLW/3JrJBVNe1t2jgQL/zpFJovp4WWS1NXWQ5GbwonQ/9FNj/98+0ynOp+NCf7mduNH2XQMUj9NOdDBLfkaPBZiI4xUfKOto/YrRMPRCTGbUiP/u43ohf+M6XyN69JlI3elAe6sDxACqYj+yttH3+kDW8/ftLxGikabasgg//UeC721mTHs5crqXrFXNNIqDtTYtf5CcwzivjApW8022m0BoA2Cuu/okRB+QjPM1I6MfPLszXFkn8EwYYvi4K+UtkZZJ2BFIZGg=
|
data/CHANGELOG.md
ADDED
data/CODEOWNERS
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at wolf@tgwolf.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Tim Gurney aka Wolf
|
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,66 @@
|
|
1
|
+
[![Build Status](https://img.shields.io/travis/AntiPhotonltd/ssl_info/master.svg)](https://travis-ci.org/AntiPhotonltd/ssl_info)
|
2
|
+
[![Software License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
|
3
|
+
[![Release](https://img.shields.io/github/release/AntiPhotonltd/ssl_info.svg)](https://github.com/AntiPhotonltd/ssl_info/releases/latest)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/ssl_info.svg)](https://badge.fury.io/rb/ssl_info)
|
5
|
+
[![Github commits (since latest release)](https://img.shields.io/github/commits-since/AntiPhotonltd/ssl_info/latest.svg)](https://github.com/AntiPhotonltd/ssl_info/commits)
|
6
|
+
[![GitHub repo size in bytes](https://img.shields.io/github/repo-size/AntiPhotonltd/ssl_info.svg)](https://github.com/AntiPhotonltd/ssl_info)
|
7
|
+
[![GitHub contributors](https://img.shields.io/github/contributors/AntiPhotonltd/ssl_info.svg)](https://github.com/AntiPhotonltd/ssl_info)
|
8
|
+
|
9
|
+
# SSL Info
|
10
|
+
|
11
|
+
This is a simple little gem for retreiving SSL certificate information.
|
12
|
+
TODO: Delete this and the text above, and describe your gem
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'ssl_info'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install ssl_info
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
SSLInfo.get_cert("www.wolfsoftware.uk")
|
34
|
+
SSLInfo.display_cert
|
35
|
+
|
36
|
+
printf("Raw Cert: \n#{SSLInfo.cert}\n")
|
37
|
+
printf("Subject: #{SSLInfo.subject}\n")
|
38
|
+
printf("Issuer: #{SSLInfo.issuer}\n")
|
39
|
+
printf("Serial: #{SSLInfo.serial}\n")
|
40
|
+
printf("Common Name: #{SSLInfo.common_name}\n")
|
41
|
+
printf("Issued: #{SSLInfo.not_before}\n")
|
42
|
+
printf("Expires: #{SSLInfo.not_after}\n")
|
43
|
+
printf("Expires In: #{SSLInfo.expires_in} days\n")
|
44
|
+
```
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
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.
|
49
|
+
|
50
|
+
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).
|
51
|
+
|
52
|
+
## Testing
|
53
|
+
|
54
|
+
For local testing make sure that you run `bundle exec rspec spec` and then `rake install` to install the gem locally.
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/AntiPhotonltd/ssl_info. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
63
|
+
|
64
|
+
## Code of Conduct
|
65
|
+
|
66
|
+
Everyone interacting in the SSLInfo project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/AntiPhotonltd/ssl_info/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ssl_info"
|
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
data/exe/ssl-info
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'ssl_info'
|
5
|
+
|
6
|
+
# -------------------------------------------------------------------------------- #
|
7
|
+
# Process Arguments #
|
8
|
+
# -------------------------------------------------------------------------------- #
|
9
|
+
# This function will process the input from the command line and work out what it #
|
10
|
+
# is that the user wants to see. #
|
11
|
+
# #
|
12
|
+
# This is the main processing function where all the processing logic is handled. #
|
13
|
+
# -------------------------------------------------------------------------------- #
|
14
|
+
|
15
|
+
def process_arguments
|
16
|
+
options = {}
|
17
|
+
# Enforce the presence of
|
18
|
+
mandatory = %I[domain]
|
19
|
+
|
20
|
+
optparse = OptionParser.new do |opts|
|
21
|
+
opts.banner = "Usage: #{$PROGRAM_NAME}"
|
22
|
+
|
23
|
+
opts.on('-h', '--help', 'Display this screen') do
|
24
|
+
puts opts
|
25
|
+
exit(1)
|
26
|
+
end
|
27
|
+
opts.on('-d', '--domain string', 'The domain name to check') do |domain|
|
28
|
+
options[:domain] = domain
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
optparse.parse!
|
34
|
+
options[:message] = ARGF.read if !STDIN.tty? # override message parameter if data is piped in
|
35
|
+
missing = mandatory.select { |param| options[param].nil? }
|
36
|
+
raise OptionParser::MissingArgument.new(missing.join(', ')) unless missing.empty?
|
37
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
38
|
+
puts e.to_s
|
39
|
+
puts optparse
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
SSLInfo.get_cert(options[:domain])
|
44
|
+
SSLInfo.display_cert
|
45
|
+
end
|
46
|
+
|
47
|
+
# -------------------------------------------------------------------------------- #
|
48
|
+
# Main() #
|
49
|
+
# -------------------------------------------------------------------------------- #
|
50
|
+
# The main function where all of the heavy lifting and script config is done. #
|
51
|
+
# -------------------------------------------------------------------------------- #
|
52
|
+
|
53
|
+
def main
|
54
|
+
process_arguments
|
55
|
+
end
|
56
|
+
|
57
|
+
main
|
58
|
+
|
59
|
+
# -------------------------------------------------------------------------------- #
|
60
|
+
# End of Script #
|
61
|
+
# -------------------------------------------------------------------------------- #
|
62
|
+
# This is the end - nothing more to see here. #
|
63
|
+
# -------------------------------------------------------------------------------- #
|
data/lib/ssl_info.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'openssl'
|
3
|
+
|
4
|
+
require 'ssl_info/version'
|
5
|
+
|
6
|
+
#
|
7
|
+
# Docs to follow
|
8
|
+
#
|
9
|
+
module SSLInfo
|
10
|
+
@cert = nil
|
11
|
+
@subject = nil
|
12
|
+
@common_name = nil
|
13
|
+
@issuer = nil
|
14
|
+
@serial = nil
|
15
|
+
@version = nil
|
16
|
+
@not_before = nil
|
17
|
+
@not_after = nil
|
18
|
+
@expires_in = nil
|
19
|
+
|
20
|
+
def self.get_cert(domain_name, verify = false)
|
21
|
+
begin
|
22
|
+
uri = URI::HTTPS.build(host: domain_name)
|
23
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
24
|
+
|
25
|
+
http.use_ssl = true
|
26
|
+
http.verify_mode = verify ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
|
27
|
+
http.open_timeout = 10
|
28
|
+
http.read_timeout = 10
|
29
|
+
http.ssl_timeout = 10
|
30
|
+
|
31
|
+
http.start do |h|
|
32
|
+
@cert = h.peer_cert
|
33
|
+
end
|
34
|
+
|
35
|
+
process_cert
|
36
|
+
rescue SocketError, SystemCallError => e
|
37
|
+
printf("Bad URL? #{e.message}\n")
|
38
|
+
rescue Net::OpenTimeout
|
39
|
+
printf("Timed out. Is the site up?\n")
|
40
|
+
rescue OpenSSL::SSL::SSLError => e
|
41
|
+
printf("We're trying to validate your certificate using TLSv1 It looks like your server doesn't accept it: [#{$ERROR_INFO.message}]\n") if e.message =~ /sslv3.+tlsv1 alert/i
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.process_cert
|
46
|
+
return if @cert.nil?
|
47
|
+
|
48
|
+
@subject = @cert.subject.to_s
|
49
|
+
@common_name = @cert.subject.to_a.select { |name, _data, _type| name == 'CN' }.first[1]
|
50
|
+
@issuer = @cert.issuer.to_a.select { |name, _data, _type| name == 'O' }.first[1]
|
51
|
+
@serial = @cert.serial
|
52
|
+
@version = @cert.version
|
53
|
+
@not_before = @cert.not_before
|
54
|
+
@not_after = @cert.not_after
|
55
|
+
@expires_in = ((@not_after - Time.now) / 864_00).to_i
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.display_cert
|
59
|
+
printf("Subject: #{@subject}\n")
|
60
|
+
printf("Issuer: #{@issuer}\n")
|
61
|
+
printf("Serial: #{@serial}\n")
|
62
|
+
printf("Common Name: #{@common_name}\n")
|
63
|
+
printf("Issued: #{@not_before}\n")
|
64
|
+
printf("Expires: #{@not_after}\n")
|
65
|
+
printf("Expires In: #{@expires_in} days\n")
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.cert
|
69
|
+
@cert
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.subject
|
73
|
+
@subject
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.issuer
|
77
|
+
@issuer
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.serial
|
81
|
+
@serial
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.common_name
|
85
|
+
@common_name
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.not_before
|
89
|
+
@not_before
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.not_after
|
93
|
+
@not_after
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.expires_in
|
97
|
+
@expires_in
|
98
|
+
end
|
99
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'ssl_info'
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
14
|
+
end
|
data/ssl_info.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "ssl_info/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "ssl_info"
|
7
|
+
spec.version = SSLInfo::VERSION
|
8
|
+
spec.authors = ['Tim Gurney aka Wolf']
|
9
|
+
spec.email = ['wolf@tgwolf.com']
|
10
|
+
|
11
|
+
spec.summary = %q{A simple gem for retreiving and displaying SSL certificate information.}
|
12
|
+
spec.description = %q{A simple gem for retreiving and displaying SSL certificate information..}
|
13
|
+
spec.homepage = 'https://github.com/AntiPhotonltd/ssl_info'
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", ">= 1.17", "< 3.0"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency 'openssl', '~> 2'
|
26
|
+
spec.add_development_dependency 'net-http-persistent', '~> 3'
|
27
|
+
|
28
|
+
spec.add_runtime_dependency 'openssl', '~> 2'
|
29
|
+
spec.add_runtime_dependency 'net-http-persistent', '~> 3'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ssl_info
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Gurney aka Wolf
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-08 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
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.17'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '10.0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '10.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: openssl
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: net-http-persistent
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: openssl
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: net-http-persistent
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3'
|
117
|
+
description: A simple gem for retreiving and displaying SSL certificate information..
|
118
|
+
email:
|
119
|
+
- wolf@tgwolf.com
|
120
|
+
executables:
|
121
|
+
- ssl-info
|
122
|
+
extensions: []
|
123
|
+
extra_rdoc_files: []
|
124
|
+
files:
|
125
|
+
- ".gitignore"
|
126
|
+
- ".rspec"
|
127
|
+
- ".rubocop.yml"
|
128
|
+
- ".travis.yml"
|
129
|
+
- CHANGELOG.md
|
130
|
+
- CODEOWNERS
|
131
|
+
- CODE_OF_CONDUCT.md
|
132
|
+
- Gemfile
|
133
|
+
- LICENSE.txt
|
134
|
+
- README.md
|
135
|
+
- Rakefile
|
136
|
+
- bin/console
|
137
|
+
- bin/setup
|
138
|
+
- exe/ssl-info
|
139
|
+
- lib/ssl_info.rb
|
140
|
+
- lib/ssl_info/version.rb
|
141
|
+
- spec/spec_helper.rb
|
142
|
+
- spec/ssl_info_spec.rb
|
143
|
+
- ssl_info.gemspec
|
144
|
+
homepage: https://github.com/AntiPhotonltd/ssl_info
|
145
|
+
licenses:
|
146
|
+
- MIT
|
147
|
+
metadata: {}
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubygems_version: 3.0.2
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: A simple gem for retreiving and displaying SSL certificate information.
|
167
|
+
test_files: []
|