1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00
git-svn-id: file:///home/svn/incoming/trunk@2709 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Matt Miller 2005-07-10 10:20:24 +00:00
parent ca1dab5f27
commit d93792ad46
2 changed files with 28 additions and 0 deletions

View File

@ -16,6 +16,7 @@ class Core
def commands
return {
"?" => "Help menu",
"back" => "Move back from the current context",
"exit" => "Exit the console",
"help" => "Help menu",
"info" => "Displays information about one or more module",
@ -28,14 +29,32 @@ class Core
}
end
#
# Pop the current dispatcher stack context, assuming it isn't pointed at
# the core stack context.
#
def cmd_back(args)
if (driver.dispatcher_stack.size > 1)
# Destack the current dispatcher
driver.destack_dispatcher
# Restore the prompt
driver.update_prompt
end
end
#
# Instructs the driver to stop executing
#
def cmd_exit(args)
driver.stop
end
alias cmd_quit cmd_exit
#
# Displays the command help banner
#
def cmd_help(args)
all_commands = {}

View File

@ -39,7 +39,9 @@ module Shell
super()
end
#
# Run the command processing loop
#
def run
stop_flag = false
@ -50,15 +52,20 @@ module Shell
end
end
#
# Stop processing user input
#
def stop
self.stop_flag = true
end
#
# Change the input prompt
#
def update_prompt(prompt = '', new_prompt_char = nil)
new_prompt = self.init_prompt + ' ' + prompt + prompt_char + ' '
# Substitute colors
new_prompt.gsub!(/%u/, colorize('underline'))
new_prompt.gsub!(/%b/, colorize('bold'))
new_prompt.gsub!(/%c/, colorize('clear'))
@ -131,7 +138,9 @@ module Shell
protected
#
# Parse a line into an array of arguments
#
def parse_line(line)
line.gsub!("(\r|\n)", '')