Mirror of metasploit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

msfconsole 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env ruby
  2. # -*- coding: binary -*-
  3. #
  4. # This user interface provides users with a command console interface to the
  5. # framework.
  6. #
  7. #
  8. # Standard Library
  9. #
  10. require 'pathname'
  11. if ENV['METASPLOIT_FRAMEWORK_PROFILE'] == 'true'
  12. gem 'perftools.rb'
  13. require 'perftools'
  14. formatted_time = Time.now.strftime('%Y%m%d%H%M%S')
  15. root = Pathname.new(__FILE__).parent
  16. profile_pathname = root.join('tmp', 'profiles', 'msfconsole', formatted_time)
  17. profile_pathname.parent.mkpath
  18. PerfTools::CpuProfiler.start(profile_pathname.to_path)
  19. at_exit {
  20. PerfTools::CpuProfiler.stop
  21. puts "Generating pdf"
  22. pdf_path = "#{profile_pathname}.pdf"
  23. if Bundler.clean_system("pprof.rb --pdf #{profile_pathname} > #{pdf_path}")
  24. puts "PDF saved to #{pdf_path}"
  25. Rex::Compat.open_file(pdf_path)
  26. end
  27. }
  28. end
  29. #
  30. # Project
  31. #
  32. # @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
  33. begin
  34. require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
  35. require 'metasploit/framework/command/console'
  36. require 'msf/core/payload_generator'
  37. Metasploit::Framework::Command::Console.start
  38. rescue Interrupt
  39. puts "\nAborting..."
  40. exit(1)
  41. end