Browse Source

Fix error when multiple server results

new-scoring
aeris 2 years ago
parent
commit
4d3e52a188
4 changed files with 21 additions and 4 deletions
  1. 17
    0
      lib/cryptcheck.rb
  2. 1
    1
      output/https.erb
  3. 2
    2
      output/smtp.erb
  4. 1
    1
      output/xmpp.erb

+ 17
- 0
lib/cryptcheck.rb View File

@@ -20,6 +20,21 @@ module CryptCheck
end
end

class NoTLSAvailableServer
attr_reader :server
def initialize(server)
@server = OpenStruct.new hostname: server
end

def grade
'X'
end

def score
0
end
end

autoload :Logger, 'cryptcheck/logger'
autoload :Tls, 'cryptcheck/tls'
module Tls
@@ -115,6 +130,8 @@ module CryptCheck
::Parallel.each hosts, progress: 'Analysing', in_threads: PARALLEL_ANALYSIS, finish: lambda { |item, _, _| puts item[1] } do |description, host|
#hosts.each do |description, host|
result = block.call host.strip
result = result.values.first
result = NoTLSAvailableServer.new(host) if result.is_a? AnalysisFailure
semaphore.synchronize do
if results.include? description
results[description] << result

+ 1
- 1
output/https.erb View File

@@ -79,7 +79,7 @@
<th id="<%= s.hostname %>">
<a href="#<%= s.hostname %>"><%= s.hostname %></a>
</th>
<% if s.is_a? Tls::TlsNotSupportedServer %>
<% if n.is_a? NoTLSAvailableServer %>
<td class="critical" colspan="16">
No SSL/TLS
</td>

+ 2
- 2
output/smtp.erb View File

@@ -72,10 +72,10 @@
<td class="info">PFS</td>
</tr>
<% r[1].each do |n|
s = n.server
s = n.server
%>
<tr>
<% if s.is_a? Tls::TlsNotSupportedServer %>
<% if n.is_a? AnalysisFailure %>
<th id="<%= s.hostname %>">
<a href="#<%= s.hostname %>"><%= s.hostname %></a>
</th>

+ 1
- 1
output/xmpp.erb View File

@@ -79,7 +79,7 @@
<th id="<%= s.hostname %>">
<a href="#<%= s.hostname %>"><%= s.hostname %></a>
</th>
<% if s.is_a? Tls::TlsNotSupportedServer %>
<% if n.is_a? AnalysisFailure %>
<td class="critical" colspan="16">
No SSL/TLS
</td>

Loading…
Cancel
Save