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.
[View source]
37
38
39
40
|
# File 'plugins/session_tagger.rb', line 37
def initialize(framework, opts)
super
self.framework.events.add_session_subscriber(self)
end
|
Instance Method Details
#cleanup ⇒ Object
[View source]
42
43
44
|
# File 'plugins/session_tagger.rb', line 42
def cleanup
framework.events.remove_session_subscriber(self)
end
|
#desc ⇒ Object
[View source]
50
51
52
|
# File 'plugins/session_tagger.rb', line 50
def desc
'Automatically interacts with new sessions to create a new remote TaggedByUser file'
end
|
#name ⇒ Object
[View source]
46
47
48
|
# File 'plugins/session_tagger.rb', line 46
def name
'session_tagger'
end
|
#on_session_close(session, _reason = '') ⇒ Object
[View source]
33
34
35
|
# File 'plugins/session_tagger.rb', line 33
def on_session_close(session, _reason = '')
print_status("Hooked session #{session.sid} is shutting down")
end
|
#on_session_open(session) ⇒ Object
[View source]
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'plugins/session_tagger.rb', line 18
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
|