Skip to content

Commit d209813

Browse files
committed
Grab last bit of audio from target when done.
Also remove module that needs work (we can create later).
1 parent 48e7e83 commit d209813

File tree

2 files changed

+11
-53
lines changed
  • lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi
  • modules/post/multi/manage

2 files changed

+11
-53
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/mic.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ def audio_file_wave_header(sample_rate_hz, num_channels, bits_per_sample, data_s
9191
end
9292

9393
def cmd_mic_start(*args)
94+
get_data = lambda do |channel, file|
95+
data = channel.read(65536)
96+
if data
97+
::File.open(file, 'a') do |f|
98+
f.write(data)
99+
end
100+
data = nil
101+
end
102+
end
94103
device_id = 1
95104
duration = 1800
96105
saved_audio_path = Rex::Text.rand_text_alpha(8) + ".wav"
@@ -138,19 +147,14 @@ def cmd_mic_start(*args)
138147
audio_file_wave_header(11025, 1, 16, 2000000000).each { |e| e.write(outfd) }
139148
end
140149
while client do
150+
get_data.call(channel, saved_audio_path)
141151
Rex::sleep(0.5)
142-
data = channel.read(65536)
143-
if data
144-
::File.open(saved_audio_path, 'a') do |f|
145-
f.write(data)
146-
end
147-
data = nil
148-
end
149152
end
150153
end
151154
rescue ::Timeout::Error
152155
ensure
153156
if mic_started
157+
get_data.call(channel, saved_audio_path)
154158
client.mic.mic_stop
155159
print_status("Streaming stopped.")
156160
end

modules/post/multi/manage/stream_mic.rb

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)