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:
antisnatchor
2013-01-02 20:09:23 +01:00
parent 1ce620a626
commit c0a256f1b0
2 changed files with 3 additions and 44 deletions

View File

@@ -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,

View File

@@ -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 + "/"