Land #6680, old SVN code deletion

bug/bundler_fix
William Vu 2016-03-16 10:15:06 -05:00
commit adb275520b
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
6 changed files with 16 additions and 160 deletions

View File

@ -38,14 +38,6 @@ class Framework
Revision = "$Revision$"
# Repository information
RepoRevision = ::Msf::Util::SVN.revision
RepoUpdated = ::Msf::Util::SVN.updated
RepoUpdatedDays = ::Msf::Util::SVN.days_since_update
RepoUpdatedDaysNote = ::Msf::Util::SVN.last_updated_friendly
RepoUpdatedDate = ::Msf::Util::SVN.last_updated_date
RepoRoot = ::Msf::Util::SVN.root
# EICAR canary
EICARCorrupted = ::Msf::Util::EXE.is_eicar_corrupted?

View File

@ -32,10 +32,6 @@ class Msf::Modules::Loader::Directory < Msf::Modules::Loader::Base
def each_module_reference_name(path, opts={})
whitelist = opts[:whitelist] || []
::Dir.foreach(path) do |entry|
if entry.downcase == '.svn'
next
end
full_entry_path = ::File.join(path, entry)
type = entry.singularize

View File

@ -2837,16 +2837,8 @@ class Core
# Returns the revision of the framework and console library
#
def cmd_version(*args)
svn_console_version = "$Revision: 15168 $"
svn_metasploit_version = Msf::Framework::Revision.match(/ (.+?) \$/)[1] rescue nil
if svn_metasploit_version
print_line("Framework: #{Msf::Framework::Version}.#{svn_metasploit_version}")
else
print_line("Framework: #{Msf::Framework::Version}")
end
print_line("Console : #{Msf::Framework::Version}.#{svn_console_version.match(/ (.+?) \$/)[1]}")
return true
print_line("Framework: #{Msf::Framework::Version}")
print_line("Console : #{Msf::Framework::Version}")
end
def cmd_grep_help

View File

@ -21,7 +21,3 @@ end
# Executable generation and encoding
require 'msf/util/exe'
# Parse SVN entries
require 'msf/util/svn'

View File

@ -1,120 +0,0 @@
# -*- coding: binary -*-
###
#
# framework-util-svn
# --------------
#
# The class provides methods for parsing the SVN information in the framework directory
#
###
require 'date'
module Msf
module Util
class SVN
def self.load_root
info = {}
path = ::File.join(::File.dirname(__FILE__), "..", "..", "..", ".svn", "entries")
if !::File.exists?(path)
return info
end
contents = ''
File.open(path, "rb") do |fd|
contents = fd.read(::File.size(path))
end
if contents.include? "<?xml"
require 'rexml/document'
rd = REXML::Document.new(contents).root
rd.elements.each { |e|
if e.attributes['name'] == ""
info[:root] = e.attributes['url']
info[:revision] = e.attributes['revision']
info[:updated] = e.attributes['committed-date']
break
end
}
else
ents = contents.split("\x0c")
ents[0].split("\n").each do |line|
line.strip!
next if line.empty?
case line
when /framework3/
info[:root] = line
when /^\d+$/
info[:revision] = line.to_i
when /^\d{4}-\d.*T/
info[:updated] = line
end
break if (info[:root] and info[:revision] and info[:updated])
end
end
info
end
def self.revision
@@info ||= load_root
@@info[:revision]
end
def self.updated
@@info ||= load_root
@@info[:updated]
end
def self.root
@@info ||= load_root
@@info[:root]
end
def self.days_since_update
@@info ||= load_root
svnt = @@info[:updated]
if(not svnt)
return
end
# 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
diff = self.days_since_update
case diff
when nil
"at an unknown date"
when -2.0 .. 1.0
"today"
when 1.0 .. 2.0
"yesterday"
else
if (diff.to_i > 7)
"%red#{diff.to_i} days ago%clr"
else
"#{diff.to_i} days ago"
end
end
end
def self.last_updated_date
@@info ||= load_root
svnt = @@info[:updated]
if(not svnt)
return
end
begin
Date.parse(@@info[:updated])
rescue ArgumentError
end
end
end
end
end

View File

@ -106,7 +106,7 @@ module Msf
#Use Msf::Config.get_config_root as the location.
File.open("#{xindex}", "w+") do |f|
#need to add version line.
f.puts(Msf::Framework::RepoRevision)
f.puts(Msf::Framework::Version)
framework.exploits.sort.each { |refname, mod|
stuff = ""
o = nil
@ -512,7 +512,7 @@ module Msf
when '-S', '--search'
search_term = /#{args.shift}/nmi
end
end
end
if !nessus_verify_token
return
@ -562,7 +562,7 @@ module Msf
when '-S', '--search'
search_term = /#{args.shift}/nmi
end
end
end
if !nessus_verify_token
return
end
@ -727,7 +727,7 @@ module Msf
scan_id = arg,
host_id = args.shift
end
end
end
if [scan_id, host_id].any?(&:nil?)
print_status("Usage: ")
@ -818,7 +818,7 @@ module Msf
else
scan_id = arg
end
end
end
if [host,rid].any?(&:nil?)
print_status("Usage: ")
@ -894,7 +894,7 @@ module Msf
when '-S', '--search'
search_term = /#{args.shift}/nmi
end
end
end
if !nessus_verify_token
return
@ -1285,13 +1285,13 @@ module Msf
else
scan_id = arg
if args[0].in?(valid_categories)
category = args.shift
category = args.shift
else
print_error("Invalid category. The available categories are info, hosts, vulnerabilities, and history")
return
end
end
end
end
if !nessus_verify_token
return
@ -1435,7 +1435,7 @@ module Msf
else
family_id = arg
end
end
end
if family_id.nil?
print_status("Usage: ")
@ -1471,11 +1471,11 @@ module Msf
when '-S', '--search'
search_term = /#{args.shift}/nmi
end
end
end
list = @n.list_families
tbl = Rex::Ui::Text::Table.new(
'SearchTerm' => search_term,
'SearchTerm' => search_term,
'Columns' => [
'Family ID',
'Family Name',
@ -1504,7 +1504,7 @@ module Msf
else
plugin_id = arg
end
end
end
if !nessus_verify_token
return
@ -1554,7 +1554,7 @@ module Msf
when '-S', '--search'
search_term = /#{args.shift}/nmi
end
end
end
if !nessus_verify_token
return
@ -1711,7 +1711,7 @@ module Msf
when '-S', '--search'
search_term = /#{args.shift}/nmi
end
end
end
if !nessus_verify_token
return