No Description https://cryptcheck.fr/
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.

show.html.erb.bak 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <div class="container">
  2. <div class="row">
  3. <div class="col-sm-11">
  4. <h1>
  5. [<%= self.type.to_s.upcase %>] <%= @host %> <span class="small">(<%= l @result.date %>)</span>
  6. </h1>
  7. </div>
  8. <% if Time.now - @result.date >= Rails.configuration.refresh_delay %>
  9. <div class="col-sm-1">
  10. <%= link_to t('Refresh'), {action: :refresh}, class: %i(btn btn-default) %>
  11. </div>
  12. <% end %>
  13. </div>
  14. <%
  15. @result.hosts.each do |host|
  16. if host.error
  17. error, host = host.error, host.host
  18. %>
  19. <div class="row">
  20. <div class="col-sm-12">
  21. <h2><%= host.name %> - <%= host.ip %> : <%= host.port %></h2>
  22. <%= t 'Error during analysis:' %>
  23. <span class="label label-error"><%= error %></span>
  24. </div>
  25. </div>
  26. <%
  27. else
  28. host, grade, handshake = host.host, host.grade, host.handshake
  29. %>
  30. <div class="row">
  31. <div class="col-sm-12">
  32. <h2><%= host.name %> - <%= host.ip %> : <%= host.port %></h2>
  33. </div>
  34. </div>
  35. <div class="row">
  36. <div class="col-sm-6">
  37. <table class="table table-bordered table-condensed table-striped">
  38. <thead>
  39. <tr>
  40. <th colspan="2">
  41. Scores
  42. <%= rank_label grade.rank %>
  43. </th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. <%
  48. { 'Protocol' => 'protocol',
  49. 'Key exchange' => 'key_exchange',
  50. 'Cipher' => 'cipher_strengths',
  51. 'Overall' => 'score'}.each do |name, v| %>
  52. <tr>
  53. <th class="col-sm-4"><%= t name %></th>
  54. <td class="col-sm-8"><%= score_progress grade.details[v] %></td>
  55. </tr>
  56. <% end %>
  57. </tbody>
  58. </table>
  59. </div>
  60. <div class="col-sm-6">
  61. <table class="table table-bordered table-condensed table-striped">
  62. <tbody>
  63. <tr>
  64. <th class="col-sm-4"><%= t 'Protocols' %></th>
  65. <td class="col-sm-8"><%= protocol_labels handshake.protocols %></td>
  66. </tr>
  67. <tr>
  68. <th><%= t 'Keys' %></th>
  69. <td>
  70. <p><%= t 'Certificates:' %> <%= key_label handshake[:key] %></p>
  71. <p>Diffie Hellman : <%= key_labels handshake.dh %></p>
  72. </td>
  73. </tr>
  74. <% { 'Good practices' => :success,
  75. 'Warning' => :warning,
  76. 'Critical' => :danger,
  77. 'Fatal' => :error }.each do |name, color|
  78. names = grade[color]
  79. next if names.nil? or names.empty?
  80. %>
  81. <tr>
  82. <th><%= t name %></th>
  83. <td>
  84. <% names.each do |name| %>
  85. <span class="label label-<%= color %>"><%= name.upcase %></span>
  86. <% end %>
  87. </td>
  88. </tr>
  89. <% end %>
  90. </tbody>
  91. </table>
  92. </div>
  93. </div>
  94. <div class="row">
  95. <div class="col-sm-12">
  96. <table class="table table-bordered table-condensed table-striped center">
  97. <thead>
  98. <tr>
  99. <th rowspan="2"><%= t 'Name' %></th>
  100. <th colspan="2"><%= t 'Key exchange' %></th>
  101. <th colspan="2"><%= t 'Authentication' %></th>
  102. <th colspan="4"><%= t 'Encryption' %></th>
  103. <th colspan="2"><%= t 'MAC' %></th>
  104. <th rowspan="2"><%= t 'PFS' %></th>
  105. </tr>
  106. <tr>
  107. <th><%= t 'Type' %></th>
  108. <th><%= t 'Key size' %></th>
  109. <th><%= t 'Type' %></th>
  110. <th><%= t 'Key size' %></th>
  111. <th><%= t 'Type' %></th>
  112. <th><%= t 'Key size' %></th>
  113. <th><%= t 'Block size' %></th>
  114. <th><%= t 'Mode' %></th>
  115. <th><%= t 'Type' %></th>
  116. <th><%= t 'Size' %></th>
  117. </tr>
  118. </thead>
  119. <tbody>
  120. <% CryptCheck::Tls::Server::EXISTING_METHODS.each do |protocol|
  121. ciphers = CryptCheck::Tls::Cipher.sort(handshake.ciphers.select { |c| c.protocol == protocol.to_s }
  122. .collect { |c| CryptCheck::Tls::Cipher.new protocol, [c.name, nil, c[:size]], c.dh, handshake[:key] })
  123. unless ciphers.empty? %>
  124. <tr>
  125. <th colspan="12"><%= protocol_label protocol %></th>
  126. </tr>
  127. <% ciphers.each do |cipher|
  128. params = cipher.params
  129. kex = params[:kex]
  130. auth = params[:auth]
  131. enc = params[:enc]
  132. mac = params[:mac]
  133. pfs = params[:pfs]
  134. %>
  135. <tr>
  136. <th><%= cipher_name_label cipher %></th>
  137. <%= cipher_kex_type_cell kex&.first %>
  138. <%= cipher_kex_size_cell kex&.last %>
  139. <%= cipher_auth_type_cell auth&.first %>
  140. <%= cipher_auth_size_cell auth&.last %>
  141. <%= cipher_enc_type_cell enc&.first %>
  142. <%= cipher_enc_key_size_cell enc&.[] 1 %>
  143. <%= cipher_enc_block_size_cell enc&.[] 2 %>
  144. <%= cipher_enc_mode_cell enc&.last %>
  145. <%= cipher_mac_type_cell mac&.first %>
  146. <%= cipher_mac_size_cell mac&.last %>
  147. <%= cipher_pfs_cell pfs %>
  148. </tr>
  149. <% end end end %>
  150. </tbody>
  151. </table>
  152. </div>
  153. </div>
  154. <% end
  155. end %>
  156. </div>