2005-12-17 07:46:23 +01:00
|
|
|
#!/usr/bin/env ruby
|
2012-06-29 07:18:28 +02:00
|
|
|
# -*- coding: binary -*-
|
2005-11-28 22:38:48 +01:00
|
|
|
#
|
|
|
|
# This user interface provides users with a command console interface to the
|
|
|
|
# framework.
|
|
|
|
#
|
2005-07-13 23:09:07 +02:00
|
|
|
|
2010-05-26 00:29:01 +02:00
|
|
|
#
|
2014-07-29 21:07:14 +02:00
|
|
|
# Standard Library
|
2010-05-26 00:29:01 +02:00
|
|
|
#
|
2014-07-29 21:07:14 +02:00
|
|
|
|
|
|
|
require 'pathname'
|
2010-10-09 02:06:30 +02:00
|
|
|
|
2014-09-18 21:09:38 +02:00
|
|
|
if ENV['METASPLOIT_FRAMEWORK_PROFILE'] == 'true'
|
|
|
|
gem 'perftools.rb'
|
|
|
|
require 'perftools'
|
|
|
|
|
|
|
|
formatted_time = Time.now.strftime('%Y%m%d%H%M%S')
|
|
|
|
root = Pathname.new(__FILE__).parent
|
|
|
|
profile_pathname = root.join('tmp', 'profiles', 'msfconsole', formatted_time)
|
|
|
|
|
|
|
|
profile_pathname.parent.mkpath
|
|
|
|
PerfTools::CpuProfiler.start(profile_pathname.to_path)
|
|
|
|
|
|
|
|
at_exit {
|
|
|
|
PerfTools::CpuProfiler.stop
|
|
|
|
|
|
|
|
puts "Generating pdf"
|
|
|
|
|
2014-09-19 18:13:28 +02:00
|
|
|
pdf_path = "#{profile_pathname}.pdf"
|
2014-09-18 21:09:38 +02:00
|
|
|
|
2014-09-19 18:13:28 +02:00
|
|
|
if Bundler.clean_system("pprof.rb --pdf #{profile_pathname} > #{pdf_path}")
|
|
|
|
puts "PDF saved to #{pdf_path}"
|
2014-09-18 21:09:38 +02:00
|
|
|
|
2014-09-19 18:13:28 +02:00
|
|
|
Rex::Compat.open_file(pdf_path)
|
2014-09-18 21:09:38 +02:00
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2010-05-26 00:29:01 +02:00
|
|
|
#
|
2014-07-29 21:07:14 +02:00
|
|
|
# Project
|
2010-05-26 00:29:01 +02:00
|
|
|
#
|
|
|
|
|
2014-07-29 21:07:14 +02:00
|
|
|
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
|
2014-08-22 17:33:50 +02:00
|
|
|
require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
|
2014-07-29 21:07:14 +02:00
|
|
|
require 'metasploit/framework/command/console'
|
2005-05-22 21:39:21 +02:00
|
|
|
|
2014-07-29 21:07:14 +02:00
|
|
|
Metasploit::Framework::Command::Console.start
|