Created a new beef_common.js files with common functions for the Web UI. Registered as beefwui in the main window object.
This commit is contained in:
@@ -13,12 +13,16 @@
|
|||||||
<%= script_tag 'ext-base.js' %>
|
<%= script_tag 'ext-base.js' %>
|
||||||
<%= script_tag 'ext-all.js' %>
|
<%= script_tag 'ext-all.js' %>
|
||||||
<%= script_tag 'ext-beef.js' %>
|
<%= script_tag 'ext-beef.js' %>
|
||||||
|
|
||||||
<!-- jQuery encoder (ESAPI way) -->
|
<!-- jQuery encoder (ESAPI way) -->
|
||||||
<%= script_tag 'esapi/jquery-1.6.4.min.js' %>
|
<%= script_tag 'esapi/jquery-1.6.4.min.js' %>
|
||||||
<%= script_tag 'esapi/Class.create.js' %>
|
<%= script_tag 'esapi/Class.create.js' %>
|
||||||
<%= script_tag 'esapi/jquery-encoder-0.1.0.js' %>
|
<%= script_tag 'esapi/jquery-encoder-0.1.0.js' %>
|
||||||
<script type="text/javascript" language="JavaScript">var $jEncoder = jQuery.noConflict();</script>
|
<script type="text/javascript" language="JavaScript">var $jEncoder = jQuery.noConflict();</script>
|
||||||
<!--/ jQuery encoder (ESAPI way) -->
|
|
||||||
|
<!-- BeEF Web UI common functions-->
|
||||||
|
<%= script_tag 'ui/common/beef_common.js' %>
|
||||||
|
|
||||||
<%= script_tag 'ux/TabCloseMenu.js' %>
|
<%= script_tag 'ux/TabCloseMenu.js' %>
|
||||||
<%= script_tag 'ux/StatusBar.js' %>
|
<%= script_tag 'ux/StatusBar.js' %>
|
||||||
<%= script_tag 'ux/PagingStore.js' %>
|
<%= script_tag 'ux/PagingStore.js' %>
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
//
|
||||||
|
// Copyright (c) 2006-2013 Wade Alcorn - wade@bindshell.net
|
||||||
|
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||||
|
// See the file 'doc/COPYING' for copying permission
|
||||||
|
//
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* BeEF Web UI commons
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(typeof beefwui === 'undefined' && typeof window.beefwui === 'undefined') {
|
||||||
|
|
||||||
|
var BeefWUI = {
|
||||||
|
|
||||||
|
rest_token: "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the token needed to call the RESTful API.
|
||||||
|
* This is obviously a post-auth call.
|
||||||
|
*/
|
||||||
|
get_rest_token: function() {
|
||||||
|
if(this.rest_token.length == 0){
|
||||||
|
var url = "/ui/modules/getRestfulApiToken.json";
|
||||||
|
jQuery.ajax({
|
||||||
|
contentType: 'application/json',
|
||||||
|
dataType: 'json',
|
||||||
|
type: 'GET',
|
||||||
|
url: url,
|
||||||
|
async: false,
|
||||||
|
processData: false,
|
||||||
|
success: function(data){
|
||||||
|
beefwui.rest_token = data.token;
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
beefwui.rest_token = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this.rest_token;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.beefwui = BeefWUI;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user