1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00
metasploit-framework/plugins/event_tester.rb
James Lee a9b1462e9d add a callback for session commands. fixes 618
git-svn-id: file:///home/svn/framework3/trunk@8075 4d416f70-5f16-0410-b530-b9f4589650da
2010-01-06 05:06:12 +00:00

36 lines
925 B
Ruby

module Msf
class Plugin::EventTester < Msf::Plugin
class Subscriber
def respond_to?(name)
# Why yes, I can do that.
true
end
def method_missing(name, *args)
$stdout.puts("Event fired: #{name}(#{args.join(", ")})")
end
end
def name; "event_tester"; end
def initialize(framework, opts)
super
@subscriber = Subscriber.new
framework.events.add_exploit_subscriber(@subscriber)
framework.events.add_session_subscriber(@subscriber)
framework.events.add_general_subscriber(@subscriber)
framework.events.add_db_subscriber(@subscriber)
framework.events.add_ui_subscriber(@subscriber)
end
def cleanup
framework.events.remove_exploit_subscriber(@subscriber)
framework.events.remove_session_subscriber(@subscriber)
framework.events.remove_general_subscriber(@subscriber)
framework.events.remove_db_subscriber(@subscriber)
framework.events.remove_ui_subscriber(@subscriber)
end
end
end