Browse Source

Refactor analyze for cryptcheck-lib compliance

master
Aeris 3 years ago
parent
commit
a4aba73914

+ 1
- 1
app/controllers/site_controller.rb View File

@@ -31,7 +31,7 @@ class SiteController < ApplicationController
31 31
 	end
32 32
 
33 33
 	def suite
34
-		@suite = params.require :suite
34
+		@suite = params[:id] || params.require(:suite)
35 35
 		@ciphers = CryptCheck::Tls::Cipher.list @suite
36 36
 	end
37 37
 end

+ 1
- 1
app/views/check/show.html.erb View File

@@ -78,7 +78,7 @@
78 78
 			<table class="table table-bordered table-condensed table-striped">
79 79
 				<thead>
80 80
 					<tr>
81
-						<th class="col-sm-3">Algorithme</th>
81
+						<th class="col-sm-5">Algorithme</th>
82 82
 						<th class="col-sm-1">Clef</th>
83 83
 						<th class="col-sm-1">DH</th>
84 84
 						<th></th>

+ 2
- 2
app/views/site/ciphers.html.erb View File

@@ -3,9 +3,9 @@
3 3
 		<table class="table-bordered table-condensed table-striped col-sm-12">
4 4
 			<thead>
5 5
 				<tr>
6
-					<th class="col-sm-4">Algorithme</th>
6
+					<th class="col-sm-6">Algorithme</th>
7 7
 					<th class="col-sm-1">Taille</th>
8
-					<td class="col-sm-7"></td>
8
+					<td class="col-sm-5"></td>
9 9
 				</tr>
10 10
 			</thead>
11 11
 			<tbody>

+ 2
- 2
app/workers/check_worker.rb View File

@@ -9,8 +9,8 @@ class CheckWorker
9 9
 	def perform(host, port=nil)
10 10
 		host    = SimpleIDN.to_ascii host.downcase
11 11
 		result = begin
12
-			server = self.server.new *(port ? [host, port] : [host])
13
-			grade  = self.grade.new server
12
+			grade  = self.analyze *(port ? [host, port] : [host])
13
+			server = grade.server
14 14
 			result = {
15 15
 					key:       key_to_json(server.key),
16 16
 					dh:        server.dh.collect { |k| key_to_json k },

+ 2
- 5
app/workers/https_worker.rb View File

@@ -2,11 +2,8 @@ class HTTPSWorker < CheckWorker
2 2
 	sidekiq_options retry: false
3 3
 
4 4
 	protected
5
-	def server
6
-		CryptCheck::Tls::Https::Server
7
-	end
8
-	def grade
9
-		CryptCheck::Tls::Https::Grade
5
+	def analyze(host, port=443)
6
+		CryptCheck::Tls::Https.analyze host, port
10 7
 	end
11 8
 
12 9
 	def type

+ 2
- 5
app/workers/smtp_worker.rb View File

@@ -2,11 +2,8 @@ class SMTPWorker < CheckWorker
2 2
 	sidekiq_options retry: false
3 3
 
4 4
 	protected
5
-	def server
6
-		CryptCheck::Tls::Smtp::Server
7
-	end
8
-	def grade
9
-		CryptCheck::Tls::Smtp::Grade
5
+	def analyze(host, port=25)
6
+		CryptCheck::Tls::Smtp.analyze host, port
10 7
 	end
11 8
 
12 9
 	def type

+ 1
- 1
app/workers/ssh_worker.rb View File

@@ -5,7 +5,7 @@ class SSHWorker
5 5
 	def perform(host, port=nil)
6 6
 		host    = SimpleIDN.to_ascii host.downcase
7 7
 		result = begin
8
-			server = CryptCheck::Ssh::Server.new *(port ? [host, port] : [host])
8
+			server = CryptCheck::Ssh.analyze host, port
9 9
 			{
10 10
 					kex:         server.kex,
11 11
 					encryption:  server.encryption,

+ 2
- 5
app/workers/tls_worker.rb View File

@@ -2,11 +2,8 @@ class TLSWorker < CheckWorker
2 2
 	sidekiq_options retry: false
3 3
 
4 4
 	protected
5
-	def server
6
-		CryptCheck::Tls::TcpServer
7
-	end
8
-	def grade
9
-		CryptCheck::Tls::Grade
5
+	def analyze(host, port)
6
+		CryptCheck::Tls.analyze host, port
10 7
 	end
11 8
 
12 9
 	def type

+ 2
- 5
app/workers/xmpp_worker.rb View File

@@ -2,11 +2,8 @@ class XMPPWorker < CheckWorker
2 2
 	sidekiq_options retry: false
3 3
 
4 4
 	protected
5
-	def server
6
-		CryptCheck::Tls::Xmpp::Server
7
-	end
8
-	def grade
9
-		CryptCheck::Tls::Xmpp::Grade
5
+	def analyze(host)
6
+		CryptCheck::Tls::Xmpp.analyze host
10 7
 	end
11 8
 
12 9
 	def type

Loading…
Cancel
Save