Land #10066, implement AudioOutput api from channel

GSoC/Meterpreter_Web_Console
Tim W 2018-06-11 16:20:11 +08:00
commit 0c891e972f
No known key found for this signature in database
GPG Key ID: 217FBA50ABBAABEF
48 changed files with 184 additions and 46 deletions

View File

@ -20,7 +20,7 @@ PATH
metasploit-model
metasploit-payloads (= 1.3.37)
metasploit_data_models
metasploit_payloads-mettle (= 0.3.8)
metasploit_payloads-mettle (= 0.4.0)
mqtt
msgpack
nessus_rest
@ -172,7 +172,7 @@ GEM
postgres_ext
railties (~> 4.2.6)
recog (~> 2.0)
metasploit_payloads-mettle (0.3.8)
metasploit_payloads-mettle (0.4.0)
method_source (0.9.0)
mini_portile2 (2.3.0)
minitest (5.11.3)

View File

@ -0,0 +1,56 @@
# -*- coding: binary -*-
require 'rex/post/meterpreter/channel'
require 'rex/post/meterpreter/channels/pools/stream_pool'
module Rex
module Post
module Meterpreter
module Extensions
module Stdapi
module AudioOutput
###
#
# Play an audio file
#
###
class AudioOutput
def initialize(client)
@client = client
end
def session
@client
end
# Upload file and play it
def play_file(path)
channel = Channel.create(client, 'audio_output', Rex::Post::Meterpreter::Channels::Pools::StreamPool, CHANNEL_FLAG_SYNCHRONOUS)
# Read file buffers after buffers and upload
buf_size = 8 * 1024 * 1024
src_fd = nil
begin
src_fd = ::File.open(path, 'rb')
src_size = src_fd.stat.size
while (buf = src_fd.read(buf_size))
channel.write(buf)
percent = src_size / src_fd.pos.to_f * 100.0
end
ensure src_fd.close unless src_fd.nil?
end
channel.close()
end
attr_accessor :client
end
end
end
end
end
end
end

View File

@ -20,6 +20,7 @@ require 'rex/post/meterpreter/extensions/stdapi/railgun/railgun'
require 'rex/post/meterpreter/extensions/stdapi/ui'
require 'rex/post/meterpreter/extensions/stdapi/webcam/webcam'
require 'rex/post/meterpreter/extensions/stdapi/mic/mic'
require 'rex/post/meterpreter/extensions/stdapi/audio_output/audio_output'
module Rex
module Post
@ -88,6 +89,10 @@ class Stdapi < Extension
'name' => 'mic',
'ext' => Rex::Post::Meterpreter::Extensions::Stdapi::Mic::Mic.new(client)
},
{
'name' => 'audio_output',
'ext' => Rex::Post::Meterpreter::Extensions::Stdapi::AudioOutput::AudioOutput.new(client)
},
{
'name' => 'ui',
'ext' => UI.new(client)

View File

@ -19,6 +19,7 @@ class Console::CommandDispatcher::Stdapi
require 'rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui'
require 'rex/post/meterpreter/ui/console/command_dispatcher/stdapi/webcam'
require 'rex/post/meterpreter/ui/console/command_dispatcher/stdapi/mic'
require 'rex/post/meterpreter/ui/console/command_dispatcher/stdapi/audio_output'
Klass = Console::CommandDispatcher::Stdapi
@ -29,7 +30,8 @@ class Console::CommandDispatcher::Stdapi
Klass::Sys,
Klass::Ui,
Klass::Webcam,
Klass::Mic
Klass::Mic,
Klass::AudioOutput
]
include Console::CommandDispatcher

View File

@ -0,0 +1,75 @@
# -*- coding: binary -*-
require 'rex/post/meterpreter'
require 'bindata'
module Rex
module Post
module Meterpreter
module Ui
###
#
# Play audio on remote system
#
###
class Console::CommandDispatcher::Stdapi::AudioOutput
Klass = Console::CommandDispatcher::Stdapi::AudioOutput
include Console::CommandDispatcher
#
# List of supported commands.
#
def commands
all = {
'play' => 'play an audio file on target system, nothing written on disk'
}
reqs = {
'play' => []
}
filter_commands(all, reqs)
end
#
# Name for this dispatcher
#
def name
'Stdapi: Audio Output'
end
def cmd_play(*args)
audio_path = nil
play_start_opts = Rex::Parser::Arguments.new(
'-h' => [ false, "Help Banner" ],
'-f' => [ true, "The audio file path (warning: will be copied to memory)" ]
)
play_start_opts.parse(args) do |opt, _idx, val|
case opt
when '-h'
print_line('Usage: audio_play [options]\n')
print_line('Upload file to targets memory and play it from memory')
print_line(play_start_opts.usage)
return
when '-f'
audio_path = val
end
end
if audio_path == nil
print_line('Please specify a path to an audio file via the -f option or use -h')
return
end
print_status("Playing #{audio_path}...")
client.audio_output.play_file(audio_path)
print_status('Done')
end
end
end
end
end
end

View File

@ -72,7 +72,7 @@ Gem::Specification.new do |spec|
# Needed for Meterpreter
spec.add_runtime_dependency 'metasploit-payloads', '1.3.37'
# Needed for the next-generation POSIX Meterpreter
spec.add_runtime_dependency 'metasploit_payloads-mettle', '0.3.8'
spec.add_runtime_dependency 'metasploit_payloads-mettle', '0.4.0'
# Needed by msfgui and other rpc components
spec.add_runtime_dependency 'msgpack'
# get list of network interfaces, like eth* from OS.

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_aarch64_apple_ios'
module MetasploitModule
CachedSize = 692988
CachedSize = 693940
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_aarch64_apple_ios'
module MetasploitModule
CachedSize = 692988
CachedSize = 693940
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_aarch64_apple_ios'
module MetasploitModule
CachedSize = 692988
CachedSize = 693940
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_aarch64_linux'
module MetasploitModule
CachedSize = 968136
CachedSize = 969640
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_aarch64_linux'
module MetasploitModule
CachedSize = 968136
CachedSize = 969640
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_aarch64_linux'
module MetasploitModule
CachedSize = 968136
CachedSize = 969640
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_armbe_linux'
module MetasploitModule
CachedSize = 902904
CachedSize = 903228
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_armbe_linux'
module MetasploitModule
CachedSize = 902904
CachedSize = 903228
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_armbe_linux'
module MetasploitModule
CachedSize = 902904
CachedSize = 903228
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_armle_linux'
module MetasploitModule
CachedSize = 903252
CachedSize = 903576
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_armle_linux'
module MetasploitModule
CachedSize = 903252
CachedSize = 903576
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_armle_linux'
module MetasploitModule
CachedSize = 903252
CachedSize = 903576
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mips64_linux'
module MetasploitModule
CachedSize = 1388296
CachedSize = 1388720
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mips64_linux'
module MetasploitModule
CachedSize = 1388296
CachedSize = 1388720
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mips64_linux'
module MetasploitModule
CachedSize = 1388296
CachedSize = 1388720
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mipsbe_linux'
module MetasploitModule
CachedSize = 1284844
CachedSize = 1285196
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mipsbe_linux'
module MetasploitModule
CachedSize = 1284844
CachedSize = 1285196
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mipsbe_linux'
module MetasploitModule
CachedSize = 1284844
CachedSize = 1285196
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mipsle_linux'
module MetasploitModule
CachedSize = 1286336
CachedSize = 1286688
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mipsle_linux'
module MetasploitModule
CachedSize = 1286336
CachedSize = 1286688
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_mipsle_linux'
module MetasploitModule
CachedSize = 1286336
CachedSize = 1286688
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppc_linux'
module MetasploitModule
CachedSize = 1060864
CachedSize = 1061072
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppc_linux'
module MetasploitModule
CachedSize = 1060864
CachedSize = 1061072
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppc_linux'
module MetasploitModule
CachedSize = 1060864
CachedSize = 1061072
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppc64le_linux'
module MetasploitModule
CachedSize = 1079936
CachedSize = 1080192
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppc64le_linux'
module MetasploitModule
CachedSize = 1079936
CachedSize = 1080192
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppc64le_linux'
module MetasploitModule
CachedSize = 1079936
CachedSize = 1080192
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppce500v2_linux'
module MetasploitModule
CachedSize = 1013544
CachedSize = 1013752
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppce500v2_linux'
module MetasploitModule
CachedSize = 1013544
CachedSize = 1013752
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_ppce500v2_linux'
module MetasploitModule
CachedSize = 1013544
CachedSize = 1013752
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x64_linux'
module MetasploitModule
CachedSize = 906272
CachedSize = 906528
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x64_linux'
module MetasploitModule
CachedSize = 906272
CachedSize = 906528
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x64_linux'
module MetasploitModule
CachedSize = 906272
CachedSize = 906528
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x86_linux'
module MetasploitModule
CachedSize = 957092
CachedSize = 957300
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x86_linux'
module MetasploitModule
CachedSize = 957092
CachedSize = 957300
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x86_linux'
module MetasploitModule
CachedSize = 957092
CachedSize = 957300
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_zarch_linux'
module MetasploitModule
CachedSize = 1071752
CachedSize = 1076128
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_zarch_linux'
module MetasploitModule
CachedSize = 1071752
CachedSize = 1076128
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_zarch_linux'
module MetasploitModule
CachedSize = 1071752
CachedSize = 1076128
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x64_osx'
module MetasploitModule
CachedSize = 802816
CachedSize = 803512
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x64_osx'
module MetasploitModule
CachedSize = 802816
CachedSize = 803512
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions

View File

@ -10,7 +10,7 @@ require 'msf/base/sessions/meterpreter_x64_osx'
module MetasploitModule
CachedSize = 802816
CachedSize = 803512
include Msf::Payload::Single
include Msf::Sessions::MeterpreterOptions