12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!/usr/bin/env ruby
- # -*- coding: binary -*-
- #
- # This user interface provides users with a command console interface to the
- # framework.
- #
- #
- # Standard Library
- #
- require 'pathname'
- 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"
- pdf_path = "#{profile_pathname}.pdf"
- if Bundler.clean_system("pprof.rb --pdf #{profile_pathname} > #{pdf_path}")
- puts "PDF saved to #{pdf_path}"
- Rex::Compat.open_file(pdf_path)
- end
- }
- end
- #
- # Project
- #
- # @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
- require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
- require 'metasploit/framework/command/console'
- Metasploit::Framework::Command::Console.start
|