Add another sound and event

Add sound: "We've got a shell"
Add event on_session_fail
bug/bundler_fix
wchen-r7 2015-11-25 22:46:51 -06:00
parent af8c557fa9
commit 776455d10a
4 changed files with 28 additions and 7 deletions

Binary file not shown.

View File

@ -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

View File

@ -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.
#

View File

@ -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")