rapid7/metasploit-framework — pull request #697 by kernelsmith (2012-08-15 18:25:30+00:00)
Title: Console alias

see commit history for details, but adds the 'alias' command to msfconsole.
Some other changes:
adds alias (cmd_alias) to core.rb
basically anything can be aliased using -f, except a few safe words like rm -rf and msfconsole, additionally an alias can't have the name alias otherwise a user could end up in a state where one cannot unalias an overaliased core command like 'set'.

Aliases will tab complete, and the alias command will tab complete with any loaded command or current alias (you can also alias an alias)
adds @aliases to core, accessed via an attr_reader and changed via the cmd_alias method
adds @allow_aliases, accessed via an attr_reader and set as a protected attr_writer by initialization and defangedness
allow_aliases follows the same relationship that command_passthru has

in order to allow cmd_alias to verify valid aliases, some changes were made to dispatcher_shell:
is_valid_dispatcher_command? was added which can search all or a specified dispatcher and has an option for whether to search deprecated commands. This provides the basis for
get_responding_dispatcher, which was also added. As a result, run_single was simplified by updating it to use get_responding_dispatcher. Possibly some other code could be updated with these methods, but I didn't want to go too nuts.

Updated after some comments from egypt. Old PR was #637, ver 2 was #675, this one fixes an issue egypt pointed out on IRC