This is the first cut at the tunneling proxy - it is by no means perfect - but it should be functional. git-svn-id: https://beef.googlecode.com/svn/trunk@849 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
42 lines
1.1 KiB
Ruby
42 lines
1.1 KiB
Ruby
require 'webrick/httpproxy'
|
|
require 'webrick/httputils'
|
|
|
|
module BeEF
|
|
class HttpProxyZombie < HttpProxyBase
|
|
|
|
attr_accessor :proxy_zombie_id
|
|
|
|
def initialize
|
|
@configuration = BeEF::Configuration.instance
|
|
|
|
@config = {}
|
|
@config[:BindAddress] = @configuration.get('http_proxy_bind_address')
|
|
@config[:Port] = @configuration.get('http_proxy_bind_port')
|
|
@config[:ServerName] = "BeEF " + @configuration.get('beef_version')
|
|
@config[:ServerSoftware] = "BeEF " + @configuration.get('beef_version')
|
|
|
|
proxy_zombie_id = nil
|
|
|
|
super
|
|
end
|
|
|
|
def service(req, res)
|
|
|
|
# TODO implement which HB to target
|
|
if false
|
|
return if proxy_zombie_id.nil? # check if zombie is set
|
|
zombie = BeEF::Models::Zombie.get(proxy_zombie_id)
|
|
return if not zombie # check if zombie is registered with beef
|
|
else
|
|
proxy_zombie_id = 1
|
|
end
|
|
|
|
# blocking request
|
|
res = HttpProxyZombieHandler::forward_request(proxy_zombie_id, req, res)
|
|
|
|
# remove beef hook if it exists
|
|
remove_hook(res)
|
|
|
|
end
|
|
end
|
|
end |