Revert Date.parse check for DisclosureDate

An approximation of https://en.wikipedia.org/wiki/Robustness_principle.
GSoC/Meterpreter_Web_Console
William Vu 2018-11-16 11:48:44 -06:00
parent d65ba41e31
commit f25d7dbaa8
1 changed files with 11 additions and 3 deletions

View File

@ -441,10 +441,18 @@ class Msftidy
# Check disclosure date format
if @source =~ /["']DisclosureDate["'].*\=\>[\x0d\x20]*['\"](.+?)['\"]/
begin
Date.parse($1) #Captured date
d = $1 #Captured date
# Flag if overall format is wrong
rescue ArgumentError
if d =~ /^... (?:\d{1,2},? )?\d{4}$/
# Flag if month format is wrong
m = d.split[0]
months = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]
error('Incorrect disclosure month format') if months.index(m).nil?
else
error('Incorrect disclosure date format')
end
else