Refactored Ipec and Autorun tabs to use the new beefwui object: get_rest_token is now a common function :D
This commit is contained in:
@@ -113,26 +113,6 @@ function generate_form_input_field(form, input, value, disabled, zombie) {
|
||||
form.add(input_field);
|
||||
}
|
||||
|
||||
function get_rest_token(){
|
||||
var token = "";
|
||||
var url = "/ui/modules/getRestfulApiToken.json";
|
||||
$jwterm.ajax({
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: url,
|
||||
async: false,
|
||||
processData: false,
|
||||
success: function(data){
|
||||
token = data.token;
|
||||
},
|
||||
error: function(){
|
||||
console.log("Error getting RESTful API token");
|
||||
}
|
||||
});
|
||||
return token;
|
||||
}
|
||||
|
||||
function get_module_details(id,token){
|
||||
var mod = null;
|
||||
var url = "/api/modules/"+id+"?token="+token;
|
||||
@@ -203,7 +183,7 @@ function send_modules(token,module_data){
|
||||
/* Creates the same tree as the command module list*/
|
||||
ZombieTab_Autorun = function(zombie) {
|
||||
|
||||
var token = get_rest_token();
|
||||
var token = beefwui.get_rest_token();
|
||||
|
||||
var details_panel = new Ext.FormPanel({
|
||||
id: "zombie-autorun_details"+zombie.session,
|
||||
|
||||
@@ -19,27 +19,6 @@ ZombieTab_IpecTab = function(zombie) {
|
||||
autoscroll: true
|
||||
});
|
||||
|
||||
function get_rest_token(){
|
||||
var token = "";
|
||||
var url = "/ui/modules/getRestfulApiToken.json";
|
||||
$jwterm.ajax({
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: url,
|
||||
async: false,
|
||||
processData: false,
|
||||
success: function(data){
|
||||
token = data.token;
|
||||
console.log(token);
|
||||
},
|
||||
error: function(){
|
||||
console.log("Error getting RESTful API token");
|
||||
}
|
||||
});
|
||||
return token;
|
||||
}
|
||||
|
||||
function get_module_id(name, token){
|
||||
var id = "";
|
||||
var url = "/api/modules/search/" + name + "?token=" + token;
|
||||
@@ -115,7 +94,7 @@ ZombieTab_IpecTab = function(zombie) {
|
||||
var cmd = tokens.join(' '); //needed in case of commands with options
|
||||
cmd = cmd.replace(/\\/g, '\\\\'); //needed to prevent JS errors (\ need to be escaped)
|
||||
|
||||
var token = get_rest_token();
|
||||
var token = beefwui.get_rest_token();
|
||||
var mod_id = get_module_id("BeEF_bind_shell", token);
|
||||
|
||||
var uri = "/api/modules/" + zombie.session + "/" + mod_id + "?token=" + token;
|
||||
@@ -148,7 +127,7 @@ ZombieTab_IpecTab = function(zombie) {
|
||||
|
||||
if(command_id != null){
|
||||
|
||||
var token = get_rest_token();
|
||||
var token = beefwui.get_rest_token();
|
||||
var mod_id = get_module_id("BeEF_bind_shell", token);
|
||||
|
||||
var uri_results = "/api/modules/" + zombie.session + "/" + mod_id + "/"
|
||||
|
||||
Reference in New Issue
Block a user