Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/ui/banner.rb
Views: 11780
# -*- coding: binary -*-1module Msf2module Ui34###5#6# Module that contains some most excellent banners.7#8###9module Banner1011#12# Returns a specific metasploit logo. If the specified file is a relative path13# then the file will be searched for first in the included local directory,14# then in the user-specific directory.15#16def self.readfile(fname)17pathname = fname1819unless File.absolute_path(pathname) == pathname20if File.readable?(File.join(::Msf::Config.logos_directory, fname))21pathname = File.join(::Msf::Config.logos_directory, fname)22elsif File.readable?(File.join(::Msf::Config.user_logos_directory, fname))23pathname = File.join(::Msf::Config.user_logos_directory, fname)24end25end2627fdata = "<< Missing banner: #{pathname} >>"28begin29raise ArgumentError unless File.readable?(pathname)30raise ArgumentError unless File.stat(pathname).size < 65_53631fdata = File.open(pathname) {|f| f.read f.stat.size}32rescue SystemCallError, ArgumentError33nil34end35return fdata36end3738def self.to_s39return self.readfile ENV['MSFLOGO'] if ENV['MSFLOGO']4041logos = []4243# Easter egg (always a cow themed logo): export/set GOCOW=144if ENV['GOCOW']45logos.concat(Dir.glob(::Msf::Config.logos_directory + File::SEPARATOR + 'cow*.txt'))46# Easter egg (always a halloween themed logo): export/set THISISHALLOWEEN=147elsif ( ENV['THISISHALLOWEEN'] || Time.now.strftime("%m%d") == "1031" )48logos.concat(Dir.glob(::Msf::Config.logos_directory + File::SEPARATOR + '*.hwtxt'))49elsif ( ENV['APRILFOOLSPONIES'] || Time.now.strftime("%m%d") == "0401" )50logos.concat(Dir.glob(::Msf::Config.logos_directory + File::SEPARATOR + '*.aftxt'))51else52logos.concat(Dir.glob(::Msf::Config.logos_directory + File::SEPARATOR + '*.txt'))53logos.concat(Dir.glob(::Msf::Config.user_logos_directory + File::SEPARATOR + '*.txt'))54end5556logos = logos.map { |f| File.absolute_path(f) }57self.readfile logos[rand(logos.length)]58end59end6061end62end636465