1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-29 18:07:27 +01:00
metasploit-framework/tools/module_changelog.rb
Luke Imhoff b863978028
Remove fastlib
MSP-11368
MSP-11143

Remove fastlib as it slows down the code loading process.  From the
previous commit, the mean loading for
`METASPLOIT_FRAMEWORK_PROFILE=true msfconsole -q -x exit` was
27.9530±0.3485 seconds (N=10).  The mean after removal of fastlib
was 17.9820±0.6497 seconds (N=10).  This means an average 35.67%
reduction in boot time.
2014-09-18 15:24:21 -05:00

81 lines
1.8 KiB
Ruby
Executable File

#!/usr/bin/env ruby
#
# $Id$
#
# This script generates module changelogs
#
# $Revision$
#
msfbase = __FILE__
while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', 'lib')))
require 'msfenv'
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
require 'rex'
require 'msf/ui'
require 'msf/base'
def usage
$stderr.puts "#{$0} <src rev> [dst rev]"
exit(0)
end
src_rev = ARGV.shift || usage()
dst_rev = ARGV.shift || "HEAD"
$stderr.puts "[*] Extracting changes from Subversion..."
data = `svn diff -r #{src_rev}:#{dst_rev} --summarize https://www.metasploit.com/svn/framework3/trunk/modules/`
# Always disable the database (we never need it just to list module
# information).
framework_opts = { 'DisableDatabase' => true }
# Initialize the simplified framework instance.
framework = Msf::Simple::Framework.create(framework_opts)
madd = []
mdel = []
mmod = []
data.each_line do |line|
action, mname = line.strip.split(/\s+/, 2)
mname = mname.gsub(/^.*modules\//, '').gsub('exploits', 'exploit').gsub(/\.rb$/, '')
case action
when /^A/
# Added a new module
m = framework.modules.create(mname)
if m
madd << "\"#{m.name}\":http://www.metasploit.com/modules/#{mname}"
end
when /^D/
# Deleted a module
mdel << mname
when /^M/
# Modified a module
# Added a new module
m = framework.modules.create(mname)
if m
mmod << "\"#{m.name}\":http://www.metasploit.com/modules/#{mname}"
end
end
end
$stdout.puts "h2. New Modules\n\n"
madd.each { |x| $stdout.puts x }
$stdout.puts "\nh2. Modified Modules\n\n"
mmod.each { |x| $stdout.puts x }
$stdout.puts "\nh2. Removed Modules\n\n"
mdel.each { |x| $stdout.puts "* modules/#{x}" }