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/plugins/sounds.rb
Views: 11705
module Msf1###2#3# This class hooks all session creation events and plays a sound4#5###67class Plugin::EventSounds < Msf::Plugin89attr_accessor :theme, :base, :queue, :queue_thread10attr_reader :try_harder, :excellent, :got_a_shell, :exploit_worked, :wonderful1112include Msf::SessionEvent1314def play_sound(event)15queue.push(event)16end1718def on_session_open(_session)19sound = [20excellent,21got_a_shell,22exploit_worked,23wonderful24].sample25play_sound(sound)26end2728def on_session_close(session, reason = '')29# Cannot find an audio clip of muts saying something suitable for this.30end3132def on_session_fail(_reason = '')33play_sound(try_harder)34end3536def on_plugin_load; end3738def on_plugin_unload; end3940def start_sound_queue41self.queue_thread = Thread.new do42loop do43while (event = queue.shift)44path = ::File.join(base, theme, "#{event}.wav")45if ::File.exist?(path)46Rex::Compat.play_sound(path)47else48print_status("Warning: sound file not found: #{path}")49end50end51select(nil, nil, nil, 0.25)52end53rescue ::Exception => e54print_status("Sound plugin: fatal error #{e} #{e.backtrace}")55end56end5758def stop_sound_queue59queue_thread.kill if queue_thread60self.queue_thread = nil61self.queue = []62end6364def init_sound_paths65@try_harder = 'try_harder'66@excellent = 'excellent'67@got_a_shell = 'got_a_shell'68@exploit_worked = 'exploit_worked'69@wonderful = 'wonderful'70end7172def initialize(framework, opts)73super7475init_sound_paths7677self.queue = []78self.theme = opts['theme'] || 'default'79self.base = File.join(Msf::Config.data_directory, 'sounds')80self.framework.events.add_session_subscriber(self)81start_sound_queue8283on_plugin_load84end8586def cleanup87on_plugin_unload88framework.events.remove_session_subscriber(self)89stop_sound_queue90end9192def name93'sounds'94end9596def desc97'Automatically plays a sound when various framework events occur'98end99100end101end102103104