2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2012-06-29 05:18:28 +00:00
|
|
|
# -*- coding: binary -*-
|
2005-11-28 21:38:48 +00:00
|
|
|
#
|
|
|
|
# This user interface provides users with a command console interface to the
|
|
|
|
# framework.
|
|
|
|
#
|
2005-07-13 21:09:07 +00:00
|
|
|
|
2010-05-25 22:29:01 +00:00
|
|
|
#
|
2014-07-29 19:07:14 +00:00
|
|
|
# Standard Library
|
2010-05-25 22:29:01 +00:00
|
|
|
#
|
2014-07-29 19:07:14 +00:00
|
|
|
|
|
|
|
require 'pathname'
|
2010-10-09 00:06:30 +00:00
|
|
|
|
2014-09-18 19:09:38 +00: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 16:13:28 +00:00
|
|
|
pdf_path = "#{profile_pathname}.pdf"
|
2014-09-18 19:09:38 +00:00
|
|
|
|
2014-09-19 16:13:28 +00:00
|
|
|
if Bundler.clean_system("pprof.rb --pdf #{profile_pathname} > #{pdf_path}")
|
|
|
|
puts "PDF saved to #{pdf_path}"
|
2014-09-18 19:09:38 +00:00
|
|
|
|
2014-09-19 16:13:28 +00:00
|
|
|
Rex::Compat.open_file(pdf_path)
|
2014-09-18 19:09:38 +00:00
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2010-05-25 22:29:01 +00:00
|
|
|
#
|
2014-07-29 19:07:14 +00:00
|
|
|
# Project
|
2010-05-25 22:29:01 +00:00
|
|
|
#
|
|
|
|
|
2014-07-29 19:07:14 +00:00
|
|
|
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
|
2018-04-01 07:12:53 +00:00
|
|
|
begin
|
|
|
|
require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
|
|
|
|
require 'metasploit/framework/command/console'
|
|
|
|
require 'msf/core/payload_generator'
|
|
|
|
Metasploit::Framework::Command::Console.start
|
|
|
|
rescue Interrupt
|
|
|
|
puts "\nAborting..."
|
|
|
|
exit(1)
|
|
|
|
end
|