seguridad 0.0.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 +7 -0
  2. data/lib/seguridad.rb +30 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16209b976df7e34ced9699747bbe67f034cde1be
4
+ data.tar.gz: 78ac42ef265999afcad6b462c8f33ceb6ee12895
5
+ SHA512:
6
+ metadata.gz: b11eac287b7acbad53849db4dcc2f5a5cbcb7446494f4a97b02d580e6ce786e401c5c4c52a9edc57a887f027e750705e93abd9aef50c5ad09d69439231370f99
7
+ data.tar.gz: 319ce78f5c7d1c67320ca1be1cacf7c27da77cbbacf1c6ea7c06b05664338b30d924c0587585fcb302f35da46c4852d0fa360215354fed0d23c9eb3f3f76314a
data/lib/seguridad.rb ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'OpenSSL'
4
+ require 'socket'
5
+
6
+ class OpenSSL::X509::Certificate
7
+ # TODO : Fix
8
+ def to_s
9
+ end
10
+ def print
11
+ puts "\tName: #{subject.to_s.match(/\/CN=[^\s]*/).to_s.split("=")[1]}"
12
+ puts "\tIssuer: #{issuer}"
13
+ puts "\tNot Before: #{not_before}"
14
+ puts "\tNot After: #{not_after}"
15
+ puts "\tVersion: #{version}"
16
+ end
17
+ end
18
+
19
+ def get_cert_info(domain)
20
+ puts domain
21
+ port = domain.split(':').length > 1 ? domain.split(':')[-1] : 443
22
+ ctx = OpenSSL::SSL::SSLContext.new
23
+ socket = TCPSocket.new(domain, port)
24
+
25
+ tls = OpenSSL::SSL::SSLSocket.new(socket, ctx)
26
+ tls.connect
27
+ cert = OpenSSL::X509::Certificate.new tls.peer_cert
28
+ cert.print
29
+ puts
30
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: seguridad
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Cardoza
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Given a domain, outputs metadata about its TLS certificate
14
+ email: danielpcardoza@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/seguridad.rb
20
+ homepage: http://rubygems.org/gems/seguridad
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.6.11
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Provides information about TLS certificates
44
+ test_files: []