Changed default websocket port

This commit is contained in:
antisnatchor
2012-04-07 13:34:21 +01:00
parent ce8919297f
commit faae01a9aa
3 changed files with 28 additions and 26 deletions

View File

@@ -20,35 +20,37 @@ module BeEF
def initialize
print_info("Starting WebSockets")
config = BeEF::Core::Configuration.instance
port = config.get("beef.http.websocket.port")
secure = config.get("beef.http.websocket.secure")
#todo antisnatchor: start websocket secure if beef.http.websocket.secure == true
server = WebSocketServer.new :accepted_domains => "0.0.0.0",
:port => config.get("beef.http.websocket.port")
websThread = Thread.new {
server.run() do |ws|
#@TODO debug print the path and who request for hooked browser mapping
print_info("Path requested #{ws.path} Origins #{ws.origin}")
if ws.path == "/"
ws.handshake() #accept and connect
server = WebSocketServer.new :accepted_domains => "127.0.0.1",
:port => port
print_info("Started WebSocket server: port [#{port.to_s}], secure [#{secure.to_s}]")
while true
#command interpretation
message=ws.receve()
Thread.new {
server.run() do |ws|
#@TODO debug print the path and who request for hooked browser mapping
print_info("Path requested #{ws.path} Origins #{ws.origin}")
if ws.path == "/"
ws.handshake() #accept and connect
while true
#command interpretation
message=ws.receve()
if (message!="helo")
#module return value case
else
print_info("Browser #{ws.origin} says helo! ws is running")
end
if (message!="helo")
#module return value case
else
print_info("Browser #{ws.origin} says helo! ws is running")
end
end
end
end
}
}
end
end
end
end
end
end
end