msf_irb_shell.rb 608 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env ruby
  2. ##
  3. # This module requires Metasploit: https://metasploit.com/download
  4. # Current source: https://github.com/rapid7/metasploit-framework
  5. ##
  6. begin
  7. msfbase = __FILE__
  8. while File.symlink?(msfbase)
  9. msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
  10. end
  11. $:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
  12. require 'msfenv'
  13. $:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
  14. require 'rex'
  15. framework = Msf::Simple::Framework.create
  16. Rex::Ui::Text::IrbShell.new(binding).run
  17. rescue SignalException => e
  18. puts("Aborted! #{e}")
  19. end