Class: Msf::Plugin::SessionTagger
Overview
This class hooks all session creation events and allows automated interaction This is only an example of what you can do with plugins
Instance Attribute Summary
Attributes inherited from Msf::Plugin
#opts
#framework
Instance Method Summary
collapse
#on_session_command, #on_session_download, #on_session_filedelete, #on_session_interact, #on_session_output, #on_session_upload
Methods inherited from Msf::Plugin
#add_console_dispatcher, create, #flush, #input, #output, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #remove_console_dispatcher
Constructor Details
#initialize(framework, opts) ⇒ SessionTagger
Returns a new instance of SessionTagger.
39
40
41
42
|
# File 'plugins/session_tagger.rb', line 39
def initialize(framework, opts)
super
self.framework.events.add_session_subscriber(self)
end
|
Instance Method Details
#cleanup ⇒ Object
44
45
46
|
# File 'plugins/session_tagger.rb', line 44
def cleanup
self.framework.events.remove_session_subscriber(self)
end
|
#desc ⇒ Object
52
53
54
|
# File 'plugins/session_tagger.rb', line 52
def desc
"Automatically interacts with new sessions"
end
|
#name ⇒ Object
48
49
50
|
# File 'plugins/session_tagger.rb', line 48
def name
"session_tagger"
end
|
#on_session_close(session, reason = '') ⇒ Object
35
36
37
|
# File 'plugins/session_tagger.rb', line 35
def on_session_close(session,reason='')
print_status("Hooked session #{session.sid} is shutting down")
end
|
#on_session_open(session) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'plugins/session_tagger.rb', line 20
def on_session_open(session)
print_status("Hooked session #{session.sid} / #{session.session_host}")
if (session.interactive?)
session.shell_write("MKDIR C:\\TaggedBy#{ENV['USER']}\n")
session.shell_write("mkdir /tmp/TaggedBy#{ENV['USER']}\n")
end
end
|