##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Post
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Write Messages to Users',
'Description' => %q{
This module utilizes the wall(1) or write(1) utilities, as appropriate,
to send messages to users on the target system.
},
'License' => MSF_LICENSE,
'Author' => [
'Jon Hart <jon_hart[at]rapid7.com>' # original metasploit module
],
# TODO: is there a way to do this on Windows?
'Platform' => %w[linux osx unix],
'SessionTypes' => %w[shell meterpreter]
)
)
register_options(
[
OptString.new('MESSAGE', [false, 'The message to send', '']),
OptString.new('USERS', [
false, 'List of users to write(1) to, separated by commas. ' \
' wall(1)s to all users by default'
]),
OptBool.new('COWSAY', [true, 'Display MESSAGE in a ~cowsay way', false])
]
)
end
def users
datastore['USERS'] ? datastore['USERS'].split(/\s*,\s*/) : nil
end
def message
if datastore['MESSAGE'].blank?
text = "Hello from a metasploit session at #{Time.now}"
else
text = datastore['MESSAGE']
end
datastore['COWSAY'] ? Rex::Text.cowsay(text) : text
end
def run
if users
# this requires that the target user has write turned on
users.map { |user| cmd_exec("echo '#{message}' | write #{user}") }
else
# this will send the messages to all users, regardless of whether or
# not they have write turned on. If the session is root, the -n will disable
# the annoying banner
cmd_exec("echo '#{message}' | wall -n")
end
end
end
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation