New trunk.

git-svn-id: https://beef.googlecode.com/svn/trunk@906 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
scotty.b.brown@gmail.com
2011-04-20 07:44:19 +00:00
parent bede2de811
commit 2773a31eef
5 changed files with 281 additions and 0 deletions

54
INSTALL Normal file
View File

@@ -0,0 +1,54 @@
Most of the contents of this file will eventually be added to /install.rb. In the meantime tips, hints and guides for installing beef should be kept here.
=============================================
1. Prerequisites (platform independent)
2. Prerequisites (Windows)
3. Prerequisites (Linux)
4. Prerequisites (Mac OSX)
5. Install instructions
1. Prerequisites (platform independent)
Beef requires ruby 1.8
2. Prerequisites (Windows)
Windows requires the sqlite.dll. Simply grab the zip file below and extract it to your Ruby bin directory:
http://www.sqlite.org/sqlitedll-3_7_0_1.zip
3. Prerequisites (Linux)
!!! This must be done PRIOR to running the Beef installer !!!
On linux you will need to find the packages specific to your distribution for sqlite. An example for Ubuntu systems is:
sudo apt-get install libsqlite3-dev sqlite3 sqlite3-doc
You also need to install the ruby-dev package (required for mkmf)
sudo apt-get install ruby-dev
4. Prerequisites (Mac OSX)
Make sure you have XCode installed - which provided the sqlite support Beef needs
5. Install instructions
Obtain application code either by downloading an archive from http://code.google.com/p/beef/downloads/list or checking out the source from http://code.google.com/p/beef/source/checkout
Navigate to the ruby source directory and run:
ruby install
The installer verifies required gems, including any specific version dependencies
The installer offers a choice of auto-installing missing gems or provides the command so you can install gems manually

1
VERSION Normal file
View File

@@ -0,0 +1 @@
0.4.2.4-alpha

57
beef Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/env ruby
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '.'))
$root_dir = File.expand_path('..', __FILE__)
require 'core/loader'
#prints welcome message
BeEF::Extension::Console::Banners.print_welcome_msg
# load config
config = BeEF::Core::Configuration.instance
# disable reverse dns
Socket.do_not_reverse_lookup = true
# setup database
case config.get("beef.default_db")
when "sqlite"
DataMapper.setup(:default, "sqlite3://#{$root_dir}/#{config.get("beef.database.sqlite.db_name")}")
when "mysql"
DataMapper.setup(:default, "mysql://#{config.get("beef.database.mysql.db_user")}:#{config.get("beef.database.mysql.db_passwd")}@#{config.get("beef.database.mysql.db_host")}/#{config.get("beef.database.mysql.db_name")}")
else
print_error 'No default database selected. Please add one in config.yaml'
end
BeEF::Extension::Console::Banners.print_network_interfaces_count
if BeEF::Extension::Console.resetdb?
print_info 'Resetting the database for BeEF.'
DataMapper.auto_migrate!
else
DataMapper.auto_upgrade!
end
# if metasploit is unreachable it can take 10/15 seconds to load
print_info 'BeEF is loading. Wait a few seconds...'
# check for new command modules
BeEF::Core::Migration.instance.update_db!
# prepare the web server to run
http_hook_server = BeEF::Core::Server.instance
http_hook_server.prepare
# prints information back to the user before running the server
BeEF::Extension::Console::Banners.print_loaded_extensions
BeEF::Extension::Console::Banners.print_network_interfaces_routes
# We dynamically get the list of all browser hook handler using the API and register them
BeEF::API.fire(BeEF::API::Server::Handler, :pre_http_start, http_hook_server)
# starts the web server
http_hook_server.start

57
config.yaml Normal file
View File

@@ -0,0 +1,57 @@
# BeEF Configuration file
beef:
version: '0.4.2.5-alpha'
debug: false
#supported DBs: sqlite, MySQL
default_db: "sqlite"
restrictions:
# subnet of browser ip addresses that can hook to the framework
permitted_hooking_subnet: "0.0.0.0/0"
# subnet of browser ip addresses that can connect to the UI
# permitted_ui_subnet = "127.0.0.1/32"
permitted_ui_subnet: "0.0.0.0/0"
http:
host: "0.0.0.0"
port: "3000"
# if running behind a nat set the public ip address here
#public: ""
dns: "localhost"
demo_path: "/demos/basic.html"
panel_path: "/ui/panel"
hook_file: "/hook.js"
hook_session_name: "BEEFHOOK"
session_cookie_name: "BEEFSESSION"
ui:
username: "beef"
password: "beef"
favicon_file_name: "favicon.ico"
favicon_dir: "/images"
login_fail_delay: 1
database:
# please note that the db should exists. Schema will be created automatically.
# mysql> create database beef;
# mysql> grant all privileges on beef.* to 'beef'@'localhost' identified by 'beef123';
mysql:
db_host: "localhost"
db_name: "beef"
db_user: "beef"
db_passwd: "beef123"
sqlite:
db_name: "beef.db"
crypto_default_value_length: 80
# You may override default extension configuration parameters here
extension:
requester:
enable: true
proxy:
enable: true
msf:
enable: false

112
install Normal file
View File

@@ -0,0 +1,112 @@
require 'rubygems'
puts "\nWelcome to the BEeF installer!"
puts "\nPlease make sure you have installed SQLite before proceeding. For instructions on how to do this please see the INSTALL file"
# array of required gems - add to as needed (specify a version if needed eg "gem_name, =x.x.x")
$gems_required = ["ansi", "term-ansicolor", "dm-core", "json", "data_objects", "do_sqlite3", "sqlite3", "dm-sqlite-adapter",
"parseconfig", "erubis", "dm-migrations"]
# array of missing non-version specific gems installed
$gems_missing = Array.new
# array of missing version specific gems installed
$gems_missing_version = Array.new
# check all required gems (dependencies) are present
def dep_check
$gems_required.each do |current_gem|
begin
if current_gem.include? ","
tokens = current_gem.split(",")
gem tokens[0], tokens[1]
else
gem current_gem
end
rescue Gem::LoadError
if current_gem.include? ","
$gems_missing_version << current_gem
else
$gems_missing << current_gem
end
end
end
if $gems_missing.length == 0 && $gems_missing_version.length == 0
return true
else
return false
end
end
# display install options
def display_opts
puts "\n1) Install all required gems automatically\n" + "2) List required gems and exit so they can be installed manually\n" + "3) Exit installer\n\n"
option = gets
return option
end
# generate install command for missing gems
def install_command
if RUBY_PLATFORM =~ /linux/ or RUBY_PLATFORM =~ /darwin/
cmd = "sudo gem install"
$gems_missing.each do |current_gem|
cmd = cmd + " #{current_gem}"
end
if $gems_missing_version.length != 0
$gems_missing_version.each do |current_gem|
if cmd == "sudo gem install"
cmd = cmd + " #{current_gem}"
else
cmd = cmd + " && sudo gem install #{current_gem}"
end
end
end
else
cmd = "gem install"
$gems_missing.each do |current_gem|
cmd = cmd + " #{current_gem}"
end
if $gems_missing_version.length != 0
$gems_missing_version.each do |current_gem|
if cmd == "gem install"
cmd = cmd + " #{current_gem}"
else
cmd = cmd + " & gem install #{current_gem}"
end
end
end
end
cmd = cmd.delete "," "'"
cmd = cmd.gsub("=", "-v")
return cmd
end
# install missing gems
def install_gems
puts install_command + "\n"
system(install_command)
end
dep_met = dep_check()
if dep_met == false
puts "\nSome gems required by BEeF are not present on your system please select an option to continue:"
option = display_opts
while option != "1\n" and option != "2\n" and option != "3\n"
puts "\nInvalid option entered, please select a valid option to continue:"
option = display_opts
end
if option == "1\n"
install_gems
elsif option == "2\n"
cmd = install_command
puts "\nPlease run the following command to update and install all required gems:\n\n" + cmd + "\n\n"
elsif option == "3\n"
puts "\nExiting...\n\n"
end
else
puts "\nAll required gems are present - please run 'ruby beef.rb' to start using BEeF\n\n"
puts "\nThe Default username/password are beef/beef\n\n"
puts "\nAll feedback welcome - http://beef.googlecode.com/\n\n"
end