Adds the last updated date to the output

git-svn-id: file:///home/svn/framework3/trunk@7497 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-11-13 22:50:12 +00:00
parent 8a2a16c921
commit eabfff5aca
3 changed files with 16 additions and 10 deletions

View File

@ -27,6 +27,7 @@ class Framework
RepoUpdated = ::Msf::Util::SVN.updated RepoUpdated = ::Msf::Util::SVN.updated
RepoUpdatedDays = ::Msf::Util::SVN.days_since_update RepoUpdatedDays = ::Msf::Util::SVN.days_since_update
RepoUpdatedDaysNote = ::Msf::Util::SVN.last_updated_friendly RepoUpdatedDaysNote = ::Msf::Util::SVN.last_updated_friendly
RepoUpdatedDate = ::Msf::Util::SVN.last_updated_date
RepoRoot = ::Msf::Util::SVN.root RepoRoot = ::Msf::Util::SVN.root
# API Version # API Version

View File

@ -197,7 +197,8 @@ class Core
oldwarn = nil oldwarn = nil
banner << "#{framework.stats.num_payloads} payloads - #{framework.stats.num_encoders} encoders - #{framework.stats.num_nops} nops\n" 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)
banner << " =[ svn r#{::Msf::Framework::RepoRevision} updated #{::Msf::Framework::RepoUpdatedDaysNote}\n" 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) if(::Msf::Framework::RepoUpdatedDays > 7)
oldwarn = [] oldwarn = []
oldwarn << "Warning: This copy of the Metasploit Framework was last updated #{::Msf::Framework::RepoUpdatedDaysNote}." oldwarn << "Warning: This copy of the Metasploit Framework was last updated #{::Msf::Framework::RepoUpdatedDaysNote}."

View File

@ -40,23 +40,23 @@ class SVN
end end
def self.revision def self.revision
info = load_root @@info ||= load_root
info[:revision] @@info[:revision]
end end
def self.updated def self.updated
info = load_root @@info ||= load_root
info[:updated] @@info[:updated]
end end
def self.root def self.root
info = load_root @@info ||= load_root
info[:root] @@info[:root]
end end
def self.days_since_update def self.days_since_update
info = load_root @@info ||= load_root
svnt = info[:updated] svnt = @@info[:updated]
if(not svnt) if(not svnt)
return return
end end
@ -67,7 +67,7 @@ class SVN
diff = self.days_since_update diff = self.days_since_update
case diff case diff
when nil when nil
"at a unknown date" "at an unknown date"
when -2.0 .. 1.0 when -2.0 .. 1.0
"today" "today"
when 1.0 .. 2.0 when 1.0 .. 2.0
@ -81,6 +81,10 @@ class SVN
end end
end end
def self.last_updated_date
@@info ||= load_root
Date.parse(@@info[:updated])
end
end end
end end