mirror of
https://github.com/Evolix/chexpire.git
synced 2024-05-08 03:28:39 +02:00
SSLParser: enable other formats
This commit is contained in:
parent
6aa0e242aa
commit
379e43de89
|
@ -3,10 +3,11 @@
|
|||
|
||||
module SSL
|
||||
class Parser
|
||||
DATE_REGEX = /will expire on (.+)\./
|
||||
DATE_REGEX = /will expire (in (?<days>\d+) days )?on (?<date>.+)\./
|
||||
# Several date formats possible:
|
||||
# OK - Certificate 'domain.net' will expire on Sat 10 Jun 2028 09:14:18 AM GMT +0000.
|
||||
# OK - Certificate 'domain.net' will expire on 2018-08-06 02:57 +0200/CEST.
|
||||
# SSL OK - Certificate 'domain.net' will expire in 52 days on 2022-04-07 00:33 +0200/CEST.
|
||||
|
||||
attr_reader :logger
|
||||
attr_reader :domain
|
||||
|
@ -45,7 +46,7 @@ module SSL
|
|||
|
||||
def build_response(match)
|
||||
Response.new(domain).tap do |response|
|
||||
response.expire_at = parse_datetime(match[1])
|
||||
response.expire_at = parse_datetime(match[:date])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
2
test/fixtures/files/ssl/ssl1.domain.org.txt
vendored
2
test/fixtures/files/ssl/ssl1.domain.org.txt
vendored
|
@ -1 +1 @@
|
|||
SSL OK - Certificate 'ssl1.domain.org' will expire on 2022-08-06 02:57 +0200/CEST.
|
||||
SSL OK - Certificate 'ssl1.domain.org' will expire in 45 days on 2022-08-06 02:57 +0200/CEST.
|
Loading…
Reference in a new issue