Module: Msf::Post::WebRTC
- Defined in:
- lib/msf/core/post/webrtc.rb
Instance Method Summary collapse
-
#connect_video_chat(server, channel, offerer_id) ⇒ Object
Connects to a video chat session as an answerer.
-
#load_api_code ⇒ String
Returns the webcam API.
-
#load_interface(html_name) ⇒ String
Returns the webcam interface.
Instance Method Details
#connect_video_chat(server, channel, offerer_id) ⇒ Object
Connects to a video chat session as an answerer
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/msf/core/post/webrtc.rb', line 11 def connect_video_chat(server, channel, offerer_id) interface = load_interface('answerer.html') interface.gsub!(/\=SERVER\=/, server) interface.gsub!(/\=RHOST\=/, rhost) interface.gsub!(/\=CHANNEL\=/, channel) interface.gsub!(/\=OFFERERID\=/, offerer_id) tmp_interface = Tempfile.new(['answerer', '.html']) tmp_interface.binmode tmp_interface.write(interface) tmp_interface.close found_local_browser = Rex::Compat.open_webrtc_browser(tmp_interface.path) unless found_local_browser raise RuntimeError, "Unable to find a suitable browser to connect to the target" end end |
#load_api_code ⇒ String
Returns the webcam API
50 51 52 53 54 55 |
# File 'lib/msf/core/post/webrtc.rb', line 50 def load_api_code js_api_path = ::File.join(Msf::Config.data_directory, 'webcam', 'api.js') api = '' ::File.open(js_api_path) { |f| api = f.read } api end |
#load_interface(html_name) ⇒ String
Returns the webcam interface
36 37 38 39 40 41 42 |
# File 'lib/msf/core/post/webrtc.rb', line 36 def load_interface(html_name) interface_path = ::File.join(Msf::Config.data_directory, 'webcam', html_name) interface_code = '' ::File.open(interface_path) { |f| interface_code = f.read } interface_code.gsub!(/\=WEBRTCAPIJS\=/, load_api_code) interface_code end |