Browse Source

Unified runner

master
aeris 1 month ago
parent
commit
29080db0fe
1 changed files with 34 additions and 0 deletions
  1. 34
    0
      bin/cryptcheck

+ 34
- 0
bin/cryptcheck View File

@@ -0,0 +1,34 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'thor'
require 'cryptcheck'

class CLI < Thor
option :'no-ipv4', type: :boolean, default: false, aliases: :'4'
option :'no-ipv6', type: :boolean, default: false, aliases: :'6'
option :json, type: :boolean, default: false, aliases: :j
option :quiet, type: :boolean, default: false, aliases: :q
desc 'https HOST [PORT]', 'Analyze HTTPS configuration for HOST:PORT'
def https(host, port=443)
ENV['DISABLE_IPv4'] = 'true' if options[:'no-ipv4']
ENV['DISABLE_IPv6'] = 'true' if options[:'no-ipv6']
::CryptCheck::Logger.level = options[:quiet] ? :none : :info
result = ::CryptCheck::Tls::Https.analyze host, port
if options[:json]
result = result.collect do |host, grade|
domain, ip, port = host
server = grade.server
handshake = {
host: { domain: domain, ip: ip, port: port },
handshake: server.to_h,
grade: grade.to_h
}
handshake
end
puts JSON.pretty_generate result
end
end
end

CLI.start ARGV

Loading…
Cancel
Save