Class: SSLScan::Commands::Command
- Inherits:
-
Object
- Object
- SSLScan::Commands::Command
- Includes:
- FastGettext::Translation
- Defined in:
- lib/ssl_scan/commands/command.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#options ⇒ Object
Returns the value of attribute options.
-
#results ⇒ Object
Returns the value of attribute results.
-
#stream ⇒ Object
Returns the value of attribute stream.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(results = [], stream = nil) ⇒ Command
constructor
A new instance of Command.
- #write_ciphers(scanner = nil) ⇒ Object
-
#write_header(host, port = 443) ⇒ Object
Display Methods.
- #write_preferred_ciphers(scanner) ⇒ Object
Constructor Details
#initialize(results = [], stream = nil) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 |
# File 'lib/ssl_scan/commands/command.rb', line 7 def initialize(results=[], stream=nil) @results = results @errors = [] @stream = stream || STDOUT end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/ssl_scan/commands/command.rb', line 4 def errors @errors end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/ssl_scan/commands/command.rb', line 4 def @options end |
#results ⇒ Object
Returns the value of attribute results.
4 5 6 |
# File 'lib/ssl_scan/commands/command.rb', line 4 def results @results end |
#stream ⇒ Object
Returns the value of attribute stream.
4 5 6 |
# File 'lib/ssl_scan/commands/command.rb', line 4 def stream @stream end |
Instance Method Details
#execute ⇒ Object
13 14 15 |
# File 'lib/ssl_scan/commands/command.rb', line 13 def execute raise "Implement" end |
#write_ciphers(scanner = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ssl_scan/commands/command.rb', line 33 def write_ciphers(scanner=nil) stream.printf _("\nSupported Server Cipher(s):\n") sslv = .only_ssl2 || .only_ssl3 || .only_tls1 || false if sslv scanner.scan_ssl_version(sslv) do |ssl_version, cipher_name, alg_length, status| unless .no_failed && status == :failed stream.printf("%12s %10s %10s %s\n", status, ssl_version, "#{alg_length} bits", cipher_name) end end else scanner.scan do |ssl_version, cipher_name, alg_length, status| unless .no_failed && status == :failed stream.printf "%12s %10s %10s %s\n", status, ssl_version, "#{alg_length} bits", cipher_name end end end stream.printf("\n") scanner end |
#write_header(host, port = 443) ⇒ Object
Display Methods
18 19 20 |
# File 'lib/ssl_scan/commands/command.rb', line 18 def write_header(host, port=443) stream.printf _("\nTesting SSL server %{host} on port %{port}\n") % { host: host, port: port } end |
#write_preferred_ciphers(scanner) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ssl_scan/commands/command.rb', line 22 def write_preferred_ciphers(scanner) stream.printf _("\nServer Preferred Cipher(s)\n") ciphers = scanner.get_preferred_ciphers ciphers.each do |c| if c.length > 1 && !c[1].empty? stream.printf("%12s %10s %s\n", c[0], "#{c[1][3]} bits", c[1][0]) end end stream.printf("\n") end |