I'd like to add to or change the ASCII art that gets displayed on startup in Metasploit.
Where is/are the file(s) I need to edit to do this, and what is the syntax? How can I include color in the art? Does it support Unicode characters?
The banners are defined in the ruby source code, in msf/lib/msf/ui/banner.rb
.
They're simple Ruby strings, delimited usually by single quotes or %Q{
/}
if formatting placeholders are used. Between these strings, there's just a comma. Just add one to the array, they are chosen by random (at the end of the file).
You should adhere to Ruby string rules (don't put '
in there if you use them as delimiters, for example). Ruby apparently has some unicode issues, but the Ruby docs will probably tell you more about this.
Metasploit banners support the colors and formatting (bold, underline) defined in msf/lib/rex/ui/text/color.rb
— basically the regular 16 or so terminal colors.
Metasploit will parse it and output the color... it removes spaces and can mess up your spacing.
variable = "%cyn" + "Make me cyan color!!!" + "%clr"
print_line(variable)
Referenced here https://github.com/pwnieexpress/metasploit-framework/blob/master/lib/rex/ui/text/color.rb
str.gsub!(/%cya/, pre_color+colorize('cyan')+post_color)
str.gsub!(/%red/, pre_color+colorize('red')+post_color)
str.gsub!(/%grn/, pre_color+colorize('green')+post_color)
str.gsub!(/%blu/, pre_color+colorize('blue')+post_color)
str.gsub!(/%yel/, pre_color+colorize('yellow')+post_color)
str.gsub!(/%whi/, pre_color+colorize('white')+post_color)
str.gsub!(/%mag/, pre_color+colorize('magenta')+post_color)
str.gsub!(/%blk/, pre_color+colorize('black')+post_color)
str.gsub!(/%dred/, pre_color+colorize('dark', 'red')+post_color)
str.gsub!(/%dgrn/, pre_color+colorize('dark', 'green')+post_color)
str.gsub!(/%dblu/, pre_color+colorize('dark', 'blue')+post_color)
str.gsub!(/%dyel/, pre_color+colorize('dark', 'yellow')+post_color)
str.gsub!(/%dcya/, pre_color+colorize('dark', 'cyan')+post_color)
str.gsub!(/%dwhi/, pre_color+colorize('dark', 'white')+post_color)
str.gsub!(/%dmag/, pre_color+colorize('dark', 'magenta')+post_color)
str.gsub!(/%und/, pre_color+colorize('underline')+post_color)
str.gsub!(/%bld/, pre_color+colorize('bold')+post_color)
str.gsub!(/%clr/, pre_color+colorize('clear')+post_color)