Running BeEF in Windows 7

Written by

in

beef_plus_win7
I was installing BeEF (The Browser Exploitation Framework) on Windows 7 and ran into a couple of problems.  I eventually got all of them fixed, so I thought I would write up a proper installation guide for future reference.

First, download all of the stuff you will need:

Once all of that has been downloaded, install Ruby using the RubyInstaller and install the Ruby Dev Kit.  I am running Ruby version 1.9.3 and Ruby Development Kit 4.5.2.  Be sure to use the Ruby Dev Kit Installation Instructions.

Next, drop the SQLLite DLL file in your <rubyInstall>\bin directory.

Now, install bundler for Ruby by running the command:

rubyInstall\bin\gem install bundler

The next step is to install the pre-release version of eventmachine.  Run the command:

rubyInstall\bin\gem install eventmachine --pre

This installs eventmachine version 1.0.0.rc.4.

Now to install and configure BeEF.  If you downloaded the ZIP file from GitHub, extract that to C:\BeEF.  From the C:\BeEF directory, run the command:

rubyInstall\bin\bundle install

This installs all of the necessary Ruby gems for BeEF.

Now, we need to make sure BeEF uses eventmachine version 1.0.0.rc.4 and not any other version.  This was my biggest problem getting BeEF to run on Windows 7.  To do this, open C:\BeEF\Gemfile.  Change the version of eventmachine used for Windows from version 1.0.0.beta.4.1 to 1.0.0.rc.4.  After you are done, it should look something like this:

Change eventmachine version in Gemfile

In the example above, I have commented out the version of eventmachine (1.0.0.beta.4.1) that doesn’t work with Windows 7.

Finally, run a gem update command from the C:\BeEF folder to make sure it is calling the right version of eventmachine:

rubyInstall\bin\bundle update eventmachine

You an also run the next command to ensure that BeEF is using the right version of eventmachine, 1.0.0.rc.4.

rubyInstall\bin\bundle show eventmachine

Now you should be able to run “ruby beef” and start testing.

Comments

5 responses to “Running BeEF in Windows 7”

  1. richard Avatar
    richard

    all i got is platform x64-mingw32 is not supported

    1. Aaron Giuoco Avatar

      I’m not sure I can help. I don’t have Win7 anymore. Do you have any more details on the error message?

  2. asf Avatar
    asf

    An error occurred while installing json (1.8.1), and Bundler cannot continue.
    Make sure that `gem install json -v ‘1.8.1’` succeeds before bundling.

  3. aaron Avatar
    aaron

    Hi Manisha. What command exactly are you running to install BeEf?

  4. Manisha Avatar
    Manisha

    Please give some resolution

    I am facing the below error when i run the bundle install command in windows 7

    Fetching source index from http://rubygems.org/
    Could not fetch specs from http://rubygems.org/

    Do we need to change the config file of beef. Because I think I am getting a connection timed out error. Any resolution for the same.

    Please find the contents of config file

    #
    # Copyright (c) 2006-2013 Wade Alcorn – wade@bindshell.net
    # Browser Exploitation Framework (BeEF) – http://beefproject.com
    # See the file ‘doc/COPYING’ for copying permission
    #
    # BeEF Configuration file

    beef:
    version: ‘0.4.4.3-alpha’
    debug: false

    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:
    debug: false #Thin::Logging.debug, very verbose. Prints also full exception stack trace.
    host: “0.0.0.0”
    port: “3000”
    # Decrease this setting up to 1000 if you want more responsiveness when sending modules and retrieving results.
    # It’s not advised to decrease it with tons of hooked browsers (more than 50),
    # because it might impact performance. Also, enable WebSockets is generally better.
    xhr_poll_timeout: 5000
    # if running behind a nat set the public ip address here
    #public: “”
    #public_port: “” # port setting is experimental
    dns: “localhost”
    panel_path: “/ui/panel”
    hook_file: “/hook.js”
    hook_session_name: “BEEFHOOK”
    session_cookie_name: “BEEFSESSION”

    # Prefer WebSockets over XHR-polling when possible.
    websocket:
    enable: false
    secure: true # use WebSocketSecure work only on https domain and whit https support enabled in BeEF
    port: 61985 # WS: good success rate through proxies
    secure_port: 61986 # WSSecure
    ws_poll_timeout: 1000 # poll BeEF every second

    # 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

    # Experimental HTTPS support for the hook / admin / all other Thin managed web services
    https:
    enable: false
    # In production environments, be sure to use a valid certificate signed for the value
    # used in beef.http.dns (the domain name of the server where you run BeEF)
    key: “beef_key.pem”
    cert: “beef_cert.pem”

    database:
    # For information on using other databases please read the
    # README.databases file

    # supported DBs: sqlite, mysql, postgres
    # NOTE: you must change the Gemfile adding a gem require line like:
    # gem “dm-postgres-adapter”
    # or
    # gem “dm-mysql-adapter”
    # if you want to switch drivers from sqlite to postgres (or mysql).
    # Finally, run a ‘bundle install’ command and start BeEF.
    driver: “sqlite”

    # db_file is only used for sqlite
    db_file: “beef.db”

    # db connection information is only used for mysql/postgres
    db_host: “localhost”
    db_name: “beef”
    db_user: “beef”
    db_passwd: “beef123”
    db_encoding: “UTF-8”

    # Credentials to authenticate in BeEF. Used by both the RESTful API and the Admin_UI extension
    credentials:
    user: “beef”
    passwd: “beef”

    # Autorun modules as soon the browser is hooked.
    # NOTE: only modules with target type ‘working’ or ‘user_notify’ can be run automatically.
    autorun:
    enable: true
    # set this to FALSE if you don’t want to allow auto-run execution for modules with target->user_notify
    allow_user_notify: true

    crypto_default_value_length: 80

    # You may override default extension configuration parameters here
    extension:
    requester:
    enable: true
    proxy:
    enable: true
    metasploit:
    enable: false
    social_engineering:
    enable: true
    evasion:
    enable: false
    console:
    shell:
    enable: false
    ipec:
    enable: true

Leave a Reply

Your email address will not be published. Required fields are marked *