class SslscanWrapper::Scanner

Attributes

bugs[RW]

Enable SSL implementation bug work-arounds

command[RW]

sslscan executable

http[RW]

Test a HTTP connection

ipv4[RW]

Only use IPv4

ipv6[RW]

Only use IPv6

ocsp[RW]

Request OCSP response from server

pk[RW]

A file containing the private key or a PKCS12 file containing a private key/certificate pair

pkpass[RW]

The password for the private key or PKCS12 file certs=<file> A file containing PEM/ASN1 formatted client certificates

rdp[RW]

Send RDP preamble before starting scan

sleep[RW]

Pause between connection request. Default is disabled

sni_name[RW]

Hostname for SNI

ssl2[RW]

Only check SSLv2 ciphers

ssl3[RW]

Only check SSLv3 ciphers

timeout[RW]

Set socket timeout. Default is 3s

tls10[RW]

Only check TLSv1.0 ciphers

tls11[RW]

Only check TLSv1.1 ciphers

tls12[RW]

Only check TLSv1.2 ciphers

tlsall[RW]

Only check TLS ciphers (all versions)

xmpp_server[RW]

Use a server-to-server XMPP handshake

Public Class Methods

new() { |self| ... } click to toggle source

Initialize a new SslscanWrapper::Scanner object

Examples

scan = SslscanWrapper::Scanner.new do |s|
  s.ipv4 = true
end

Returns a SslscanWrapper::Scanner object

# File lib/sslscan_wrapper/scanner.rb, line 59
def initialize
  @command = 'sslscan'
  @port = 443
  yield self if block_given?
end

Public Instance Methods

scan(host, port) click to toggle source

Scan a target

Returns a SslscanWrapper::Report object

# File lib/sslscan_wrapper/scanner.rb, line 68
def scan(host, port)
  execute(host, port)
end

Private Instance Methods

cmd(host, port) click to toggle source
# File lib/sslscan_wrapper/scanner.rb, line 74
def cmd(host, port)
  cmd = [ @command ] + @@SSL_SCAN_ARGS
  @@SSL_SCAN_FLAGS.each do |flag|
    next if send(flag).nil?
    cmd << "--#{flag.to_s.gsub('_', '-')}"
  end
  @@SSL_SCAN_OPTIONS.each do |option|
    next if (value = send(option)).nil?
    cmd << '--' + option.to_s.gsub('_', '-')
    cmd << value
  end
  cmd << "#{host}:#{port}"
end
execute(host, port) click to toggle source
# File lib/sslscan_wrapper/scanner.rb, line 88
def execute(host, port)
  command = cmd(host, port)
  report, err, status = Open3.capture3(*command)
  raise "Error while executing sslscan: #{err}" unless status.success?
  SslscanWrapper::Report.new(report)
end