deal with broken Date.parse in 1.8.6 and older by just not printing the last updated date. fixes 693

git-svn-id: file:///home/svn/framework3/trunk@7897 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2009-12-17 03:17:37 +00:00
parent 862efac37d
commit c4c0fd2b55
2 changed files with 12 additions and 3 deletions

View File

@ -210,7 +210,7 @@ class Core
oldwarn = nil
banner << "#{framework.stats.num_payloads} payloads - #{framework.stats.num_encoders} encoders - #{framework.stats.num_nops} nops\n"
if ( ::Msf::Framework::RepoRevision.to_i > 0)
if ( ::Msf::Framework::RepoRevision.to_i > 0 and ::Msf::Framework::RepoUpdatedDate)
tstamp = ::Msf::Framework::RepoUpdatedDate.strftime("%Y.%m.%d")
banner << " =[ svn r#{::Msf::Framework::RepoRevision} updated #{::Msf::Framework::RepoUpdatedDaysNote} (#{tstamp})\n"
if(::Msf::Framework::RepoUpdatedDays > 7)

View File

@ -60,7 +60,13 @@ class SVN
if(not svnt)
return
end
diff = (Date.parse(Time.now.to_s) - Date.parse(svnt)).to_f
# Date.parse and Date.strptime are both broken beyond repair in
# ruby 1.8.6 and older. Just bail if the parsing doesn't work.
begin
diff = (Date.parse(Time.now.to_s) - Date.parse(svnt)).to_f
rescue ArgumentError
end
end
def self.last_updated_friendly
@ -87,7 +93,10 @@ class SVN
if(not svnt)
return
end
Date.parse(@@info[:updated])
begin
Date.parse(@@info[:updated])
rescue ArgumentError
end
end
end