Skip to content

Commit 8d21a91

Browse files
committed
Add initial wall module
1 parent 7ad42c2 commit 8d21a91

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

modules/post/multi/general/wall.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Post
9+
def initialize(info = {})
10+
super(
11+
update_info(
12+
info,
13+
'Name' => 'Write Messages to Users',
14+
'Description' => %q{
15+
This module utilizes the wall(1) or write(1) utilities, as appropriate,
16+
to send messages to users on the target system.
17+
},
18+
'License' => MSF_LICENSE,
19+
'Author' => [ 'Jon Hart <jon_hart[at]rapid7.com>' ],
20+
# TODO: is there a way to do this on Windows?
21+
'Platform' => %w(linux osx unix),
22+
'SessionTypes' => %w(shell meterpreter)
23+
)
24+
)
25+
register_options(
26+
[
27+
OptString.new('MESSAGE', [true, 'The message to send']),
28+
OptString.new('USERS', [false, 'List of users to write(1) to, separated by commas. ' \
29+
' wall(1)s to all users by default'])
30+
], self.class)
31+
end
32+
33+
def users
34+
datastore['USERS'] ? datastore['USERS'].split(/\s*,\s*/) : nil
35+
end
36+
37+
def message
38+
datastore['MESSAGE'] ? datastore['MESSAGE'] : "Hello metasploit session #{session.id}, the time is #{Time.now}"
39+
end
40+
41+
def run
42+
if users
43+
users.map { |user| cmd_exec("echo '#{message}' | write #{user}") }
44+
else
45+
cmd_exec("echo '#{message}' | wall")
46+
end
47+
end
48+
end

0 commit comments

Comments
 (0)