You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cryptcheck-rails/app/views/check/show.html.erb.bak

157 lines
4.4 KiB

5 years ago
<div class="container">
<div class="row">
<div class="col-sm-11">
<h1>
[<%= self.type.to_s.upcase %>] <%= @host %> <span class="small">(<%= l @result.date %>)</span>
</h1>
</div>
<% if Time.now - @result.date >= Rails.configuration.refresh_delay %>
<div class="col-sm-1">
<%= link_to t('Refresh'), {action: :refresh}, class: %i(btn btn-default) %>
</div>
<% end %>
</div>
<%
@result.hosts.each do |host|
if host.error
error, host = host.error, host.host
%>
<div class="row">
<div class="col-sm-12">
<h2><%= host.name %> - <%= host.ip %> : <%= host.port %></h2>
<%= t 'Error during analysis:' %>
<span class="label label-error"><%= error %></span>
</div>
</div>
<%
else
host, grade, handshake = host.host, host.grade, host.handshake
%>
<div class="row">
<div class="col-sm-12">
<h2><%= host.name %> - <%= host.ip %> : <%= host.port %></h2>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th colspan="2">
Scores
<%= rank_label grade.rank %>
</th>
</tr>
</thead>
<tbody>
<%
{ 'Protocol' => 'protocol',
'Key exchange' => 'key_exchange',
'Cipher' => 'cipher_strengths',
'Overall' => 'score'}.each do |name, v| %>
<tr>
<th class="col-sm-4"><%= t name %></th>
<td class="col-sm-8"><%= score_progress grade.details[v] %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="col-sm-6">
<table class="table table-bordered table-condensed table-striped">
<tbody>
<tr>
<th class="col-sm-4"><%= t 'Protocols' %></th>
<td class="col-sm-8"><%= protocol_labels handshake.protocols %></td>
</tr>
<tr>
<th><%= t 'Keys' %></th>
<td>
<p><%= t 'Certificates:' %> <%= key_label handshake[:key] %></p>
<p>Diffie Hellman : <%= key_labels handshake.dh %></p>
</td>
</tr>
<% { 'Good practices' => :success,
'Warning' => :warning,
'Critical' => :danger,
'Fatal' => :error }.each do |name, color|
names = grade[color]
next if names.nil? or names.empty?
%>
<tr>
<th><%= t name %></th>
<td>
<% names.each do |name| %>
<span class="label label-<%= color %>"><%= name.upcase %></span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<table class="table table-bordered table-condensed table-striped center">
<thead>
<tr>
<th rowspan="2"><%= t 'Name' %></th>
<th colspan="2"><%= t 'Key exchange' %></th>
<th colspan="2"><%= t 'Authentication' %></th>
<th colspan="4"><%= t 'Encryption' %></th>
<th colspan="2"><%= t 'MAC' %></th>
<th rowspan="2"><%= t 'PFS' %></th>
</tr>
<tr>
<th><%= t 'Type' %></th>
<th><%= t 'Key size' %></th>
<th><%= t 'Type' %></th>
<th><%= t 'Key size' %></th>
<th><%= t 'Type' %></th>
<th><%= t 'Key size' %></th>
<th><%= t 'Block size' %></th>
<th><%= t 'Mode' %></th>
<th><%= t 'Type' %></th>
<th><%= t 'Size' %></th>
</tr>
</thead>
<tbody>
<% CryptCheck::Tls::Server::EXISTING_METHODS.each do |protocol|
ciphers = CryptCheck::Tls::Cipher.sort(handshake.ciphers.select { |c| c.protocol == protocol.to_s }
.collect { |c| CryptCheck::Tls::Cipher.new protocol, [c.name, nil, c[:size]], c.dh, handshake[:key] })
unless ciphers.empty? %>
<tr>
<th colspan="12"><%= protocol_label protocol %></th>
</tr>
<% ciphers.each do |cipher|
params = cipher.params
kex = params[:kex]
auth = params[:auth]
enc = params[:enc]
mac = params[:mac]
pfs = params[:pfs]
%>
<tr>
<th><%= cipher_name_label cipher %></th>
<%= cipher_kex_type_cell kex&.first %>
<%= cipher_kex_size_cell kex&.last %>
<%= cipher_auth_type_cell auth&.first %>
<%= cipher_auth_size_cell auth&.last %>
<%= cipher_enc_type_cell enc&.first %>
<%= cipher_enc_key_size_cell enc&.[] 1 %>
<%= cipher_enc_block_size_cell enc&.[] 2 %>
<%= cipher_enc_mode_cell enc&.last %>
<%= cipher_mac_type_cell mac&.first %>
<%= cipher_mac_size_cell mac&.last %>
<%= cipher_pfs_cell pfs %>
</tr>
<% end end end %>
</tbody>
</table>
</div>
</div>
<% end
end %>
</div>