CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/plugins/event_tester.rb
Views: 11705
1
module Msf
2
class Plugin::EventTester < Msf::Plugin
3
class Subscriber
4
def respond_to?(_name, *_args)
5
# Why yes, I can do that.
6
true
7
end
8
9
def method_missing(name, *args)
10
$stdout.puts("Event fired: #{name}(#{args.join(', ')})")
11
end
12
end
13
14
def name
15
'event_tester'
16
end
17
18
def desc
19
'Internal test tool used to verify the internal framework event subscriber logic works'
20
end
21
22
def initialize(framework, opts)
23
super
24
@subscriber = Subscriber.new
25
framework.events.add_custom_subscriber(@subscriber)
26
framework.events.add_db_subscriber(@subscriber)
27
framework.events.add_exploit_subscriber(@subscriber)
28
framework.events.add_general_subscriber(@subscriber)
29
framework.events.add_session_subscriber(@subscriber)
30
framework.events.add_ui_subscriber(@subscriber)
31
end
32
33
def cleanup
34
framework.events.remove_custom_subscriber(@subscriber)
35
framework.events.remove_db_subscriber(@subscriber)
36
framework.events.remove_exploit_subscriber(@subscriber)
37
framework.events.remove_general_subscriber(@subscriber)
38
framework.events.remove_session_subscriber(@subscriber)
39
framework.events.remove_ui_subscriber(@subscriber)
40
end
41
end
42
end
43
44