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.

site_controller.rb 822B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. require 'simpleidn'
  2. class SiteController < ApplicationController
  3. def check
  4. host, port, type = params[:host], params[:port], params[:type]
  5. host = SimpleIDN.to_ascii host.downcase
  6. if host.blank? or /[^a-zA-Z0-9.-]/ =~ host
  7. flash[:danger] = "Hôte #{host} invalide"
  8. render :index
  9. return
  10. end
  11. unless port.blank?
  12. port = port.to_i
  13. unless (1..65535).include? port
  14. flash[:danger] = "Port #{port} invalide"
  15. render :index
  16. return
  17. end
  18. host = "#{host}:#{port}"
  19. end
  20. unless %w(https smtp xmpp tls ssh).include? type
  21. flash[:danger] = "Type #{type} invalide"
  22. render :index
  23. return
  24. end
  25. redirect_to "/#{type}/#{host}"
  26. end
  27. def suite
  28. @suite = params[:id] || params.require(:suite)
  29. @ciphers = CryptCheck::Tls::Cipher.list @suite
  30. end
  31. def help
  32. end
  33. def about
  34. end
  35. end