Fix error when multiple server results
parent
d043c3db4e
commit
4d3e52a188
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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…
Reference in New Issue