Adds msfbase_dir, switches on apt existance

bug/bundler_fix
Tod Beardsley 2013-02-23 09:19:27 -06:00
parent 7509501b18
commit 2af930f1ff
1 changed files with 31 additions and 3 deletions

View File

@ -85,7 +85,7 @@ class Core
"connect" => "Communicate with a host", "connect" => "Communicate with a host",
"color" => "Toggle color", "color" => "Toggle color",
"exit" => "Exit the console", "exit" => "Exit the console",
"go_pro" => "Launch Metasploit web UI", "go_pro" => "Launch Metasploit web GUI",
"help" => "Help menu", "help" => "Help menu",
"info" => "Displays information about one or more module", "info" => "Displays information about one or more module",
"irb" => "Drop into irb scripting mode", "irb" => "Drop into irb scripting mode",
@ -137,6 +137,17 @@ class Core
"Core" "Core"
end end
# Indicates the base dir where Metasploit Framework is installed.
def msfbase_dir
base = __FILE__
while File.symlink?(base)
base = File.expand_path(File.readlink(base), File.dirname(base))
end
File.expand_path(
File.join(File.dirname(base), "..","..","..","..","..")
)
end
def cmd_color_help def cmd_color_help
print_line "Usage: color <'true'|'false'|'auto'>" print_line "Usage: color <'true'|'false'|'auto'>"
print_line print_line
@ -2582,12 +2593,29 @@ class Core
def cmd_go_pro_help def cmd_go_pro_help
print_line "Usage: go_pro" print_line "Usage: go_pro"
print_line print_line
print_line "Launch the Metasploit web UI" print_line "Launch the Metasploit web GUI"
print_line print_line
end end
def cmd_go_pro(*args) def cmd_go_pro(*args)
print_line "Hey now it's pro time" unless is_apt
print_line " This command is only available on apt-based installations,"
print_line " such as Kali Linux."
return false
end
@@go_pro_opts.parse(args) do |opt, idx, val|
case opt
when "-h"
cmd_go_pro_help
return false
end
end
return true
end
# Determines if this is an apt-based install
def is_apt
File.exists?(File.expand_path(File.join(msfbase_dir, '.apt')))
end end
protected protected