mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-10-29 18:07:27 +01:00
Add another sound and event
Add sound: "We've got a shell" Add event on_session_fail
This commit is contained in:
parent
af8c557fa9
commit
776455d10a
BIN
data/sounds/default/session_open.mp3
Executable file
BIN
data/sounds/default/session_open.mp3
Executable file
Binary file not shown.
@ -155,7 +155,14 @@ class Exploit
|
||||
# If we didn't run a payload handler for this exploit it doesn't
|
||||
# make sense to complain to the user that we didn't get a session
|
||||
unless (mod.datastore["DisablePayloadHandler"])
|
||||
print_status("Exploit completed, but no session was created.")
|
||||
fail_msg = 'Exploit completed, but no session was created.'
|
||||
print_status(fail_msg)
|
||||
begin
|
||||
framework.events.on_session_fail(fail_msg)
|
||||
rescue ::Exception => e
|
||||
wlog("Exception in on_session_open event handler: #{e.class}: #{e}")
|
||||
wlog("Call Stack\n#{e.backtrace.join("\n")}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -37,6 +37,9 @@ module FrameworkEventManager
|
||||
end
|
||||
end
|
||||
|
||||
def on_session_fail(reason='')
|
||||
end
|
||||
|
||||
#
|
||||
# Called when a session is closed and removed from the framework.
|
||||
#
|
||||
|
@ -14,11 +14,8 @@ module Msf
|
||||
class Plugin::EventSounds < Msf::Plugin
|
||||
|
||||
|
||||
SESSION_CLOSE = 'try_harder'
|
||||
SESSION_OPEN = 'excellent'
|
||||
|
||||
|
||||
attr_accessor :theme, :base, :queue, :queue_thread
|
||||
attr_reader :try_harder, :session_open, :excellent
|
||||
|
||||
include Msf::SessionEvent
|
||||
|
||||
@ -27,11 +24,16 @@ class Plugin::EventSounds < Msf::Plugin
|
||||
end
|
||||
|
||||
def on_session_open(session)
|
||||
play_sound(SESSION_OPEN)
|
||||
sound = [excellent, session_open].sample
|
||||
play_sound(sound)
|
||||
end
|
||||
|
||||
def on_session_close(session, reason='')
|
||||
play_sound(SESSION_CLOSE)
|
||||
play_sound(session_close)
|
||||
end
|
||||
|
||||
def on_session_fail(reason='')
|
||||
play_sound(try_harder)
|
||||
end
|
||||
|
||||
def on_plugin_load
|
||||
@ -67,9 +69,18 @@ class Plugin::EventSounds < Msf::Plugin
|
||||
end
|
||||
|
||||
|
||||
def init_sound_paths
|
||||
@try_harder = 'try_harder'
|
||||
@session_open = 'session_open'
|
||||
@excellent = 'excellent'
|
||||
end
|
||||
|
||||
|
||||
def initialize(framework, opts)
|
||||
super
|
||||
|
||||
init_sound_paths
|
||||
|
||||
self.queue = []
|
||||
self.theme = opts['theme'] || 'default'
|
||||
self.base = File.join(Msf::Config.data_directory, "sounds")
|
||||
|
Loading…
Reference in New Issue
Block a user