metasploit-framework/lib/msf/ui/banner.rb

71 lines
1.4 KiB
Ruby
Raw Normal View History

# -*- coding: binary -*-
module Msf
module Ui
###
#
# Module that contains some most excellent banners.
#
###
module Banner
2013-08-30 21:28:33 +00:00
Logos =
%w{
branded-longhorn.txt
cow-head.txt
cowsay.txt
figlet.txt
i-heart-shells.txt
metasploit-shield.txt
missile-command.txt
ninja.txt
null-pointer-deref.txt
r7-metasploit.txt
wake-up-neo.txt
workflow.txt
3kom-superhack.txt
metasploit-park.txt
2013-08-30 21:28:33 +00:00
}
2013-08-30 21:28:33 +00:00
#
# Returns a random metasploit logo.
#
def self.readfile(fname)
pathname = fname
unless File.absolute_path(pathname) == pathname
pathname = File.join(::Msf::Config.logos_directory, fname)
end
fdata = "<< Missing banner: #{pathname} >>"
2013-08-30 21:28:33 +00:00
begin
raise ArgumentError unless File.readable?(pathname)
raise ArgumentError unless File.stat(pathname).size < 4096
fdata = File.open(pathname) {|f| f.read f.stat.size}
rescue SystemCallError, ArgumentError
nil
end
return fdata
end
2013-08-30 21:28:33 +00:00
def self.to_s
# Easter egg (always a cow themed logo): export/set GOCOW=1
if ENV['GOCOW']
case rand(3)
when 0
# branded-longhorn
self.readfile Logos[0]
when 1
# cow-head
self.readfile Logos[1]
else
# cowsay
self.readfile Logos[2]
end
else
self.readfile Logos[rand(Logos.length)]
end
end
end
end
end