Skip to content

Commit

Permalink
Added WebSocket config options for enable, secure and port
Browse files Browse the repository at this point in the history
  • Loading branch information
antisnatchor committed Apr 7, 2012
1 parent 236c8a8 commit 64cee24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion beef
Expand Up @@ -113,7 +113,9 @@ BeEF::Core::Console::Banners.print_network_interfaces_routes
print_info "RESTful API key: #{BeEF::Core::Crypto::api_token}"

#@note Starts the WebSocket server
BeEF::Core::Websocket::Websocket.new
if config.get("beef.http.websocket.enable")
BeEF::Core::Websocket::Websocket.new
end



Expand Down
4 changes: 4 additions & 0 deletions config.yaml
Expand Up @@ -37,6 +37,10 @@ beef:
hook_file: "/hook.js"
hook_session_name: "BEEFHOOK"
session_cookie_name: "BEEFSESSION"
websocket:
enable: true
secure: false # use WebSocketSecure
port: 6666

database:
# For information on using other databases please read the
Expand Down
6 changes: 4 additions & 2 deletions core/main/network_stack/websocket/websocket.rb
Expand Up @@ -21,10 +21,12 @@ class Websocket

def initialize
print_info("Starting WebSockets")
config = BeEF::Core::Configuration.instance

#todo antisnatchor: add config file options for IP/port/enable websocket
#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")

server = WebSocketServer.new(:accepted_domains => "0.0.0.0",:port => 6666) #we get host and port
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}")
Expand Down

0 comments on commit 64cee24

Please sign in to comment.