Compare commits
145 Commits
v0.5.1.0
...
revert-259
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a7f06b978 | ||
|
|
03f70879f2 | ||
|
|
1152715646 | ||
|
|
8abae7cc85 | ||
|
|
6041cbf595 | ||
|
|
ed4c9169b3 | ||
|
|
d8b5331544 | ||
|
|
a0b589ecd2 | ||
|
|
6f5f5e7493 | ||
|
|
b3d2ee8016 | ||
|
|
cbc5ce1601 | ||
|
|
8a0e122dc9 | ||
|
|
74325078cc | ||
|
|
111a07c016 | ||
|
|
c318b31fd7 | ||
|
|
72261c4fcd | ||
|
|
92e5a50f9b | ||
|
|
9f99d65e39 | ||
|
|
8d98a8e205 | ||
|
|
77983167db | ||
|
|
d1df07f13d | ||
|
|
70685c94a4 | ||
|
|
d761611056 | ||
|
|
87318f5a14 | ||
|
|
94063f2f33 | ||
|
|
fc7df4748f | ||
|
|
24dd89884b | ||
|
|
e69281e341 | ||
|
|
ddc06f1d7e | ||
|
|
8d23c0e482 | ||
|
|
28618367ea | ||
|
|
b1382e0be3 | ||
|
|
c1e63d2486 | ||
|
|
b56345fcdf | ||
|
|
0221a1c7da | ||
|
|
de60112928 | ||
|
|
7a1e500946 | ||
|
|
eea9740f4f | ||
|
|
73a3d17f29 | ||
|
|
f68e420318 | ||
|
|
b87463a60d | ||
|
|
107cdd3f54 | ||
|
|
d9d2c9c64b | ||
|
|
b911c8df23 | ||
|
|
9bc8d017e6 | ||
|
|
a7a4c81468 | ||
|
|
cbe9f66990 | ||
|
|
1c395a3153 | ||
|
|
0636e815db | ||
|
|
b46edb4d1a | ||
|
|
5fdd96f576 | ||
|
|
033dbc1192 | ||
|
|
67892d46a8 | ||
|
|
d2f27e6f2e | ||
|
|
57ab7fda84 | ||
|
|
139359a760 | ||
|
|
38b7ac7c23 | ||
|
|
52996d4fc5 | ||
|
|
4dbced4f55 | ||
|
|
c5e17be6db | ||
|
|
1c7a6e9fef | ||
|
|
f104a5daff | ||
|
|
216d312ebe | ||
|
|
9b277a0276 | ||
|
|
c7a3d4c032 | ||
|
|
1c4ffa33d3 | ||
|
|
908b6a7a0c | ||
|
|
14d7975c7a | ||
|
|
f9f2121219 | ||
|
|
e22d262bbf | ||
|
|
ae9976b050 | ||
|
|
124c9d60b3 | ||
|
|
9f7e1ecfc1 | ||
|
|
b68fcecd46 | ||
|
|
29e025bbfc | ||
|
|
01c3413687 | ||
|
|
a64480dfab | ||
|
|
bbe805f017 | ||
|
|
aa7a6f9e64 | ||
|
|
43af6391f0 | ||
|
|
5f143a8e41 | ||
|
|
bbe4fda350 | ||
|
|
afec9fbaa2 | ||
|
|
20f9f2e530 | ||
|
|
060a3bfae2 | ||
|
|
e75f5a87c2 | ||
|
|
d9cc5cb364 | ||
|
|
dd82546998 | ||
|
|
7c4a90c51a | ||
|
|
fb622e8c4c | ||
|
|
d0e2894137 | ||
|
|
448c3e864b | ||
|
|
9770e09d96 | ||
|
|
8294784268 | ||
|
|
fe7627e169 | ||
|
|
0d084f00c6 | ||
|
|
5f4610a4cb | ||
|
|
35e1f36f44 | ||
|
|
c2a2ce4a4c | ||
|
|
77a30ae720 | ||
|
|
3ed9e7ab2f | ||
|
|
f33e2698a0 | ||
|
|
a606a0bd77 | ||
|
|
e3ec7708e3 | ||
|
|
fe7a07d6c5 | ||
|
|
260c3fc52a | ||
|
|
e0d208e508 | ||
|
|
9e882cd9d5 | ||
|
|
d96af71220 | ||
|
|
2f08343015 | ||
|
|
113e6214f2 | ||
|
|
21fd7ca0c5 | ||
|
|
0b41775618 | ||
|
|
9181c83a87 | ||
|
|
66257f1cf3 | ||
|
|
b42aebd99f | ||
|
|
77c9991a35 | ||
|
|
c6bb893c32 | ||
|
|
6f6124e40f | ||
|
|
d7a3ffb2c3 | ||
|
|
c8595b09b7 | ||
|
|
e9b113226d | ||
|
|
be9b7655fe | ||
|
|
a6fcb1a14f | ||
|
|
784e6db9ce | ||
|
|
0d0e51452c | ||
|
|
08faef394b | ||
|
|
1aa86bd64a | ||
|
|
b7108bc069 | ||
|
|
a674c9d25f | ||
|
|
99c6287a67 | ||
|
|
2794bc3cf4 | ||
|
|
541933a45f | ||
|
|
9cef23be22 | ||
|
|
7c3e342981 | ||
|
|
3b34e428cc | ||
|
|
ea65554a50 | ||
|
|
dc68ed9390 | ||
|
|
1ae320c3bc | ||
|
|
43e3fa5432 | ||
|
|
694df4c17b | ||
|
|
b0e59d2c55 | ||
|
|
b6425e4a90 | ||
|
|
c96b5e8968 | ||
|
|
27e58a714d |
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
||||
# Don't copy over git files
|
||||
.git
|
||||
.github
|
||||
.gitignore
|
||||
doc
|
||||
docs
|
||||
scripts
|
||||
test
|
||||
update-beef
|
||||
77
.github/ISSUE_TEMPLATE.md
vendored
77
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,66 +1,31 @@
|
||||
# Submit Issue
|
||||
|
||||
Verify first that your issue/request has not been posted previously:
|
||||
|
||||
* https://github.com/beefproject/beef/issues
|
||||
* https://github.com/beefproject/beef/wiki/FAQ
|
||||
|
||||
Ensure you're using the [latest version of BeEF](https://github.com/beefproject/beef/releases/tag/v0.5.1.0).
|
||||
|
||||
Please do your best to provide as much information as possible. It will help substantially if you can enable and provide debugging logs with your issue. Instructions for enabling debugging logs are below:
|
||||
|
||||
1. In the `config.yaml` file of your BeEF root folder set debug and client_debug (lines 11 & 13 respectively) to `true`
|
||||
* If using a standard installation of `beef-xss` the root folder will typically be `/usr/share/beef-xss`
|
||||
2. Reproduce your error
|
||||
3. Retrieve your client-side logs from your browser's developer console (Ctrl + Shift + I)
|
||||
4. Retrieve your server-side logs from `~/.beef/beef.log`
|
||||
5. **If using `beef-xss`:** Retrieve your service logs using `journalctl -u beef-xss`
|
||||
|
||||
Thank you, this will greatly aid us in identifying the root cause of your issue :)
|
||||
|
||||
**If we request additional information and we don't hear back from you within a week, we will be closing the ticket off.**
|
||||
Feel free to open it back up if you continue to have issues.
|
||||
|
||||
## Summary
|
||||
|
||||
**Q:** Please provide a brief summary of the issue that you experienced.
|
||||
**A:**
|
||||
|
||||
## Environment
|
||||
|
||||
*Please identify the environment in which your issue occurred.*
|
||||
|
||||
1. **BeEF Version:**
|
||||
|
||||
2. **Ruby Version:**
|
||||
|
||||
3. **Browser Details (e.g. Chrome v81.0):**
|
||||
|
||||
4. **Operating System (e.g. OSX Catalina):**
|
||||
## First Steps
|
||||
|
||||
1. Confirm that your issue has not been posted previously by searching here: https://github.com/beefproject/beef/issues
|
||||
2. Confirm that the wiki does not contain the answers you seek: https://github.com/beefproject/beef/wiki
|
||||
3. Check the FAQ: https://github.com/beefproject/beef/wiki/FAQ
|
||||
4. BeEF Version:
|
||||
5. Ruby Version:
|
||||
6. Browser Details (e.g. Chrome v81.0):
|
||||
7. Operating System (e.g. OSX Catalina):
|
||||
|
||||
## Configuration
|
||||
|
||||
**Q:** Have you made any changes to your BeEF configuration?
|
||||
**A:**
|
||||
|
||||
**Q:** Have you enabled or disabled any BeEF extensions?
|
||||
**A:**
|
||||
|
||||
## Expected vs. Actual Behaviour
|
||||
|
||||
**Expected Behaviour:**
|
||||
<br />
|
||||
**Actual Behaviour:**
|
||||
<br />
|
||||
1. Have you made any changes to your BeEF configuration? Yes/No
|
||||
2. Have you enabled or disabled any BeEF extensions? Yes/No
|
||||
|
||||
## Steps to Reproduce
|
||||
|
||||
*Please provide steps to reproduce this issue.*
|
||||
1. (eg. I ran install script, which ran fine)
|
||||
2. (eg. when launching console with './beef' I get an error as follows: <error here>)
|
||||
3. (eg. beef does not launch)
|
||||
|
||||
1.
|
||||
## How to enable and capture detailed logging
|
||||
|
||||
1. Edit `config.yaml` in the root directory
|
||||
* If using Kali **beef-xss** the root dir will be `/usr/share/beef-xss`
|
||||
2. Update `client_debug` to `true`
|
||||
3. Retrieve browser logs from your browser's developer console (Ctrl + Shift + I or F12 depending on browser)
|
||||
4. Retrieve your server-side logs from `~/.beef/beef.log`
|
||||
* If using **beef-xss** logs found with `journalctl -u beef-xss`
|
||||
|
||||
## Additional Information
|
||||
|
||||
Please provide any additional information which may be useful in resolving this issue, such as debugging output and relevant screen shots. Debug output can be retrieved by following the instructions towards the top of the issue template.
|
||||
**If we request additional information and we don't hear back from you within a week, we will be closing the ticket off.**
|
||||
|
||||
72
.github/workflows/codeql.yml
vendored
Normal file
72
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '36 1 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript', 'ruby' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
queries: security-extended,security-and-quality
|
||||
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
# - name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
59
.github/workflows/github_actions.yml
vendored
Normal file
59
.github/workflows/github_actions.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: 'BrowserStack Test'
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
approve:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Approve
|
||||
run: echo For security reasons, all pull requests need to be approved first before running any automated CI.
|
||||
|
||||
ubuntu-job:
|
||||
name: 'BrowserStack Test on Ubuntu'
|
||||
runs-on: ubuntu-latest # Can be self-hosted runner also
|
||||
environment:
|
||||
name: Integrate Pull Request
|
||||
env:
|
||||
GITACTIONS: true
|
||||
steps:
|
||||
|
||||
- name: 'BrowserStack Env Setup' # Invokes the setup-env action
|
||||
uses: browserstack/github-actions/setup-env@master
|
||||
with:
|
||||
username: ${{ secrets.BROWSERSTACK_USERNAME }}
|
||||
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
||||
|
||||
- name: 'BrowserStack Local Tunnel Setup' # Invokes the setup-local action
|
||||
uses: browserstack/github-actions/setup-local@master
|
||||
with:
|
||||
local-testing: start
|
||||
local-identifier: random
|
||||
|
||||
- name: 'Checkout the repository'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 2
|
||||
|
||||
- name: 'Setting up Ruby'
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.0.3 # Not needed with a .ruby-version file
|
||||
|
||||
- name: 'Build and run tests'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libcurl4 libcurl4-openssl-dev
|
||||
bundle config unset --local without
|
||||
bundle config set --local with 'test' 'development'
|
||||
bundle install
|
||||
bundle exec rake browserstack --trace
|
||||
|
||||
- name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection
|
||||
uses: browserstack/github-actions/setup-local@master
|
||||
with:
|
||||
local-testing: stop
|
||||
35
.github/workflows/stale.yml
vendored
Normal file
35
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
# https://github.com/actions/stale
|
||||
name: Mark stale issues and pull requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '5 * * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 7
|
||||
days-before-pr-stale: 14
|
||||
days-before-close: 7
|
||||
days-before-pr-close: 14
|
||||
stale-issue-message: 'This issue as been marked as stale due to inactivity and will be closed in 7 days'
|
||||
stale-pr-message: 'Stale pull request message'
|
||||
stale-issue-label: 'Stale'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
exempt-issue-labels: 'Critical, High, Low, Medium, Review, Backlog'
|
||||
exempt-milestones: true
|
||||
exempt-draft-pr: true
|
||||
start-date: '2022-06-15'
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,7 +9,6 @@ custom-config.yaml
|
||||
.rvmrc
|
||||
beef.log
|
||||
|
||||
*.lock
|
||||
|
||||
extensions/metasploit/msf-exploits.cache
|
||||
|
||||
|
||||
54
.rubocop.yml
54
.rubocop.yml
@@ -4,7 +4,8 @@ AllCops:
|
||||
- 'tmp/**/*'
|
||||
- 'tools/**/*'
|
||||
- 'doc/**/*'
|
||||
TargetRubyVersion: 2.6
|
||||
TargetRubyVersion: 3.0
|
||||
NewCops: enable
|
||||
|
||||
Layout/LineLength:
|
||||
Enabled: true
|
||||
@@ -22,57 +23,20 @@ Metrics/ClassLength:
|
||||
Metrics/MethodLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/PerceivedComplexity:
|
||||
Enabled: false
|
||||
|
||||
Metrics/CyclomaticComplexity:
|
||||
Enabled: false
|
||||
|
||||
Naming/ClassAndModuleCamelCase:
|
||||
Enabled: false
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
# TODO: review these
|
||||
Layout/SpaceBeforeBrackets:
|
||||
Enabled: false
|
||||
Lint/AmbiguousAssignment:
|
||||
Enabled: false
|
||||
Lint/DeprecatedConstants:
|
||||
Enabled: false
|
||||
Lint/DuplicateBranch:
|
||||
Enabled: false
|
||||
Lint/DuplicateRegexpCharacterClassElement:
|
||||
Enabled: false
|
||||
Lint/EmptyBlock:
|
||||
Enabled: false
|
||||
Lint/EmptyClass:
|
||||
Enabled: false
|
||||
Lint/LambdaWithoutLiteralBlock:
|
||||
Enabled: false
|
||||
Lint/NoReturnInBeginEndBlocks:
|
||||
Enabled: false
|
||||
Lint/RedundantDirGlobSort:
|
||||
Enabled: false
|
||||
Lint/ToEnumArguments:
|
||||
Enabled: false
|
||||
Lint/UnexpectedBlockArity:
|
||||
Enabled: false
|
||||
Lint/UnmodifiedReduceAccumulator:
|
||||
Enabled: false
|
||||
Style/ArgumentsForwarding:
|
||||
Enabled: false
|
||||
Style/CollectionCompact:
|
||||
Enabled: false
|
||||
Style/DocumentDynamicEvalDefinition:
|
||||
Enabled: false
|
||||
Style/EndlessMethod:
|
||||
Enabled: false
|
||||
Style/HashExcept:
|
||||
Enabled: false
|
||||
Style/NegatedIfElseCondition:
|
||||
Enabled: false
|
||||
Style/NilLambda:
|
||||
Enabled: false
|
||||
Style/RedundantArgument:
|
||||
Enabled: false
|
||||
Style/SwapValues:
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.7.2
|
||||
3.0.3
|
||||
|
||||
99
.travis.yml
99
.travis.yml
@@ -1,99 +0,0 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.5.3
|
||||
- 2.6.0
|
||||
- 2.6.3
|
||||
- 2.6.5
|
||||
- 2.7.0
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- wade@bindshell.net
|
||||
on_success: always
|
||||
on_failure: always
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- browserstack
|
||||
before_script:
|
||||
- RUBY_VERSION=/bin/bash rvm current
|
||||
- sed -i -E 's/system\((.*?)\)/""/g' /home/travis/.rvm/gems/$RUBY_VERSION/gems/browserstack-local-1.3.0/lib/browserstack/local.rb
|
||||
env:
|
||||
- CONFIG_FILE=osx/catalina/catalina_chrome_41.config.yml
|
||||
- CONFIG_FILE=osx/catalina/catalina_chrome_59.config.yml
|
||||
- CONFIG_FILE=osx/catalina/catalina_chrome_81.config.yml
|
||||
- CONFIG_FILE=osx/catalina/catalina_firefox_11.config.yml
|
||||
- CONFIG_FILE=osx/catalina/catalina_firefox_68esr.config.yml
|
||||
- CONFIG_FILE=osx/catalina/catalina_firefox_75.config.yml
|
||||
- CONFIG_FILE=osx/catalina/catalina_safari_13.config.yml
|
||||
- CONFIG_FILE=osx/elcapitan/elcapitan_chrome_14.config.yml
|
||||
- CONFIG_FILE=osx/elcapitan/elcapitan_chrome_81.config.yml
|
||||
- CONFIG_FILE=osx/elcapitan/elcapitan_firefox_7.config.yml
|
||||
- CONFIG_FILE=osx/elcapitan/elcapitan_firefox_75.config.yml
|
||||
- CONFIG_FILE=osx/elcapitan/elcapitan_safari_9-1.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_chrome_14.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_chrome_35.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_chrome_49.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_firefox_7.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_firefox_38esr.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_firefox_42.config.yml
|
||||
- CONFIG_FILE=osx/snowleopard/snowleopard_safari_5-1.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_chrome_37.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_chrome_59.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_firefox_32.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_firefox_68esr.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_firefox_75.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_edge_81.config.yml
|
||||
- CONFIG_FILE=windows/win10/win10_ie_11.config.yml
|
||||
- CONFIG_FILE=windows/win8/win8_chrome_22.config.yml
|
||||
- CONFIG_FILE=windows/win8/win8_chrome_81.config.yml
|
||||
- CONFIG_FILE=windows/win8/win8_firefox_32.config.yml
|
||||
- CONFIG_FILE=windows/win8/win8_firefox_75.config.yml
|
||||
- CONFIG_FILE=windows/win8/win8_edge_81.config.yml
|
||||
- CONFIG_FILE=windows/win8/win8_ie_10.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_chrome_14.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_chrome_28.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_chrome_43.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_firefox_16.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_firefox_26.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_firefox_45.config.yml
|
||||
- CONFIG_FILE=windows/xp/xp_ie_7.config.yml
|
||||
jobs:
|
||||
include:
|
||||
- name: "Full Test Suite 2.5.3"
|
||||
rvm: 2.5.3
|
||||
env: CONFIG_FILE=windows/win10/win10_chrome_81.config.yml
|
||||
script: bundle exec rspec
|
||||
- name: "Full Test Suite 2.6.0"
|
||||
rvm: 2.6.0
|
||||
env: CONFIG_FILE=windows/win10/win10_chrome_81.config.yml
|
||||
script: bundle exec rspec
|
||||
- name: "Full Test Suite 2.6.3"
|
||||
rvm: 2.6.3
|
||||
env: CONFIG_FILE=windows/win10/win10_chrome_81.config.yml
|
||||
script: bundle exec rspec
|
||||
- name: "Full Test Suite 2.6.5"
|
||||
rvm: 2.6.5
|
||||
env: CONFIG_FILE=windows/win10/win10_chrome_81.config.yml
|
||||
script: bundle exec rspec
|
||||
- name: "Full Test Suite 2.7.0"
|
||||
rvm: 2.7.0
|
||||
env: CONFIG_FILE=windows/win10/win10_chrome_81.config.yml
|
||||
script: bundle exec rspec
|
||||
script:
|
||||
- bundle exec rspec --tag run_on_browserstack
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsqlite3-dev
|
||||
- build-essential
|
||||
- patch
|
||||
- ruby-dev
|
||||
- zlib1g-dev
|
||||
- liblzma-dev
|
||||
- libcurl4-openssl-dev
|
||||
browserstack:
|
||||
username:
|
||||
secure: "Yj+a2jY56dFqJwXdU6JdSXeKhhS01CiToBoB922SXVnA2D2WclGOFiTi0YrkAS9PuOJX5AjC9eUw7VFUcp8DiLmeDGLWo8klYrWQoJOH55FmSWKjdkqDopJFYr0ZXk/ZuXzzpuMvKkCT5MGFnySXyheTW8aUj33GetJ6/sNq5BoA36jH04OE3iPgdBaFPRNDVXEIWLaLUDQsAyZsHNNYC+/cj3cxjXLHu+mbNuXsXEHgrHJ2A94EWdrdGODWL8mRtlSDNkIaYHZKCBnUlHWwCwBitLsjhzdy0YFrIGVbX96FV+C41sjPWLFjZhjAaNDuJ3FoTplbzFNvrw5oxQAAI8ZZqUwF4MRIrQbN8BLFVISX7JooQjfyrNVWvhpZWGPB4GZTN4CThrlQ7G7CJRYDVyqZ7nen6y0+osBr9DRKN+EemlVG73aNP3mXaZr6BmS1BpQJ6tlqDdLCvC5j/PdguKwvt4EmgHA8Pzn20UElV+8BPblcYGjsWplk/cxW1adW0pu2vIxskKxDKJ/ReY3l5yUpiQPZHbuMidq2ffSX0B3yALe7vx+3AvMb2Fk9yWh52EVJXPkVlLvhP7wDd22MHCemvrC2nLhkVR4MglLWs7dZKHswExlKJdWK4OSXprOStjZSA47sjF2nPdztWTpdI77SKaBcoLGR5WOV+JtcQgk="
|
||||
access_key:
|
||||
secure: "KHlR8NHPnoF9U1CJKgUhS1YhPSeTILI2lIu+JilQ5Xeo7rcbWg9lT2xwQQNnLYrISG1vC6OzsbkcnC/3ZnAv7jYff4iUTc3Syszs5wIhhvnhBx4qCxM+/UD78TJNQ0AuY7NOIK6OXcmwbpZrOBUojZkooEkc8bpG56nb2v7dOIafFLV+tv9xcc5DtMSfh7FavhqRFRO+PCybqOW8yWMc2NiMYy3p9jKBC3qYRqme4hx1NRrLo5BZQ+UIcO3Rf+vAjUP+3gGuhWeu2kDCvZYDnI2GN1/WacRVY2cqDPGiYlD6pHNMqU0raYKyWdK0QD4KwYpfjxBGRmwBfz8xU8KWUEZ3P11mJn+BvIt0qe3VpomR0/60/fok1BEso3nea8oENXur5G/5SOfpkPLjzd4P4f7JYnST1PeeWwpzV305wktDv9aLc+Ne9cFCaxSaaCnOk82rKDhtnktwnK7krFj1lM6oygtOD+arAytPKaURRgV2izaoophiXuLFb+9XKSkMGtJ3e+rQATonnDPaFTzouKaXSEPxZQQ2bnsp9tETAReDrYIwPHuYL778UbbBICgNk54CZSfTeRFLroRGNPb/0gPXbu6SryPnknfCMNd7ksSndVoyKsDo1plTHQJGVweP2hxR3R/9syk9Z6DU6H5H3dc/RbkkmoRPVooUtR/mZ/c="
|
||||
15
Dockerfile
15
Dockerfile
@@ -10,7 +10,7 @@
|
||||
###########################################################################################################
|
||||
|
||||
# ---------------------------- Start of Builder 0 - Gemset Build ------------------------------------------
|
||||
FROM ruby:2.6.3-alpine AS builder
|
||||
FROM ruby:2.7.5-alpine AS builder
|
||||
LABEL maintainer="Beef Project: github.com/beefproject/beef"
|
||||
|
||||
# Install gems in parallel with 4 workers to expedite build process.=
|
||||
@@ -23,7 +23,7 @@ COPY . /beef
|
||||
|
||||
# Add bundler/gem dependencies and then install
|
||||
RUN apk add --no-cache git curl libcurl curl-dev ruby-dev libffi-dev make g++ gcc musl-dev zlib-dev sqlite-dev && \
|
||||
bundle install --system --clean --no-cache --gemfile=/beef/Gemfile $BUNDLER_ARGS && \
|
||||
bundle install --gemfile=/beef/Gemfile $BUNDLER_ARGS && \
|
||||
# Temp fix for https://github.com/bundler/bundler/issues/6680
|
||||
rm -rf /usr/local/bundle/cache
|
||||
|
||||
@@ -35,22 +35,19 @@ RUN chmod -R a+r /usr/local/bundle
|
||||
|
||||
|
||||
# ---------------------------- Start of Builder 1 - Final Build ------------------------------------------
|
||||
FROM ruby:2.6.3-alpine
|
||||
FROM ruby:2.7.5-alpine
|
||||
LABEL maintainer="Beef Project: github.com/beefproject/beef"
|
||||
|
||||
# Create service account to run BeEF
|
||||
RUN adduser -h /beef -g beef -D beef
|
||||
|
||||
COPY . /beef
|
||||
COPY --chown=1000:1000 . /beef
|
||||
|
||||
# Use gemset created by the builder above
|
||||
COPY --from=builder /usr/local/bundle /usr/local/bundle
|
||||
|
||||
# Grant beef service account owner and groups rights over our BeEF working directory.
|
||||
RUN chown -R beef:beef /beef
|
||||
|
||||
# Install BeEF's runtime dependencies
|
||||
RUN apk add --no-cache curl git build-base openssl readline-dev zlib zlib-dev libressl-dev yaml-dev sqlite-dev sqlite libxml2-dev libxslt-dev autoconf libc6-compat ncurses5 automake libtool bison nodejs
|
||||
RUN apk add --no-cache curl git build-base openssl readline-dev zlib zlib-dev libressl-dev yaml-dev sqlite-dev sqlite libxml2-dev libxslt-dev autoconf libc6-compat ncurses automake libtool bison nodejs
|
||||
|
||||
WORKDIR /beef
|
||||
|
||||
@@ -60,5 +57,7 @@ USER beef
|
||||
# Expose UI, Proxy, WebSocket server, and WebSocketSecure server
|
||||
EXPOSE 3000 6789 61985 61986
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "curl", "-fS", "localhost:3000" ]
|
||||
|
||||
ENTRYPOINT ["/beef/beef"]
|
||||
# ------------------------------------- End of Builder 1 -------------------------------------------------
|
||||
35
Gemfile
35
Gemfile
@@ -1,18 +1,19 @@
|
||||
# BeEF's Gemfile
|
||||
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
#gem 'simplecov', require: false, group: :test
|
||||
|
||||
gem 'net-smtp', require: false
|
||||
|
||||
gem 'eventmachine'
|
||||
gem 'thin'
|
||||
gem 'sinatra', '>= 2.0.2'
|
||||
gem 'rack', '>= 2.2.3'
|
||||
gem 'rack-protection', '>= 2.0.0'
|
||||
gem 'sinatra', '>= 2.2.0'
|
||||
gem 'rack', '>= 2.2.4'
|
||||
gem 'rack-protection', '>= 2.2.0'
|
||||
gem 'em-websocket' # WebSocket support
|
||||
gem 'uglifier', '>= 2.7.2'
|
||||
gem 'uglifier', '>= 4.2.0'
|
||||
gem 'mime-types'
|
||||
gem 'execjs'
|
||||
gem 'ansi'
|
||||
@@ -20,11 +21,10 @@ gem 'term-ansicolor', :require => 'term/ansicolor'
|
||||
gem 'json'
|
||||
gem 'rubyzip', '>= 1.2.2'
|
||||
gem 'espeak-ruby', '>= 1.0.4' # Text-to-Voice
|
||||
gem 'nokogiri', '>= 1.11.1'
|
||||
gem 'rake', '>= 12.3.3'
|
||||
gem 'rake', '>= 13.0'
|
||||
gem 'otr-activerecord', '>= 1.4.2'
|
||||
gem 'sqlite3'
|
||||
gem 'rubocop', '~> 0.92.0', require: false
|
||||
gem 'rubocop', '~> 1.36.0', require: false
|
||||
|
||||
# Geolocation support
|
||||
group :geoip do
|
||||
@@ -42,12 +42,14 @@ end
|
||||
|
||||
# Notifications extension
|
||||
group :ext_notifications do
|
||||
gem 'unf'
|
||||
gem 'domain_name', '>= 0.5.20190701'
|
||||
# Pushover
|
||||
gem 'rushover'
|
||||
# Slack
|
||||
gem 'slack-notifier'
|
||||
# Twitter
|
||||
gem 'twitter', '>= 5.0.0'
|
||||
gem 'twitter', '>= 7.0.0'
|
||||
end
|
||||
|
||||
# DNS extension
|
||||
@@ -78,16 +80,11 @@ group :test do
|
||||
# sudo port install libxml2 libxslt
|
||||
gem 'capybara'
|
||||
# RESTful API tests/generic command module tests
|
||||
gem 'rest-client', '>= 2.0.1'
|
||||
gem 'rest-client', '>= 2.1.0'
|
||||
gem 'irb'
|
||||
gem 'pry-byebug'
|
||||
gem "websocket-client-simple", "~> 0.3.0"
|
||||
gem "browserstack-local", "~> 1.3"
|
||||
gem "websocket-client-simple", "~> 0.6.0"
|
||||
gem "browserstack-local", "~> 1.4"
|
||||
end
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
312
Gemfile.lock
Normal file
312
Gemfile.lock
Normal file
@@ -0,0 +1,312 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activemodel (7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
activerecord (7.0.3.1)
|
||||
activemodel (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
activesupport (7.0.3.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ansi (1.5.0)
|
||||
archive-zip (0.12.0)
|
||||
io-like (~> 0.3.0)
|
||||
ast (2.4.2)
|
||||
async (1.30.3)
|
||||
console (~> 1.10)
|
||||
nio4r (~> 2.3)
|
||||
timers (~> 4.1)
|
||||
async-dns (1.3.0)
|
||||
async-io (~> 1.15)
|
||||
async-io (1.33.0)
|
||||
async
|
||||
browserstack-local (1.4.0)
|
||||
buftok (0.2.0)
|
||||
byebug (11.1.3)
|
||||
capybara (3.37.1)
|
||||
addressable
|
||||
matrix
|
||||
mini_mime (>= 0.1.3)
|
||||
nokogiri (~> 1.8)
|
||||
rack (>= 1.6.0)
|
||||
rack-test (>= 0.6.3)
|
||||
regexp_parser (>= 1.5, < 3.0)
|
||||
xpath (~> 3.2)
|
||||
childprocess (4.1.0)
|
||||
coderay (1.1.3)
|
||||
concurrent-ruby (1.1.10)
|
||||
console (1.15.3)
|
||||
fiber-local
|
||||
curb (1.0.1)
|
||||
daemons (1.4.1)
|
||||
diff-lcs (1.5.0)
|
||||
digest (3.1.0)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
equalizer (0.0.11)
|
||||
erubis (2.7.0)
|
||||
espeak-ruby (1.1.0)
|
||||
event_emitter (0.2.6)
|
||||
eventmachine (1.2.7)
|
||||
execjs (2.8.1)
|
||||
ffi (1.15.5)
|
||||
ffi-compiler (1.0.1)
|
||||
ffi (>= 1.0.0)
|
||||
rake
|
||||
fiber-local (1.0.0)
|
||||
geckodriver-helper (0.24.0)
|
||||
archive-zip (~> 0.7)
|
||||
hashie (5.0.0)
|
||||
hashie-forbidden_attributes (0.1.1)
|
||||
hashie (>= 3.0)
|
||||
http (4.4.1)
|
||||
addressable (~> 2.3)
|
||||
http-cookie (~> 1.0)
|
||||
http-form_data (~> 2.2)
|
||||
http-parser (~> 1.2.0)
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.5)
|
||||
domain_name (~> 0.5)
|
||||
http-form_data (2.3.0)
|
||||
http-parser (1.2.3)
|
||||
ffi-compiler (>= 1.0, < 2.0)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.12.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
io-console (0.5.11)
|
||||
io-like (0.3.1)
|
||||
irb (1.4.1)
|
||||
reline (>= 0.3.0)
|
||||
json (2.6.2)
|
||||
matrix (0.4.2)
|
||||
maxmind-db (1.1.1)
|
||||
memoizable (0.4.2)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
method_source (1.0.0)
|
||||
mime-types (3.4.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2022.0105)
|
||||
mini_mime (1.1.2)
|
||||
minitest (5.16.2)
|
||||
mojo_magick (0.6.7)
|
||||
msfrpc-client (1.1.2)
|
||||
msgpack (~> 1)
|
||||
msgpack (1.5.4)
|
||||
multipart-post (2.2.3)
|
||||
mustermann (2.0.2)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
naught (1.1.0)
|
||||
net-protocol (0.1.3)
|
||||
timeout
|
||||
net-smtp (0.3.1)
|
||||
digest
|
||||
net-protocol
|
||||
timeout
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.13.8-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
otr-activerecord (2.1.1)
|
||||
activerecord (>= 4.0, < 7.1)
|
||||
hashie-forbidden_attributes (~> 0.1)
|
||||
parallel (1.22.1)
|
||||
parseconfig (1.1.2)
|
||||
parser (3.1.2.1)
|
||||
ast (~> 2.4.1)
|
||||
power_assert (2.0.1)
|
||||
pry (0.14.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
pry-byebug (3.10.1)
|
||||
byebug (~> 11.0)
|
||||
pry (>= 0.13, < 0.15)
|
||||
psych (4.0.4)
|
||||
stringio
|
||||
public_suffix (4.0.7)
|
||||
qr4r (0.6.1)
|
||||
mojo_magick (~> 0.6.5)
|
||||
rqrcode_core (~> 0.1)
|
||||
racc (1.6.0)
|
||||
rack (2.2.4)
|
||||
rack-protection (2.2.2)
|
||||
rack
|
||||
rack-test (2.0.2)
|
||||
rack (>= 1.3)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
rdoc (6.4.0)
|
||||
psych (>= 4.0.0)
|
||||
regexp_parser (2.5.0)
|
||||
reline (0.3.1)
|
||||
io-console (~> 0.5)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rexml (3.2.5)
|
||||
rqrcode_core (0.2.0)
|
||||
rr (3.1.0)
|
||||
rspec (3.11.0)
|
||||
rspec-core (~> 3.11.0)
|
||||
rspec-expectations (~> 3.11.0)
|
||||
rspec-mocks (~> 3.11.0)
|
||||
rspec-core (3.11.0)
|
||||
rspec-support (~> 3.11.0)
|
||||
rspec-expectations (3.11.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.11.0)
|
||||
rspec-mocks (3.11.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.11.0)
|
||||
rspec-support (3.11.0)
|
||||
rubocop (1.36.0)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.1.2.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.20.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.21.0)
|
||||
parser (>= 3.1.1.0)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
rushover (0.3.0)
|
||||
json
|
||||
rest-client
|
||||
selenium-webdriver (4.4.0)
|
||||
childprocess (>= 0.5, < 5.0)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
websocket (~> 1.0)
|
||||
simple_oauth (0.3.1)
|
||||
sinatra (2.2.2)
|
||||
mustermann (~> 2.0)
|
||||
rack (~> 2.2)
|
||||
rack-protection (= 2.2.2)
|
||||
tilt (~> 2.0)
|
||||
slack-notifier (2.4.0)
|
||||
sqlite3 (1.5.2-x86_64-linux)
|
||||
stringio (3.0.2)
|
||||
sync (0.5.0)
|
||||
term-ansicolor (1.7.1)
|
||||
tins (~> 1.0)
|
||||
test-unit (3.5.3)
|
||||
power_assert
|
||||
test-unit-context (0.5.1)
|
||||
test-unit (>= 2.4.0)
|
||||
test-unit-full (0.0.5)
|
||||
test-unit
|
||||
test-unit-context
|
||||
test-unit-notify
|
||||
test-unit-rr
|
||||
test-unit-runner-tap
|
||||
test-unit-notify (1.0.4)
|
||||
test-unit (>= 2.4.9)
|
||||
test-unit-rr (1.0.5)
|
||||
rr (>= 1.1.1)
|
||||
test-unit (>= 2.5.2)
|
||||
test-unit-runner-tap (1.1.2)
|
||||
test-unit
|
||||
thin (1.8.1)
|
||||
daemons (~> 1.0, >= 1.0.9)
|
||||
eventmachine (~> 1.0, >= 1.0.4)
|
||||
rack (>= 1, < 3)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.11)
|
||||
timeout (0.3.0)
|
||||
timers (4.3.3)
|
||||
tins (1.31.1)
|
||||
sync
|
||||
twitter (7.0.0)
|
||||
addressable (~> 2.3)
|
||||
buftok (~> 0.2.0)
|
||||
equalizer (~> 0.0.11)
|
||||
http (~> 4.0)
|
||||
http-form_data (~> 2.0)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
memoizable (~> 0.4.0)
|
||||
multipart-post (~> 2.0)
|
||||
naught (~> 1.0)
|
||||
simple_oauth (~> 0.3.0)
|
||||
tzinfo (2.0.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.8.2)
|
||||
unicode-display_width (2.2.0)
|
||||
webrick (1.7.0)
|
||||
websocket (1.2.9)
|
||||
websocket-client-simple (0.6.0)
|
||||
event_emitter
|
||||
websocket
|
||||
xmlrpc (0.3.2)
|
||||
webrick
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
ansi
|
||||
async-dns
|
||||
browserstack-local (~> 1.4)
|
||||
capybara
|
||||
curb
|
||||
domain_name (>= 0.5.20190701)
|
||||
em-websocket
|
||||
erubis
|
||||
espeak-ruby (>= 1.0.4)
|
||||
eventmachine
|
||||
execjs
|
||||
geckodriver-helper
|
||||
irb
|
||||
json
|
||||
maxmind-db
|
||||
mime-types
|
||||
msfrpc-client
|
||||
net-smtp
|
||||
otr-activerecord (>= 1.4.2)
|
||||
parseconfig
|
||||
pry-byebug
|
||||
qr4r
|
||||
rack (>= 2.2.4)
|
||||
rack-protection (>= 2.2.0)
|
||||
rake (>= 13.0)
|
||||
rdoc
|
||||
rest-client (>= 2.1.0)
|
||||
rspec
|
||||
rubocop (~> 1.36.0)
|
||||
rubyzip (>= 1.2.2)
|
||||
rushover
|
||||
selenium-webdriver
|
||||
sinatra (>= 2.2.0)
|
||||
slack-notifier
|
||||
sqlite3
|
||||
term-ansicolor
|
||||
test-unit
|
||||
test-unit-full
|
||||
thin
|
||||
twitter (>= 7.0.0)
|
||||
uglifier (>= 4.2.0)
|
||||
unf
|
||||
websocket-client-simple (~> 0.6.0)
|
||||
xmlrpc
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.14
|
||||
12
INSTALL.txt
12
INSTALL.txt
@@ -1,6 +1,6 @@
|
||||
===============================================================================
|
||||
|
||||
Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
|
||||
@@ -21,9 +21,9 @@ Or cloning the Git repository from Github:
|
||||
Prerequisites
|
||||
--------------
|
||||
|
||||
BeEF requires Ruby 2.5+.
|
||||
BeEF requires Ruby 2.7+.
|
||||
|
||||
If your operating system package manager does not support Ruby version 2.5,
|
||||
If your operating system package manager does not support Ruby version 2.7,
|
||||
you can add the brightbox ppa repository for the latest version of Ruby:
|
||||
|
||||
$ sudo apt-add-repository -y ppa:brightbox/ruby-ng
|
||||
@@ -67,5 +67,11 @@ it's best to regularly update BeEF to the latest version.
|
||||
|
||||
If you're using BeEF from the GitHub repository, updating is as simple as:
|
||||
|
||||
$ ./update-beef
|
||||
|
||||
Or pull the latest repo yourself and then update the gems with:
|
||||
|
||||
$ git pull
|
||||
|
||||
$ bundle
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
===============================================================================
|
||||
|
||||
Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
|
||||
@@ -30,12 +30,13 @@ __Security Bugs:__ security@beefproject.com
|
||||
|
||||
__Twitter:__ [@beefproject](https://twitter.com/beefproject)
|
||||
|
||||
__Discord:__ https://discord.gg/ugmKmHarKc
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* Operating System: Mac OSX 10.5.0 or higher / modern Linux. Note: Windows is not supported.
|
||||
* [Ruby](http://ruby-lang.org): 2.5 or newer
|
||||
* [Ruby](https://www.ruby-lang.org): 2.7 or newer
|
||||
* [SQLite](http://sqlite.org): 3.x
|
||||
* [Node.js](https://nodejs.org): 10 or newer
|
||||
* The gems listed in the Gemfile: https://github.com/beefproject/beef/blob/master/Gemfile
|
||||
|
||||
18
Rakefile
18
Rakefile
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -23,6 +23,22 @@ RSpec::Core::RakeTask.new(:spec) do |task|
|
||||
task.rspec_opts = ['--tag ~run_on_browserstack']
|
||||
end
|
||||
|
||||
RSpec::Core::RakeTask.new(:browserstack) do |task|
|
||||
task.rspec_opts = ['--tag run_on_browserstack']
|
||||
end
|
||||
|
||||
RSpec::Core::RakeTask.new(:bs) do |task|
|
||||
configs = Dir["spec/support/browserstack/**/*.yml"]
|
||||
configs.each do |config|
|
||||
config = config.split('spec/support/browserstack')[1]
|
||||
ENV['CONFIG_FILE'] = config
|
||||
puts "\e[45m#{config.upcase}\e[0m"
|
||||
task.rspec_opts = ['--tag run_on_browserstack']
|
||||
Rake::Task['browserstack'].invoke
|
||||
Rake::Task['browserstack'].reenable
|
||||
end
|
||||
end
|
||||
|
||||
################################
|
||||
# SSL/TLS certificate
|
||||
|
||||
|
||||
4
VERSION
4
VERSION
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
0.5.1.0
|
||||
0.5.4.0
|
||||
|
||||
60
beef
60
beef
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -12,11 +12,12 @@
|
||||
$VERBOSE = nil
|
||||
|
||||
#
|
||||
# @note Version check to ensure BeEF is running Ruby 2.5+
|
||||
# @note Version check to ensure BeEF is running Ruby 2.7+
|
||||
#
|
||||
if RUBY_VERSION < '2.5'
|
||||
min_ruby_version = '2.7'
|
||||
if RUBY_VERSION < min_ruby_version
|
||||
puts
|
||||
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version 2.5 or later."
|
||||
puts "Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to Ruby version #{min_ruby_version} or later."
|
||||
puts
|
||||
exit 1
|
||||
end
|
||||
@@ -42,6 +43,28 @@ $home_dir = File.expand_path("#{Dir.home}/.beef/", __FILE__).freeze
|
||||
# @note Require core loader
|
||||
#
|
||||
require 'core/loader'
|
||||
require 'timeout'
|
||||
|
||||
#
|
||||
# @note Ask user if they would like to update beef
|
||||
#
|
||||
if File.exist?("#{$root_dir}git") && BeEF::Core::Console::CommandLine.parse[:update_disabled] == false
|
||||
if BeEF::Core::Console::CommandLine.parse[:update_auto] == true
|
||||
print 'Checking latest BeEF repository and updating'
|
||||
`git pull && bundle`
|
||||
elsif `git rev-parse master` != `git rev-parse origin/master`
|
||||
begin
|
||||
Timeout.timeout(5) do
|
||||
puts '-- BeEF Update Available --'
|
||||
print 'Would you like to update to lastest version? y/n: '
|
||||
response = gets
|
||||
`git pull && bundle` if response&.strip == 'y'
|
||||
end
|
||||
rescue Timeout::Error
|
||||
puts "\nUpdate Skipped with input timeout"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# @note Create ~/.beef/
|
||||
@@ -109,13 +132,13 @@ end
|
||||
#
|
||||
# @note Validate beef.http.public and beef.http.public_port
|
||||
#
|
||||
unless config.get('beef.http.public').to_s.eql?('') || BeEF::Filters.is_valid_hostname?(config.get('beef.http.public'))
|
||||
print_error "ERROR: Invalid public hostname: #{config.get('beef.http.public')}"
|
||||
unless config.get('beef.http.public.host').to_s.eql?('') || BeEF::Filters.is_valid_hostname?(config.get('beef.http.public.host'))
|
||||
print_error "ERROR: Invalid public hostname: #{config.get('beef.http.public.host')}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
unless config.get('beef.http.public_port').to_s.eql?('') || BeEF::Filters.is_valid_port?(config.get('beef.http.public_port'))
|
||||
print_error "ERROR: Invalid public port: #{config.get('beef.http.public_port')}"
|
||||
unless config.get('beef.http.public.port').to_s.eql?('') || BeEF::Filters.is_valid_port?(config.get('beef.http.public.port'))
|
||||
print_error "ERROR: Invalid public port: #{config.get('beef.http.public.port')}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
@@ -161,8 +184,14 @@ db_file = config.get('beef.database.file')
|
||||
# @note Resets the database if the -x flag was passed
|
||||
if BeEF::Core::Console::CommandLine.parse[:resetdb]
|
||||
print_info 'Resetting the database for BeEF.'
|
||||
begin
|
||||
File.delete(db_file) if File.exists?(db_file)
|
||||
rescue => e
|
||||
print_error("Could not remove '#{db_file}' database file: #{e.message}")
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
# Connect to DB
|
||||
ActiveRecord::Base.logger = nil
|
||||
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
||||
@@ -172,6 +201,7 @@ OTR::ActiveRecord.configure_from_hash!(adapter:'sqlite3', database:db_file)
|
||||
if Gem.loaded_specs['otr-activerecord'].version > Gem::Version.create('1.4.2')
|
||||
OTR::ActiveRecord.establish_connection!
|
||||
end
|
||||
|
||||
# Migrate (if required)
|
||||
context = ActiveRecord::Migration.new.migration_context
|
||||
if context.needs_migration?
|
||||
@@ -185,7 +215,12 @@ print_info 'BeEF is loading. Wait a few seconds...'
|
||||
#
|
||||
# @note Execute migration procedure, checks for new modules
|
||||
#
|
||||
BeEF::Core::Migration.instance.update_db!
|
||||
begin
|
||||
BeEF::Core::Migration.instance.update_db!
|
||||
rescue => e
|
||||
print_error("Could not update '#{db_file}' database file: #{e.message}")
|
||||
exit(1)
|
||||
end
|
||||
|
||||
#
|
||||
# @note Create HTTP Server and prepare it to run
|
||||
@@ -193,6 +228,13 @@ BeEF::Core::Migration.instance.update_db!
|
||||
http_hook_server = BeEF::Core::Server.instance
|
||||
http_hook_server.prepare
|
||||
|
||||
begin
|
||||
BeEF::Core::Logger.instance.register('System', 'BeEF server started')
|
||||
rescue => e
|
||||
print_error("Database connection failed: #{e.message}")
|
||||
exit(1)
|
||||
end
|
||||
|
||||
#
|
||||
# @note Prints information back to the user before running the server
|
||||
#
|
||||
|
||||
22
config.yaml
22
config.yaml
@@ -1,12 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 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.5.1.0'
|
||||
version: '0.5.4.0'
|
||||
# More verbose messages (server-side)
|
||||
debug: false
|
||||
# More verbose messages (client-side)
|
||||
@@ -47,8 +47,14 @@ beef:
|
||||
|
||||
# Host Name / Domain Name
|
||||
# If you want BeEF to be accessible via hostname or domain name (ie, DynDNS),
|
||||
# set the public hostname below:
|
||||
#public: "" # public hostname/IP address
|
||||
# These settings will be used to create a public facing URL
|
||||
# This public facing URL will be used for all hook related calls
|
||||
# set the public setting below:
|
||||
# public:
|
||||
# host: "" # public hostname/IP address
|
||||
# port: "" # public port will default to 80 if no https 443 if https
|
||||
# and local if not set but there is a public host
|
||||
# https: false # true/false
|
||||
|
||||
# Reverse Proxy / NAT
|
||||
# If you want BeEF to be accessible behind a reverse proxy or NAT,
|
||||
@@ -56,8 +62,6 @@ beef:
|
||||
# NOTE: Allowing the reverse proxy will enable a vulnerability where the ui/panel can be spoofed
|
||||
# by altering the X-FORWARDED-FOR ip address in the request header.
|
||||
allow_reverse_proxy: false
|
||||
#public: "" # public hostname/IP address
|
||||
#public_port: "" # public port (experimental)
|
||||
|
||||
# Hook
|
||||
hook_file: "/hook.js"
|
||||
@@ -89,6 +93,8 @@ beef:
|
||||
# Experimental HTTPS support for the hook / admin / all other Thin managed web services
|
||||
https:
|
||||
enable: false
|
||||
# Enabled this config setting if you're external facing uri is using https
|
||||
public_enabled: false
|
||||
# In production environments, be sure to use a valid certificate signed for the value
|
||||
# used in beef.http.public (the domain name of the server where you run BeEF)
|
||||
key: "beef_key.pem"
|
||||
@@ -114,10 +120,10 @@ beef:
|
||||
dns_hostname_lookup: false
|
||||
|
||||
# IP Geolocation
|
||||
# NOTE: requires MaxMind database. Run ./updated-geoipdb to install.
|
||||
geoip:
|
||||
enable: true
|
||||
database: '/opt/GeoIP/GeoLite2-City.mmdb'
|
||||
# GeoLite2 City database created by MaxMind, available from https://www.maxmind.com
|
||||
database: '/usr/share/GeoIP/GeoLite2-City.mmdb'
|
||||
|
||||
# Integration with PhishingFrenzy
|
||||
# If enabled BeEF will try to get the UID parameter value from the hooked URI, as this is used by PhishingFrenzy
|
||||
|
||||
83
core/api.rb
83
core/api.rb
@@ -1,12 +1,11 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
module BeEF
|
||||
module API
|
||||
|
||||
#
|
||||
# Registrar class to handle all registered timed API calls
|
||||
#
|
||||
@@ -24,18 +23,18 @@ module BeEF
|
||||
# Register timed API calls to an owner
|
||||
#
|
||||
# @param [Class] owner the owner of the API hook
|
||||
# @param [Class] c the API class the owner would like to hook into
|
||||
# @param [Class] clss the API class the owner would like to hook into
|
||||
# @param [String] method the method of the class the owner would like to execute
|
||||
# @param [Array] params an array of parameters that need to be matched before the owner will be called
|
||||
#
|
||||
def register(owner, c, method, params = [])
|
||||
unless verify_api_path(c, method)
|
||||
print_error "API Registrar: Attempted to register non-existant API method #{c} :#{method}"
|
||||
def register(owner, clss, method, params = [])
|
||||
unless verify_api_path(clss, method)
|
||||
print_error "API Registrar: Attempted to register non-existant API method #{clss} :#{method}"
|
||||
return
|
||||
end
|
||||
|
||||
if registered?(owner, c, method, params)
|
||||
print_debug "API Registrar: Attempting to re-register API call #{c} :#{method}"
|
||||
if registered?(owner, clss, method, params)
|
||||
print_debug "API Registrar: Attempting to re-register API call #{clss} :#{method}"
|
||||
return
|
||||
end
|
||||
|
||||
@@ -43,7 +42,7 @@ module BeEF
|
||||
@registry << {
|
||||
'id' => id,
|
||||
'owner' => owner,
|
||||
'class' => c,
|
||||
'class' => clss,
|
||||
'method' => method,
|
||||
'params' => params
|
||||
}
|
||||
@@ -56,18 +55,19 @@ module BeEF
|
||||
# Tests whether the owner is registered for an API hook
|
||||
#
|
||||
# @param [Class] owner the owner of the API hook
|
||||
# @param [Class] c the API class
|
||||
# @param [Class] clss the API class
|
||||
# @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
|
||||
#
|
||||
def registered?(owner, c, method, params = [])
|
||||
def registered?(owner, clss, method, params = [])
|
||||
@registry.each do |r|
|
||||
next unless r['owner'] == owner
|
||||
next unless r['class'] == c
|
||||
next unless r['class'] == clss
|
||||
next unless r['method'] == method
|
||||
next unless is_matched_params? r, params
|
||||
|
||||
return true
|
||||
end
|
||||
false
|
||||
@@ -76,17 +76,18 @@ module BeEF
|
||||
#
|
||||
# Match a timed API call to determine if an API.fire() is required
|
||||
#
|
||||
# @param [Class] c the target API class
|
||||
# @param [Class] clss the target API class
|
||||
# @param [String] method the method of the target API class
|
||||
# @param [Array] params an array of parameters that need to be matched
|
||||
#
|
||||
# @return [Boolean] whether or not the arguments match an entry in the API registry
|
||||
#
|
||||
def matched?(c, method, params = [])
|
||||
def matched?(clss, method, params = [])
|
||||
@registry.each do |r|
|
||||
next unless r['class'] == c
|
||||
next unless r['class'] == clss
|
||||
next unless r['method'] == method
|
||||
next unless is_matched_params? r, params
|
||||
|
||||
return true
|
||||
end
|
||||
false
|
||||
@@ -98,24 +99,25 @@ module BeEF
|
||||
# @param [Integer] id the ID of the API hook
|
||||
#
|
||||
def unregister(id)
|
||||
@registry.delete_if {|r| r['id'] == id }
|
||||
@registry.delete_if { |r| r['id'] == id }
|
||||
end
|
||||
|
||||
#
|
||||
# Retrieves all the owners and ID's of an API hook
|
||||
# @param [Class] c the target API class
|
||||
# @param [Class] clss the target API class
|
||||
# @param [String] method the method of the target API class
|
||||
# @param [Array] params an array of parameters that need to be matched
|
||||
#
|
||||
# @return [Array] an array of hashes consisting of two keys :owner and :id
|
||||
#
|
||||
def get_owners(c, method, params = [])
|
||||
def get_owners(clss, method, params = [])
|
||||
owners = []
|
||||
@registry.each do |r|
|
||||
next unless r['class'] == c
|
||||
next unless r['class'] == clss
|
||||
next unless r['method'] == method
|
||||
next unless is_matched_params? r, params
|
||||
owners << { :owner => r['owner'], :id => r['id'] }
|
||||
|
||||
owners << { owner: r['owner'], id: r['id'] }
|
||||
end
|
||||
owners
|
||||
end
|
||||
@@ -126,23 +128,23 @@ module BeEF
|
||||
#
|
||||
# @note This is a security precaution
|
||||
#
|
||||
# @param [Class] c the target API class to verify
|
||||
# @param [String] m the target method to verify
|
||||
# @param [Class] clss the target API class to verify
|
||||
# @param [String] mthd the target method to verify
|
||||
#
|
||||
def verify_api_path(c, m)
|
||||
(c.const_defined?('API_PATHS') && c.const_get('API_PATHS').key?(m))
|
||||
def verify_api_path(clss, mthd)
|
||||
(clss.const_defined?('API_PATHS') && clss.const_get('API_PATHS').key?(mthd))
|
||||
end
|
||||
|
||||
#
|
||||
# Retrieves the registered symbol reference for an API hook
|
||||
#
|
||||
# @param [Class] c the target API class to verify
|
||||
# @param [String] m the target method to verify
|
||||
# @param [Class] clss the target API class to verify
|
||||
# @param [String] mthd the target method to verify
|
||||
#
|
||||
# @return [Symbol] the API path
|
||||
#
|
||||
def get_api_path(c, m)
|
||||
verify_api_path(c, m) ? c.const_get('API_PATHS')[m] : nil
|
||||
def get_api_path(clss, mthd)
|
||||
verify_api_path(clss, mthd) ? clss.const_get('API_PATHS')[mthd] : nil
|
||||
end
|
||||
|
||||
#
|
||||
@@ -171,37 +173,33 @@ module BeEF
|
||||
#
|
||||
# Fires all owners registered to this API hook
|
||||
#
|
||||
# @param [Class] c the target API class
|
||||
# @param [String] m the target API method
|
||||
# @param [Class] clss the target API class
|
||||
# @param [String] mthd the target API method
|
||||
# @param [Array] *args parameters passed for the API call
|
||||
#
|
||||
# @return [Hash, NilClass] returns either a Hash of :api_id and :data
|
||||
# if the owners return data, otherwise NilClass
|
||||
#
|
||||
def fire(c, m, *args)
|
||||
mods = get_owners(c, m, args)
|
||||
def fire(clss, mthd, *args)
|
||||
mods = get_owners(clss, mthd, args)
|
||||
return nil unless mods.length.positive?
|
||||
|
||||
unless verify_api_path(c, m) && c.ancestors[0].to_s > 'BeEF::API'
|
||||
print_error "API Path not defined for Class: #{c} method:#{method}"
|
||||
unless verify_api_path(clss, mthd) && clss.ancestors[0].to_s > 'BeEF::API'
|
||||
print_error "API Path not defined for Class: #{clss} method: #{mthd}"
|
||||
return []
|
||||
end
|
||||
|
||||
data = []
|
||||
method = get_api_path(c, m)
|
||||
method = get_api_path(clss, mthd)
|
||||
mods.each do |mod|
|
||||
begin
|
||||
# Only used for API Development (very verbose)
|
||||
# print_info "API: #{mod} fired #{method}"
|
||||
|
||||
result = mod[:owner].method(method).call(*args)
|
||||
unless result.nil?
|
||||
data << { :api_id => mod[:id], :data => result }
|
||||
end
|
||||
rescue => e
|
||||
data << { api_id: mod[:id], data: result } unless result.nil?
|
||||
rescue StandardError => e
|
||||
print_error "API Fire Error: #{e.message} in #{mod}.#{method}()"
|
||||
end
|
||||
end
|
||||
|
||||
data
|
||||
end
|
||||
@@ -214,8 +212,7 @@ require 'core/api/modules'
|
||||
require 'core/api/extension'
|
||||
require 'core/api/extensions'
|
||||
require 'core/api/main/migration'
|
||||
require 'core/api/main/network_stack/assethandler.rb'
|
||||
require 'core/api/main/network_stack/assethandler'
|
||||
require 'core/api/main/server'
|
||||
require 'core/api/main/server/hook'
|
||||
require 'core/api/main/configuration'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -7,14 +7,11 @@
|
||||
module BeEF
|
||||
module API
|
||||
module Extension
|
||||
|
||||
attr_reader :full_name, :short_name, :description
|
||||
|
||||
@full_name = ''
|
||||
@short_name = ''
|
||||
@description = ''
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
module Extensions
|
||||
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'post_load' => :post_load
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# API hook fired after all extensions have been loaded
|
||||
def post_load;
|
||||
end
|
||||
|
||||
def post_load; end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
module API
|
||||
module Configuration
|
||||
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'module_configuration_load' => :module_configuration_load
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Fires just after module configuration is loaded and merged
|
||||
# @param [String] mod module key
|
||||
def module_configuration_load(mod); end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
module API
|
||||
module Migration
|
||||
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'migrate_commands' => :migrate_commands
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Fired just after the migration process
|
||||
def migrate_commands; end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
module NetworkStack
|
||||
module Handlers
|
||||
module AssetHandler
|
||||
|
||||
module API
|
||||
module NetworkStack
|
||||
module Handlers
|
||||
module AssetHandler
|
||||
# Binds a file to be accessible by the hooked browser
|
||||
# @param [String] file file to be served
|
||||
# @param [String] path URL path to be bound, if no path is specified a randomly generated one will be used
|
||||
@@ -17,8 +16,8 @@ module AssetHandler
|
||||
# @return [String] URL bound to the specified file
|
||||
# @todo Add hooked browser parameter to only allow specified hooked browsers access to the bound URL. Waiting on Issue #336
|
||||
# @note This is a direct API call and does not have to be registered to be used
|
||||
def self.bind(file, path=nil, extension=nil, count=-1)
|
||||
return BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind(file, path, extension, count)
|
||||
def self.bind(file, path = nil, extension = nil, count = -1)
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind(file, path, extension, count)
|
||||
end
|
||||
|
||||
# Unbinds a file made accessible to hooked browsers
|
||||
@@ -28,9 +27,8 @@ module AssetHandler
|
||||
def self.unbind(url)
|
||||
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind(url)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
module Server
|
||||
|
||||
module API
|
||||
module Server
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'mount_handler' => :mount_handler,
|
||||
'pre_http_start' => :pre_http_start
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Fires just before the HTTP Server is started
|
||||
# @param [Object] http_hook_server HTTP Server object
|
||||
@@ -36,8 +35,6 @@ module Server
|
||||
def self.unmount(url)
|
||||
BeEF::Core::Server.instance.unmount(url)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
module Server
|
||||
module API
|
||||
module Server
|
||||
module Hook
|
||||
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'pre_hook_send' => :pre_hook_send
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Fires just before the hook is sent to the hooked browser
|
||||
# @param [Class] handler the associated handler Class
|
||||
def pre_hook_send(handler); end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
|
||||
module Command
|
||||
end
|
||||
|
||||
module Module
|
||||
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'pre_soft_load' => :pre_soft_load,
|
||||
@@ -20,7 +18,7 @@ module BeEF
|
||||
'get_options' => :get_options,
|
||||
'get_payload_options' => :get_payload_options,
|
||||
'override_execute' => :override_execute
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Fired before a module soft load
|
||||
# @param [String] mod module key of module about to be soft loaded
|
||||
@@ -54,8 +52,6 @@ module BeEF
|
||||
# @return [Hash] a hash of options
|
||||
# @note the option hash is merged with all other API hook's returned hash. Hooking this API method prevents the default options being returned.
|
||||
def get_payload_options; end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module API
|
||||
|
||||
module Modules
|
||||
|
||||
# @note Defined API Paths
|
||||
API_PATHS = {
|
||||
'post_soft_load' => :post_soft_load
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Fires just after all modules are soft loaded
|
||||
def post_soft_load; end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
## @note Include the BeEF router
|
||||
require 'core/main/router/router'
|
||||
require 'core/main/router/api'
|
||||
require 'core/main/router/error_responses'
|
||||
|
||||
|
||||
## @note Include http server functions for beef
|
||||
require 'core/main/server'
|
||||
require 'core/main/handlers/modules/beefjs'
|
||||
require 'core/main/handlers/modules/legacybeefjs'
|
||||
require 'core/main/handlers/modules/multistagebeefjs'
|
||||
require 'core/main/handlers/modules/command'
|
||||
require 'core/main/handlers/commands'
|
||||
require 'core/main/handlers/hookedbrowsers'
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
|
||||
end
|
||||
module Core
|
||||
end
|
||||
end
|
||||
|
||||
# @note Includes database models - the order must be consistent otherwise DataMapper goes crazy
|
||||
@@ -20,6 +19,7 @@ require 'core/main/models/optioncache'
|
||||
require 'core/main/models/browserdetails'
|
||||
require 'core/main/models/rule'
|
||||
require 'core/main/models/execution'
|
||||
require 'core/main/models/legacybrowseruseragents'
|
||||
|
||||
# @note Include the constants
|
||||
require 'core/main/constants/browsers'
|
||||
@@ -38,4 +38,3 @@ require 'core/main/geoip'
|
||||
# @note Include the command line parser and the banner printer
|
||||
require 'core/main/console/commandline'
|
||||
require 'core/main/console/banners'
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Extension
|
||||
|
||||
# Checks to see if extension is set inside the configuration
|
||||
# @param [String] ext the extension key
|
||||
# @return [Boolean] whether or not the extension exists in BeEF's configuration
|
||||
@@ -18,6 +17,7 @@ module BeEF
|
||||
# @return [Boolean] whether or not the extension is enabled
|
||||
def self.is_enabled(ext)
|
||||
return false unless is_present(ext)
|
||||
|
||||
BeEF::Core::Configuration.instance.get("beef.extension.#{ext}.enable") == true
|
||||
end
|
||||
|
||||
@@ -26,6 +26,7 @@ module BeEF
|
||||
# @return [Boolean] whether or not the extension is loaded
|
||||
def self.is_loaded(ext)
|
||||
return false unless is_enabled(ext)
|
||||
|
||||
BeEF::Core::Configuration.instance.get("beef.extension.#{ext}.loaded") == true
|
||||
end
|
||||
|
||||
@@ -41,7 +42,7 @@ module BeEF
|
||||
end
|
||||
print_error "Unable to load extension '#{ext}'"
|
||||
false
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
print_error "Unable to load extension '#{ext}':"
|
||||
print_more e.message
|
||||
end
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Extensions
|
||||
|
||||
# Returns configuration of all enabled extensions
|
||||
# @return [Array] an array of extension configuration hashes that are enabled
|
||||
def self.get_enabled
|
||||
BeEF::Core::Configuration.instance.get('beef.extension').select { |k,v| v['enable'] == true }
|
||||
rescue => e
|
||||
BeEF::Core::Configuration.instance.get('beef.extension').select { |_k, v| v['enable'] == true }
|
||||
rescue StandardError => e
|
||||
print_error "Failed to get enabled extensions: #{e.message}"
|
||||
print_error e.backtrace
|
||||
end
|
||||
@@ -18,8 +17,8 @@ module BeEF
|
||||
# Returns configuration of all loaded extensions
|
||||
# @return [Array] an array of extension configuration hashes that are loaded
|
||||
def self.get_loaded
|
||||
BeEF::Core::Configuration.instance.get('beef.extension').select {|k,v| v['loaded'] == true }
|
||||
rescue => e
|
||||
BeEF::Core::Configuration.instance.get('beef.extension').select { |_k, v| v['loaded'] == true }
|
||||
rescue StandardError => e
|
||||
print_error "Failed to get loaded extensions: #{e.message}"
|
||||
print_error e.backtrace
|
||||
end
|
||||
@@ -28,12 +27,12 @@ module BeEF
|
||||
# @note API fire for post_load
|
||||
def self.load
|
||||
BeEF::Core::Configuration.instance.load_extensions_config
|
||||
self.get_enabled.each { |k,v|
|
||||
get_enabled.each do |k, _v|
|
||||
BeEF::Extension.load k
|
||||
}
|
||||
end
|
||||
# API post extension load
|
||||
BeEF::API::Registrar.instance.fire BeEF::API::Extensions, 'post_load'
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
print_error "Failed to load extensions: #{e.message}"
|
||||
print_error e.backtrace
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
module Filters
|
||||
# Check if the string is not empty and not nil
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] Whether the string is not empty
|
||||
@@ -13,6 +12,7 @@ module Filters
|
||||
return false if str.nil?
|
||||
return false unless str.is_a? String
|
||||
return false if str.empty?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -31,14 +31,15 @@ module Filters
|
||||
# @return [Boolean] Whether one of the characters exists in the string
|
||||
def self.exists?(chars, str)
|
||||
regex = Regexp.new(chars)
|
||||
not regex.match(str.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')).nil?
|
||||
!regex.match(str.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')).nil?
|
||||
end
|
||||
|
||||
# Check for null char
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] If the string has a null character
|
||||
def self.has_null? (str)
|
||||
def self.has_null?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
|
||||
exists?('\x00', str)
|
||||
end
|
||||
|
||||
@@ -47,7 +48,8 @@ module Filters
|
||||
# @return [Boolean] Whether or not the string has non-printable characters
|
||||
def self.has_non_printable_char?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
not only?('[:print:]', str)
|
||||
|
||||
!only?('[:print:]', str)
|
||||
end
|
||||
|
||||
# Check if num characters only
|
||||
@@ -55,6 +57,7 @@ module Filters
|
||||
# @return [Boolean] If the string only contains numbers
|
||||
def self.nums_only?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
|
||||
only?('0-9', str)
|
||||
end
|
||||
|
||||
@@ -64,7 +67,8 @@ module Filters
|
||||
def self.is_valid_float?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false unless only?('0-9\.', str)
|
||||
not (str =~ /^[\d]+\.[\d]+$/).nil?
|
||||
|
||||
!(str =~ /^\d+\.\d+$/).nil?
|
||||
end
|
||||
|
||||
# Check if hex characters only
|
||||
@@ -72,6 +76,7 @@ module Filters
|
||||
# @return [Boolean] If the string only contains hex characters
|
||||
def self.hexs_only?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
|
||||
only?('0123456789ABCDEFabcdef', str)
|
||||
end
|
||||
|
||||
@@ -80,7 +85,8 @@ module Filters
|
||||
# @return [Boolean] If the first character of the string is a number
|
||||
def self.first_char_is_num?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
not (str =~ /^\d.*/).nil?
|
||||
|
||||
!(str =~ /^\d.*/).nil?
|
||||
end
|
||||
|
||||
# Check for space characters: \t\n\r\f
|
||||
@@ -88,6 +94,7 @@ module Filters
|
||||
# @return [Boolean] If the string has a whitespace character
|
||||
def self.has_whitespace_char?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
|
||||
exists?('\s', str)
|
||||
end
|
||||
|
||||
@@ -96,7 +103,8 @@ module Filters
|
||||
# @return [Boolean] If the string only has alphanums
|
||||
def self.alphanums_only?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
only?("a-zA-Z0-9", str)
|
||||
|
||||
only?('a-zA-Z0-9', str)
|
||||
end
|
||||
|
||||
# @overload self.is_valid_ip?(ip, version)
|
||||
@@ -111,7 +119,8 @@ module Filters
|
||||
# @return [Boolean] true if the string is a valid IPv4 or IPV6 address, otherwise false
|
||||
def self.is_valid_ip?(ip, version = :both)
|
||||
return false unless is_non_empty_string?(ip)
|
||||
valid = case version.inspect.downcase
|
||||
|
||||
if case version.inspect.downcase
|
||||
when /^:ipv4$/
|
||||
ip =~ /^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}
|
||||
(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])$/x
|
||||
@@ -134,9 +143,11 @@ module Filters
|
||||
(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/ix
|
||||
when /^:both$/
|
||||
is_valid_ip?(ip, :ipv4) || is_valid_ip?(ip, :ipv6)
|
||||
end ? true : false
|
||||
|
||||
valid
|
||||
end
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Checks if the given string is a valid private IP address
|
||||
@@ -145,7 +156,8 @@ module Filters
|
||||
# @note Includes RFC1918 private IPv4, private IPv6, and localhost 127.0.0.0/8, but does not include local-link addresses.
|
||||
def self.is_valid_private_ip?(ip)
|
||||
return false unless is_valid_ip?(ip)
|
||||
return ip =~ /\A(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])\z/ ? true : false
|
||||
|
||||
ip =~ /\A(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])\z/ ? true : false
|
||||
end
|
||||
|
||||
# Checks if the given string is a valid TCP port
|
||||
@@ -164,6 +176,7 @@ module Filters
|
||||
def self.is_valid_domain?(domain)
|
||||
return false unless is_non_empty_string?(domain)
|
||||
return true if domain =~ /^[0-9a-z-]+(\.[0-9a-z-]+)*(\.[a-z]{2,}).?$/i
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
@@ -173,7 +186,8 @@ module Filters
|
||||
# @note This function passes the \302\256 character which translates to the registered symbol (r)
|
||||
def self.has_valid_browser_details_chars?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
not (str =~ /[^\w\d\s()-.,;:_\/!\302\256]/).nil?
|
||||
|
||||
!(str =~ %r{[^\w\d\s()-.,;:_/!\302\256]}).nil?
|
||||
end
|
||||
|
||||
# Check for valid base details characters
|
||||
@@ -183,6 +197,7 @@ module Filters
|
||||
# @note This function passes the \302\256 character which translates to the registered symbol (r)
|
||||
def self.has_valid_base_chars?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
|
||||
(str =~ /[^\302\256[:print:]]/).nil?
|
||||
end
|
||||
|
||||
@@ -192,8 +207,8 @@ module Filters
|
||||
def self.is_valid_yes_no?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str !~ /\A(Yes|No)\z/i
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
module Filters
|
||||
# Check the browser type value - for example, 'FF'
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] If the string has valid browser name characters
|
||||
@@ -13,6 +12,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if str.length > 2
|
||||
return false if has_non_printable_char?(str)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -23,6 +23,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length < 2
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -33,6 +34,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length < 2
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -42,10 +44,11 @@ module Filters
|
||||
def self.is_valid_browserversion?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return true if str.eql? "UNKNOWN"
|
||||
return true if str.eql? "ALL"
|
||||
return false if not nums_only?(str) and not is_valid_float?(str)
|
||||
return true if str.eql? 'UNKNOWN'
|
||||
return true if str.eql? 'ALL'
|
||||
return false if !nums_only?(str) and !is_valid_float?(str)
|
||||
return false if str.length > 20
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -55,10 +58,11 @@ module Filters
|
||||
def self.is_valid_osversion?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return true if str.eql? "UNKNOWN"
|
||||
return true if str.eql? "ALL"
|
||||
return false unless BeEF::Filters::only?("a-zA-Z0-9.<=> ", str)
|
||||
return true if str.eql? 'UNKNOWN'
|
||||
return true if str.eql? 'ALL'
|
||||
return false unless BeEF::Filters.only?('a-zA-Z0-9.<=> ', str)
|
||||
return false if str.length > 20
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -69,6 +73,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 300
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -79,6 +84,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 2000
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -89,6 +95,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 200
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -99,6 +106,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 200
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -109,6 +117,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 200
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -119,6 +128,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 200
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -129,6 +139,7 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 200
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -140,12 +151,12 @@ module Filters
|
||||
def self.is_valid_browser_plugins?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if str.length > 1000
|
||||
if str.encoding === Encoding.find('UTF-8')
|
||||
return (str =~ /[^\w\d\s()-.,';_!\302\256]/u).nil?
|
||||
else
|
||||
return (str =~ /[^\w\d\s()-.,';_!\302\256]/n).nil?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
if str.encoding === Encoding.find('UTF-8')
|
||||
(str =~ /[^\w\d\s()-.,';_!\302\256]/u).nil?
|
||||
else
|
||||
(str =~ /[^\w\d\s()-.,';_!\302\256]/n).nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
module Filters
|
||||
# Check if the string is a valid path from a HTTP request
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] If the string has valid path characters
|
||||
@@ -13,6 +12,7 @@ module Filters
|
||||
return false if str.nil?
|
||||
return false unless str.is_a? String
|
||||
return false if has_non_printable_char?(str)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -22,6 +22,7 @@ module Filters
|
||||
def self.is_valid_hook_session_id?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false unless has_valid_key_chars?(str)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -31,6 +32,7 @@ module Filters
|
||||
def self.is_valid_command_module_datastore_key?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false unless has_valid_key_chars?(str)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -40,6 +42,7 @@ module Filters
|
||||
def self.is_valid_command_module_datastore_param?(str)
|
||||
return false if has_null?(str)
|
||||
return false unless has_valid_base_chars?(str)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -49,6 +52,7 @@ module Filters
|
||||
def self.has_valid_key_chars?(str)
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false unless has_valid_base_chars?(str)
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -59,9 +63,9 @@ module Filters
|
||||
return false if str.nil?
|
||||
return false unless str.is_a? String
|
||||
return false if str.empty?
|
||||
return false unless (str =~ /[^\w_\:]/).nil?
|
||||
return false unless (str =~ /[^\w_:]/).nil?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
module Filters
|
||||
# Verify the hostname string is valid
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] If the string is a valid hostname
|
||||
@@ -13,49 +12,51 @@ module Filters
|
||||
return false unless is_non_empty_string?(str)
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 255
|
||||
return false if (str =~ /^[a-zA-Z0-9][a-zA-Z0-9\-\.]*[a-zA-Z0-9]$/).nil?
|
||||
return false if (str =~ /^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/).nil?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def self.is_valid_verb?(verb)
|
||||
["HEAD", "GET", "POST", "OPTIONS", "PUT", "DELETE"].each {|v| return true if verb.eql? v }
|
||||
%w[HEAD GET POST OPTIONS PUT DELETE].each { |v| return true if verb.eql? v }
|
||||
false
|
||||
end
|
||||
|
||||
def self.is_valid_url?(uri)
|
||||
return true if !uri.nil?
|
||||
return true unless uri.nil?
|
||||
|
||||
# OPTIONS * is not yet supported
|
||||
#return true if uri.eql? "*"
|
||||
# return true if uri.eql? "*"
|
||||
# TODO : CHECK THE normalize_path method and include it somewhere (maybe here)
|
||||
#return true if uri.eql? self.normalize_path(uri)
|
||||
# return true if uri.eql? self.normalize_path(uri)
|
||||
false
|
||||
end
|
||||
|
||||
def self.is_valid_http_version?(version)
|
||||
# from browsers the http version contains a space at the end ("HTTP/1.0\r")
|
||||
version.gsub!(/[\r]+/,"")
|
||||
["HTTP/1.0", "HTTP/1.1"].each {|v| return true if version.eql? v }
|
||||
version.gsub!(/\r+/, '')
|
||||
['HTTP/1.0', 'HTTP/1.1'].each { |v| return true if version.eql? v }
|
||||
false
|
||||
end
|
||||
|
||||
def self.is_valid_host_str?(host_str)
|
||||
# from browsers the host header contains a space at the end
|
||||
host_str.gsub!(/[\r]+/,"")
|
||||
return true if "Host:".eql?(host_str)
|
||||
host_str.gsub!(/\r+/, '')
|
||||
return true if 'Host:'.eql?(host_str)
|
||||
|
||||
false
|
||||
end
|
||||
|
||||
def normalize_path(path)
|
||||
print_error "abnormal path `#{path}'" if path[0] != ?/
|
||||
print_error "abnormal path `#{path}'" if path[0] != '/'
|
||||
ret = path.dup
|
||||
|
||||
ret.gsub!(%r{/+}o, '/') # // => /
|
||||
while ret.sub!(%r'/\.(?:/|\Z)', '/'); end # /. => /
|
||||
while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo
|
||||
while ret.sub!(%r{/\.(?:/|\Z)}, '/'); end # /. => /
|
||||
while ret.sub!(%r{/(?!\.\./)[^/]+/\.\.(?:/|\Z)}, '/'); end # /foo/.. => /foo
|
||||
|
||||
print_error "abnormal path `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
|
||||
ret
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Filters
|
||||
|
||||
module Filters
|
||||
# Verify the page title string is valid
|
||||
# @param [String] str String for testing
|
||||
# @return [Boolean] If the string is a valid page title
|
||||
@@ -13,6 +12,7 @@ module Filters
|
||||
return false unless str.is_a? String
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 500 # CxF Increased this because some page titles are MUCH longer
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -23,8 +23,8 @@ module Filters
|
||||
return false unless str.is_a? String
|
||||
return false if has_non_printable_char?(str)
|
||||
return false if str.length > 350
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module HBManager
|
||||
|
||||
# Get hooked browser by session id
|
||||
# @param [String] sid hooked browser session id string
|
||||
# @return [BeEF::Core::Models::HookedBrowser] returns the associated Hooked Browser
|
||||
def self.get_by_session(sid)
|
||||
BeEF::Core::Models::HookedBrowser.where(:session => sid).first
|
||||
BeEF::Core::Models::HookedBrowser.where(session: sid).first
|
||||
end
|
||||
|
||||
# Get hooked browser by id
|
||||
@@ -19,6 +18,5 @@ module BeEF
|
||||
def self.get_by_id(id)
|
||||
BeEF::Core::Models::HookedBrowser.find(id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -13,7 +13,7 @@ module BeEF
|
||||
|
||||
def logger
|
||||
@logger ||= Logger.new("#{$home_dir}/beef.log").tap do |log|
|
||||
log.progname = self.name
|
||||
log.progname = name
|
||||
log.level = Logger::WARN
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
class CreateCommandModules < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :command_modules do |t|
|
||||
t.text :name
|
||||
t.text :path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateHookedBrowsers < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :hooked_browsers do |t|
|
||||
t.text :session
|
||||
t.text :ip
|
||||
@@ -13,7 +11,5 @@ class CreateHookedBrowsers < ActiveRecord::Migration[6.0]
|
||||
t.integer :count
|
||||
t.boolean :is_proxy
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
class CreateLogs < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :logs do |t|
|
||||
t.text :logtype
|
||||
t.text :event
|
||||
t.datetime :date
|
||||
t.references :hooked_browser
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateCommands < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :commands do |t|
|
||||
t.references :command_module
|
||||
t.references :hooked_browser
|
||||
@@ -10,7 +8,5 @@ class CreateCommands < ActiveRecord::Migration[6.0]
|
||||
t.text :label
|
||||
t.boolean :instructions_sent, default: false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateResults < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :results do |t|
|
||||
t.references :command
|
||||
t.references :hooked_browser
|
||||
@@ -9,7 +7,5 @@ class CreateResults < ActiveRecord::Migration[6.0]
|
||||
t.integer :status
|
||||
t.text :data
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
class CreateOptionCaches < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :option_caches do |t|
|
||||
t.text :name
|
||||
t.text :value
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
class CreateBrowserDetails < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :browser_details do |t|
|
||||
t.text :session_id
|
||||
t.text :detail_key
|
||||
t.text :detail_value
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateExecutions < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :executions do |t|
|
||||
t.text :session_id
|
||||
t.integer :mod_count
|
||||
@@ -12,7 +10,5 @@ class CreateExecutions < ActiveRecord::Migration[6.0]
|
||||
t.boolean :is_sent
|
||||
t.integer :rule_id
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateRules < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :rules do |t|
|
||||
t.text :name
|
||||
t.text :author
|
||||
@@ -14,7 +12,5 @@ class CreateRules < ActiveRecord::Migration[6.0]
|
||||
t.text :execution_delay
|
||||
t.text :chain_mode
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
class CreateInterceptor < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :interceptors do |t|
|
||||
t.text :ip
|
||||
t.text :post_data
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
class CreateWebCloner < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :web_cloners do |t|
|
||||
t.text :uri
|
||||
t.text :mount
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
class CreateMassMailer < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :mass_mailers do |t|
|
||||
#todo fields
|
||||
# TODO: fields
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateNetworkHost < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :network_hosts do |t|
|
||||
t.references :hooked_browser
|
||||
t.text :ip
|
||||
@@ -11,7 +9,5 @@ class CreateNetworkHost < ActiveRecord::Migration[6.0]
|
||||
t.text :mac
|
||||
t.text :lastseen
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateNetworkService < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :network_services do |t|
|
||||
t.references :hooked_browser
|
||||
t.text :proto
|
||||
@@ -9,7 +7,5 @@ class CreateNetworkService < ActiveRecord::Migration[6.0]
|
||||
t.text :port
|
||||
t.text :ntype
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
class CreateHttp < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :https do |t|
|
||||
t.text :hooked_browser_id
|
||||
# The http request to perform. In clear text.
|
||||
t.text :request
|
||||
# Boolean value as string to say whether cross-domain requests are allowed
|
||||
t.boolean :allow_cross_domain, :default => true
|
||||
t.boolean :allow_cross_domain, default: true
|
||||
# The http response body received. In clear text.
|
||||
t.text :response_data
|
||||
# The http response code. Useful to handle cases like 404, 500, 302, ...
|
||||
@@ -21,7 +19,7 @@ class CreateHttp < ActiveRecord::Migration[6.0]
|
||||
# The http response method. GET or POST.
|
||||
t.text :method
|
||||
# The content length for the request.
|
||||
t.text :content_length, :default => 0
|
||||
t.text :content_length, default: 0
|
||||
# The request protocol/scheme (http/https)
|
||||
t.text :proto
|
||||
# The domain on which perform the request.
|
||||
@@ -29,7 +27,7 @@ class CreateHttp < ActiveRecord::Migration[6.0]
|
||||
# The port on which perform the request.
|
||||
t.text :port
|
||||
# Boolean value to say if the request was cross-domain
|
||||
t.text :has_ran, :default => "waiting"
|
||||
t.text :has_ran, default: 'waiting'
|
||||
# The path of the request.
|
||||
# Example: /secret.html
|
||||
t.text :path
|
||||
@@ -38,7 +36,5 @@ class CreateHttp < ActiveRecord::Migration[6.0]
|
||||
# The date at which the http request has been saved.
|
||||
t.datetime :request_date
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
class CreateRtcStatus < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :rtc_statuss do |t|
|
||||
t.references :hooked_browser
|
||||
t.integer :target_hooked_browser_id
|
||||
t.text :status
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
class CreateRtcManage < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :rtc_manages do |t|
|
||||
t.references :hooked_browser
|
||||
t.text :message
|
||||
t.text :has_sent, default: "waiting"
|
||||
t.text :has_sent, default: 'waiting'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
class CreateRtcSignal < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :rtc_signals do |t|
|
||||
t.references :hooked_browser
|
||||
t.integer :target_hooked_browser_id
|
||||
t.text :signal
|
||||
t.text :has_sent, default: "waiting"
|
||||
t.text :has_sent, default: 'waiting'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
class CreateRtcModuleStatus < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :rtc_module_statuss do |t|
|
||||
t.references :hooked_browser
|
||||
t.references :command_module
|
||||
t.integer :target_hooked_browser_id
|
||||
t.text :status
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
class CreateXssraysDetail < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :xssraysdetails do |t|
|
||||
t.references :hooked_browser
|
||||
t.text :vector_name
|
||||
t.text :vector_method
|
||||
t.text :vector_poc
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
class CreateDnsRule < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :dns_rules do |t|
|
||||
t.text :pattern
|
||||
t.text :resource
|
||||
t.text :response
|
||||
t.text :callback
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
class CreateIpecExploit < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :ipec_exploits do |t|
|
||||
t.text :name
|
||||
t.text :protocol
|
||||
t.text :os
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
class CreateIpecExploitRun < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :ipec_exploit_runs do |t|
|
||||
t.boolean :launched
|
||||
t.text :http_headers
|
||||
t.text :junk_size
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
class CreateAutoloader < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :autoloaders do |t|
|
||||
t.references :command
|
||||
t.boolean :in_use
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
class CreateXssraysScan < ActiveRecord::Migration[6.0]
|
||||
|
||||
def change
|
||||
|
||||
create_table :xssraysscans do |t|
|
||||
t.references :hooked_browser
|
||||
t.datetime :scan_start
|
||||
@@ -12,7 +10,5 @@ class CreateXssraysScan < ActiveRecord::Migration[6.0]
|
||||
t.boolean :is_started
|
||||
t.boolean :is_finished
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
module AutorunEngine
|
||||
|
||||
class Engine
|
||||
|
||||
include Singleton
|
||||
|
||||
def initialize
|
||||
@@ -20,8 +18,8 @@ module BeEF
|
||||
|
||||
@debug_on = @config.get('beef.debug')
|
||||
|
||||
@VERSION = ['<','<=','==','>=','>','ALL']
|
||||
@VERSION_STR = ['XP','Vista']
|
||||
@VERSION = ['<', '<=', '==', '>=', '>', 'ALL']
|
||||
@VERSION_STR = %w[XP Vista]
|
||||
end
|
||||
|
||||
# Check if the hooked browser type/version and OS type/version match any Rule-sets
|
||||
@@ -30,13 +28,12 @@ module BeEF
|
||||
def run(hb_id, browser_name, browser_version, os_name, os_version)
|
||||
are = BeEF::Core::AutorunEngine::Engine.instance
|
||||
match_rules = are.match(browser_name, browser_version, os_name, os_version)
|
||||
are.trigger(match_rules, hb_id) if match_rules !=nil && match_rules.length > 0
|
||||
are.trigger(match_rules, hb_id) if !match_rules.nil? && match_rules.length > 0
|
||||
end
|
||||
|
||||
# Prepare and return the JavaScript of the modules to be sent.
|
||||
# It also updates the rules ARE execution table with timings
|
||||
def trigger(rule_ids, hb_id)
|
||||
|
||||
hb = BeEF::HBManager.get_by_id(hb_id)
|
||||
hb_session = hb.session
|
||||
|
||||
@@ -48,26 +45,25 @@ module BeEF
|
||||
execution_delay = JSON.parse(rule.execution_delay)
|
||||
chain_mode = rule.chain_mode
|
||||
|
||||
mods_bodies = Array.new
|
||||
mods_codes = Array.new
|
||||
mods_conditions = Array.new
|
||||
mods_bodies = []
|
||||
mods_codes = []
|
||||
mods_conditions = []
|
||||
|
||||
# this ensures that if both rule A and rule B call the same module in sequential mode,
|
||||
# execution will be correct preventing wrapper functions to be called with equal names.
|
||||
rule_token = SecureRandom.hex(5)
|
||||
|
||||
modules.each do |cmd_mod|
|
||||
mod = BeEF::Core::Models::CommandModule.where(:name => cmd_mod['name']).first
|
||||
mod = BeEF::Core::Models::CommandModule.where(name: cmd_mod['name']).first
|
||||
options = []
|
||||
replace_input = false
|
||||
cmd_mod['options'].each do|k,v|
|
||||
options.push({'name' => k, 'value' => v})
|
||||
cmd_mod['options'].each do |k, v|
|
||||
options.push({ 'name' => k, 'value' => v })
|
||||
replace_input = true if v == '<<mod_input>>'
|
||||
end
|
||||
|
||||
command_body = prepare_command(mod, options, hb_id, replace_input, rule_token)
|
||||
|
||||
|
||||
mods_bodies.push(command_body)
|
||||
mods_codes.push(cmd_mod['code'])
|
||||
mods_conditions.push(cmd_mod['condition'])
|
||||
@@ -81,26 +77,25 @@ module BeEF
|
||||
wrapper = prepare_sequential_wrapper(mods_bodies, execution_order, execution_delay, rule_token)
|
||||
else
|
||||
wrapper = nil
|
||||
print_error "Chain mode looks wrong!"
|
||||
# TODO catch error, which should never happen as values are checked way before ;-)
|
||||
print_error 'Chain mode looks wrong!'
|
||||
# TODO: catch error, which should never happen as values are checked way before ;-)
|
||||
end
|
||||
|
||||
are_exec = BeEF::Core::Models::Execution.new(
|
||||
:session_id => hb_session,
|
||||
:mod_count => modules.length,
|
||||
:mod_successful => 0,
|
||||
:rule_token => rule_token,
|
||||
:mod_body => wrapper,
|
||||
:is_sent => false,
|
||||
:id => rule_id
|
||||
session_id: hb_session,
|
||||
mod_count: modules.length,
|
||||
mod_successful: 0,
|
||||
rule_token: rule_token,
|
||||
mod_body: wrapper,
|
||||
is_sent: false,
|
||||
id: rule_id
|
||||
)
|
||||
are_exec.save!
|
||||
# Once Engine.check() verified that the hooked browser match a Rule, trigger the Rule ;-)
|
||||
print_more "Triggering ruleset #{rule_ids.to_s} on HB #{hb_id}"
|
||||
print_more "Triggering ruleset #{rule_ids} on HB #{hb_id}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Wraps module bodies in their own function, using setTimeout to trigger them with an eventual delay.
|
||||
# Launch order is also taken care of.
|
||||
# - sequential chain with delays (setTimeout stuff)
|
||||
@@ -114,7 +109,7 @@ module BeEF
|
||||
delayed_exec = ''
|
||||
c = 0
|
||||
while c < mods.length
|
||||
delayed_exec += %Q| setTimeout(function(){#{mods[order[c]][:mod_name]}_#{rule_token}();}, #{delay[c]}); |
|
||||
delayed_exec += %| setTimeout(function(){#{mods[order[c]][:mod_name]}_#{rule_token}();}, #{delay[c]}); |
|
||||
mod_body = mods[order[c]][:mod_body].to_s.gsub("#{mods[order[c]][:mod_name]}_mod_output", "#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output")
|
||||
wrapped_mod = "#{mod_body}\n"
|
||||
wrapper += wrapped_mod
|
||||
@@ -141,15 +136,16 @@ module BeEF
|
||||
# if the first once return with success. Also, the second module has the possibility of mangling first
|
||||
# module output and use it as input for some of its module inputs.
|
||||
def prepare_nested_forward_wrapper(mods, code, conditions, order, rule_token)
|
||||
wrapper, delayed_exec = '',''
|
||||
delayed_exec_footers = Array.new
|
||||
wrapper = ''
|
||||
delayed_exec = ''
|
||||
delayed_exec_footers = []
|
||||
c = 0
|
||||
|
||||
while c < mods.length
|
||||
if mods.length == 1
|
||||
i = c
|
||||
i = if mods.length == 1
|
||||
c
|
||||
else
|
||||
i = c + 1
|
||||
c + 1
|
||||
end
|
||||
|
||||
code_snippet = ''
|
||||
@@ -159,11 +155,11 @@ module BeEF
|
||||
mod_input = 'mod_input'
|
||||
end
|
||||
|
||||
conditions[i] = true if conditions[i] == nil || conditions[i] == ''
|
||||
conditions[i] = true if conditions[i].nil? || conditions[i] == ''
|
||||
|
||||
if c == 0
|
||||
# this is the first wrapper to prepare
|
||||
delayed_exec += %Q|
|
||||
delayed_exec += %|
|
||||
function #{mods[order[c]][:mod_name]}_#{rule_token}_f(){
|
||||
#{mods[order[c]][:mod_name]}_#{rule_token}();
|
||||
|
||||
@@ -185,7 +181,7 @@ module BeEF
|
||||
#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output = mod_result[1];
|
||||
|
|
||||
|
||||
delayed_exec_footer = %Q|
|
||||
delayed_exec_footer = %|
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,10 +194,10 @@ module BeEF
|
||||
delayed_exec_footers.push(delayed_exec_footer)
|
||||
|
||||
elsif c < mods.length - 1
|
||||
code_snippet = code_snippet.to_s.gsub(mods[order[c-1]][:mod_name], "#{mods[order[c-1]][:mod_name]}_#{rule_token}")
|
||||
code_snippet = code_snippet.to_s.gsub(mods[order[c - 1]][:mod_name], "#{mods[order[c - 1]][:mod_name]}_#{rule_token}")
|
||||
|
||||
# this is one of the wrappers in the middle of the chain
|
||||
delayed_exec += %Q|
|
||||
delayed_exec += %|
|
||||
function #{mods[order[c]][:mod_name]}_#{rule_token}_f(){
|
||||
if(#{mods[order[c]][:mod_name]}_#{rule_token}_can_exec){
|
||||
#{code_snippet}
|
||||
@@ -223,7 +219,7 @@ module BeEF
|
||||
#{mods[order[c]][:mod_name]}_#{rule_token}_mod_output = mod_result[1];
|
||||
|
|
||||
|
||||
delayed_exec_footer = %Q|
|
||||
delayed_exec_footer = %|
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,9 +232,9 @@ module BeEF
|
||||
|
||||
delayed_exec_footers.push(delayed_exec_footer)
|
||||
else
|
||||
code_snippet = code_snippet.to_s.gsub(mods[order[c-1]][:mod_name], "#{mods[order[c-1]][:mod_name]}_#{rule_token}")
|
||||
code_snippet = code_snippet.to_s.gsub(mods[order[c - 1]][:mod_name], "#{mods[order[c - 1]][:mod_name]}_#{rule_token}")
|
||||
# this is the last wrapper to prepare
|
||||
delayed_exec += %Q|
|
||||
delayed_exec += %|
|
||||
function #{mods[order[c]][:mod_name]}_#{rule_token}_f(){
|
||||
if(#{mods[order[c]][:mod_name]}_#{rule_token}_can_exec){
|
||||
#{code_snippet}
|
||||
@@ -258,7 +254,6 @@ module BeEF
|
||||
wrapper
|
||||
end
|
||||
|
||||
|
||||
# prepare the command module (compiling the Erubis templating stuff), eventually obfuscate it,
|
||||
# and store it in the database.
|
||||
# Returns the raw module body after template substitution.
|
||||
@@ -266,16 +261,16 @@ module BeEF
|
||||
config = BeEF::Core::Configuration.instance
|
||||
begin
|
||||
command = BeEF::Core::Models::Command.new(
|
||||
:data => options.to_json,
|
||||
:hooked_browser_id => hb_id,
|
||||
:command_module_id => BeEF::Core::Configuration.instance.get("beef.module.#{mod.name}.db.id"),
|
||||
:creationdate => Time.new.to_i,
|
||||
:instructions_sent => true
|
||||
data: options.to_json,
|
||||
hooked_browser_id: hb_id,
|
||||
command_module_id: BeEF::Core::Configuration.instance.get("beef.module.#{mod.name}.db.id"),
|
||||
creationdate: Time.new.to_i,
|
||||
instructions_sent: true
|
||||
)
|
||||
command.save!
|
||||
|
||||
command_module = BeEF::Core::Models::CommandModule.find(mod.id)
|
||||
if (command_module.path.match(/^Dynamic/))
|
||||
if command_module.path.match(/^Dynamic/)
|
||||
# metasploit and similar integrations
|
||||
command_module = BeEF::Modules::Commands.const_get(command_module.path.split('/').last.capitalize).new
|
||||
else
|
||||
@@ -293,7 +288,7 @@ module BeEF
|
||||
|
||||
build_missing_beefjs_components(command_module.beefjs_components) unless command_module.beefjs_components.empty?
|
||||
|
||||
if config.get("beef.extension.evasion.enable")
|
||||
if config.get('beef.extension.evasion.enable')
|
||||
evasion = BeEF::Extension::Evasion::Evasion.instance
|
||||
command_body = evasion.obfuscate(command_module.output) + "\n\n"
|
||||
else
|
||||
@@ -303,8 +298,8 @@ module BeEF
|
||||
# @note prints the event to the console
|
||||
print_more "Preparing JS for command id [#{command.id}], module [#{mod.name}]"
|
||||
|
||||
replace_input ? mod_input = 'mod_input' : mod_input = ''
|
||||
result = %Q|
|
||||
mod_input = replace_input ? 'mod_input' : ''
|
||||
result = %|
|
||||
var #{mod.name}_#{rule_token} = function(#{mod_input}){
|
||||
#{clean_command_body(command_body, replace_input)}
|
||||
};
|
||||
@@ -312,8 +307,8 @@ module BeEF
|
||||
var #{mod.name}_#{rule_token}_mod_output = null;
|
||||
|
|
||||
|
||||
return {:mod_name => mod.name, :mod_body => result}
|
||||
rescue => e
|
||||
{ mod_name: mod.name, mod_body: result }
|
||||
rescue StandardError => e
|
||||
print_error e.message
|
||||
print_debug e.backtrace.join("\n")
|
||||
end
|
||||
@@ -324,9 +319,8 @@ module BeEF
|
||||
#
|
||||
# Also replace <<mod_input>> with mod_input variable if needed for chaining module output/input
|
||||
def clean_command_body(command_body, replace_input)
|
||||
begin
|
||||
cmd_body = command_body.lines.map(&:chomp)
|
||||
wrapper_start_index,wrapper_end_index = nil
|
||||
wrapper_start_index, wrapper_end_index = nil
|
||||
|
||||
cmd_body.each_with_index do |line, index|
|
||||
if line.to_s =~ /^(beef|[a-zA-Z]+)\.execute\(function\(\)/
|
||||
@@ -334,9 +328,7 @@ module BeEF
|
||||
break
|
||||
end
|
||||
end
|
||||
if wrapper_start_index.nil?
|
||||
print_error "[ARE] Could not find module start index"
|
||||
end
|
||||
print_error '[ARE] Could not find module start index' if wrapper_start_index.nil?
|
||||
|
||||
cmd_body.reverse.each_with_index do |line, index|
|
||||
if line.include?('});')
|
||||
@@ -344,35 +336,29 @@ module BeEF
|
||||
break
|
||||
end
|
||||
end
|
||||
if wrapper_end_index.nil?
|
||||
print_error "[ARE] Could not find module end index"
|
||||
end
|
||||
print_error '[ARE] Could not find module end index' if wrapper_end_index.nil?
|
||||
|
||||
cleaned_cmd_body = cmd_body.slice(wrapper_start_index..-(wrapper_end_index+1)).join("\n")
|
||||
if cleaned_cmd_body.eql?('')
|
||||
print_error "[ARE] No command to send"
|
||||
end
|
||||
cleaned_cmd_body = cmd_body.slice(wrapper_start_index..-(wrapper_end_index + 1)).join("\n")
|
||||
print_error '[ARE] No command to send' if cleaned_cmd_body.eql?('')
|
||||
|
||||
# check if <<mod_input>> should be replaced with a variable name (depending if the variable is a string or number)
|
||||
if replace_input
|
||||
if cleaned_cmd_body.include?('"<<mod_input>>"')
|
||||
final_cmd_body = cleaned_cmd_body.gsub('"<<mod_input>>"','mod_input')
|
||||
final_cmd_body = cleaned_cmd_body.gsub('"<<mod_input>>"', 'mod_input')
|
||||
elsif cleaned_cmd_body.include?('\'<<mod_input>>\'')
|
||||
final_cmd_body = cleaned_cmd_body.gsub('\'<<mod_input>>\'','mod_input')
|
||||
final_cmd_body = cleaned_cmd_body.gsub('\'<<mod_input>>\'', 'mod_input')
|
||||
elsif cleaned_cmd_body.include?('<<mod_input>>')
|
||||
final_cmd_body = cleaned_cmd_body.gsub('\'<<mod_input>>\'','mod_input')
|
||||
final_cmd_body = cleaned_cmd_body.gsub('\'<<mod_input>>\'', 'mod_input')
|
||||
else
|
||||
return cleaned_cmd_body
|
||||
end
|
||||
return final_cmd_body
|
||||
final_cmd_body
|
||||
else
|
||||
return cleaned_cmd_body
|
||||
cleaned_cmd_body
|
||||
end
|
||||
rescue => e
|
||||
print_error "[ARE] There is likely a problem with the module's command.js parsing. Check Engine.clean_command_body"
|
||||
rescue StandardError => e
|
||||
print_error "[ARE] There is likely a problem with the module's command.js parsing. Check Engine.clean_command_body. #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Checks if there are any ARE rules to be triggered for the specified hooked browser
|
||||
#
|
||||
@@ -382,22 +368,22 @@ module BeEF
|
||||
# Returns an array with rule IDs that matched and should be triggered.
|
||||
# if rule_id is specified, checks will be executed only against the specified rule (useful
|
||||
# for dynamic triggering of new rulesets ar runtime)
|
||||
def match(browser, browser_version, os, os_version, rule_id=nil)
|
||||
def match(browser, browser_version, os, os_version, rule_id = nil)
|
||||
match_rules = []
|
||||
if rule_id != nil
|
||||
rules = [BeEF::Core::Models::Rule.find(rule_id)]
|
||||
rules = if rule_id.nil?
|
||||
BeEF::Core::Models::Rule.all
|
||||
else
|
||||
rules = BeEF::Core::Models::Rule.all
|
||||
[BeEF::Core::Models::Rule.find(rule_id)]
|
||||
end
|
||||
return nil if rules == nil
|
||||
return nil if rules.nil?
|
||||
return nil unless rules.length > 0
|
||||
|
||||
print_info "[ARE] Checking if any defined rules should be triggered on target."
|
||||
# TODO handle cases where there are multiple ARE rules for the same hooked browser.
|
||||
print_info '[ARE] Checking if any defined rules should be triggered on target.'
|
||||
# TODO: handle cases where there are multiple ARE rules for the same hooked browser.
|
||||
# TODO the above works well, but maybe rules need to have priority or something?
|
||||
rules.each do |rule|
|
||||
begin
|
||||
browser_match, os_match = false, false
|
||||
browser_match = false
|
||||
os_match = false
|
||||
|
||||
b_ver_cond = rule.browser_version.split(' ').first
|
||||
b_ver = rule.browser_version.split(' ').last
|
||||
@@ -408,7 +394,7 @@ module BeEF
|
||||
|
||||
# Most of the times Linux/*BSD OS doesn't return any version
|
||||
# (TODO: improve OS detection on these operating systems)
|
||||
if os_version != nil && !@VERSION_STR.include?(os_version)
|
||||
if !os_version.nil? && !@VERSION_STR.include?(os_version)
|
||||
os_ver_hook_maj = os_version.split('.').first
|
||||
os_ver_hook_min = os_version.split('.').last
|
||||
|
||||
@@ -420,37 +406,51 @@ module BeEF
|
||||
# most probably Windows XP or Vista. the following is a hack as Microsoft had the brilliant idea
|
||||
# to switch from strings to numbers in OS versioning. To prevent rewriting code later on,
|
||||
# we say that XP is Windows 5.0 and Vista is Windows 6.0. Easier for comparison later on.
|
||||
os_ver_hook_maj, os_ver_hook_min = 5, 0 if os_version == 'XP'
|
||||
os_ver_hook_maj, os_ver_hook_min = 6, 0 if os_version == 'Vista'
|
||||
if os_version == 'XP'
|
||||
os_ver_hook_maj = 5
|
||||
os_ver_hook_min = 0
|
||||
end
|
||||
if os_version == 'Vista'
|
||||
os_ver_hook_maj = 6
|
||||
os_ver_hook_min = 0
|
||||
end
|
||||
end
|
||||
|
||||
os_ver_rule_maj, os_ver_rule_min = 5, 0 if os_ver_rule_maj == 'XP'
|
||||
os_ver_rule_maj, os_ver_rule_min = 6, 0 if os_ver_rule_maj == 'Vista'
|
||||
if os_ver_rule_maj == 'XP'
|
||||
os_ver_rule_maj = 5
|
||||
os_ver_rule_min = 0
|
||||
end
|
||||
if os_ver_rule_maj == 'Vista'
|
||||
os_ver_rule_maj = 6
|
||||
os_ver_rule_min = 0
|
||||
end
|
||||
|
||||
next unless @VERSION.include?(b_ver_cond)
|
||||
next unless BeEF::Filters::is_valid_browserversion?(b_ver)
|
||||
next unless BeEF::Filters.is_valid_browserversion?(b_ver)
|
||||
|
||||
next unless @VERSION.include?(os_ver_rule_cond) || @VERSION_STR.include?(os_ver_rule_cond)
|
||||
|
||||
# os_ver without checks as it can be very different or even empty, for instance on linux/bsd)
|
||||
|
||||
# skip rule unless the browser matches
|
||||
browser_match = false
|
||||
# check if rule specifies multiple browsers
|
||||
if rule.browser !~ /\A[A-Z]+\Z/
|
||||
if rule.browser =~ /\A[A-Z]+\Z/
|
||||
next unless rule.browser == 'ALL' || browser == rule.browser
|
||||
|
||||
# check if the browser version matches
|
||||
browser_version_match = compare_versions(browser_version.to_s, b_ver_cond, b_ver.to_s)
|
||||
browser_match = if browser_version_match
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
print_more "Browser version check -> (hook) #{browser_version} #{rule.browser_version} (rule) : #{browser_version_match}"
|
||||
else
|
||||
rule.browser.gsub(/[^A-Z,]/i, '').split(',').each do |b|
|
||||
browser_match = true if b == browser || b == 'ALL'
|
||||
end
|
||||
# else, only one browser
|
||||
else
|
||||
next unless rule.browser == 'ALL' || browser == rule.browser
|
||||
# check if the browser version matches
|
||||
browser_version_match = compare_versions(browser_version.to_s, b_ver_cond, b_ver.to_s)
|
||||
if browser_version_match
|
||||
browser_match = true
|
||||
else
|
||||
browser_match = false
|
||||
end
|
||||
print_more "Browser version check -> (hook) #{browser_version} #{rule.browser_version} (rule) : #{browser_version_match}"
|
||||
end
|
||||
next unless browser_match
|
||||
|
||||
@@ -458,12 +458,13 @@ module BeEF
|
||||
next unless rule.os == 'ALL' || os == rule.os
|
||||
|
||||
# check if the OS versions match
|
||||
if os_version != nil || rule.os_version != 'ALL'
|
||||
if !os_version.nil? || rule.os_version != 'ALL'
|
||||
os_major_version_match = compare_versions(os_ver_hook_maj.to_s, os_ver_rule_cond, os_ver_rule_maj.to_s)
|
||||
os_minor_version_match = compare_versions(os_ver_hook_min.to_s, os_ver_rule_cond, os_ver_rule_min.to_s)
|
||||
else
|
||||
# os_version_match = true if (browser doesn't return an OS version || rule OS version is ALL )
|
||||
os_major_version_match, os_minor_version_match = true, true
|
||||
os_major_version_match = true
|
||||
os_minor_version_match = true
|
||||
end
|
||||
|
||||
os_match = true if os_ver_rule_cond == 'ALL' || (os_major_version_match && os_minor_version_match)
|
||||
@@ -473,14 +474,13 @@ module BeEF
|
||||
print_more "Hooked browser and OS type/version MATCH rule: #{rule.name}."
|
||||
match_rules.push(rule.id)
|
||||
end
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
print_error e.message
|
||||
print_debug e.backtrace.join("\n")
|
||||
end
|
||||
end
|
||||
print_more "Found [#{match_rules.length}/#{rules.length}] ARE rules matching the hooked browser type/version."
|
||||
|
||||
return match_rules
|
||||
match_rules
|
||||
end
|
||||
|
||||
# compare versions
|
||||
@@ -491,7 +491,8 @@ module BeEF
|
||||
return true if cond == '<' && ver_a < ver_b
|
||||
return true if cond == '>=' && ver_a >= ver_b
|
||||
return true if cond == '>' && ver_a > ver_b
|
||||
return false
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,60 +1,59 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
module AutorunEngine
|
||||
|
||||
class Parser
|
||||
|
||||
include Singleton
|
||||
|
||||
def initialize
|
||||
@config = BeEF::Core::Configuration.instance
|
||||
end
|
||||
|
||||
BROWSER = ['FF','C','IE','S','O','ALL']
|
||||
OS = ['Linux','Windows','OSX','Android','iOS','BlackBerry','ALL']
|
||||
VERSION = ['<','<=','==','>=','>','ALL','Vista','XP']
|
||||
CHAIN_MODE = ['sequential','nested-forward']
|
||||
BROWSER = %w[FF C IE S O ALL]
|
||||
OS = %w[Linux Windows OSX Android iOS BlackBerry ALL]
|
||||
VERSION = ['<', '<=', '==', '>=', '>', 'ALL', 'Vista', 'XP']
|
||||
CHAIN_MODE = %w[sequential nested-forward]
|
||||
MAX_VER_LEN = 15
|
||||
# Parse a JSON ARE file and returns an Hash with the value mappings
|
||||
def parse(name,author,browser, browser_version, os, os_version, modules, exec_order, exec_delay, chain_mode)
|
||||
begin
|
||||
def parse(name, author, browser, browser_version, os, os_version, modules, exec_order, exec_delay, chain_mode)
|
||||
success = [true]
|
||||
|
||||
return [false, 'Illegal chain_mode definition'] unless CHAIN_MODE.include?(chain_mode)
|
||||
return [false, 'Illegal rule name'] unless BeEF::Filters.is_non_empty_string?(name)
|
||||
return [false, 'Illegal author name'] unless BeEF::Filters.is_non_empty_string?(author)
|
||||
|
||||
# if multiple browsers were specified, check each browser
|
||||
if browser.kind_of?(Array)
|
||||
if browser.is_a?(Array)
|
||||
browser.each do |b|
|
||||
return [false, 'Illegal browser definition'] unless BROWSER.include?(b)
|
||||
end
|
||||
# else, if only one browser was specified, check browser and browser version
|
||||
else
|
||||
return [false, 'Illegal browser definition'] unless BROWSER.include?(browser)
|
||||
if browser_version != 'ALL'
|
||||
return [false, 'Illegal browser_version definition'] unless
|
||||
VERSION.include?(browser_version[0,2].gsub(/\s+/,'')) &&
|
||||
BeEF::Filters::is_valid_browserversion?(browser_version[2..-1].gsub(/\s+/,'')) && browser_version.length < MAX_VER_LEN
|
||||
|
||||
if browser_version != 'ALL' && !(VERSION.include?(browser_version[0, 2].gsub(/\s+/, '')) &&
|
||||
BeEF::Filters.is_valid_browserversion?(browser_version[2..-1].gsub(/\s+/, '')) && browser_version.length < MAX_VER_LEN)
|
||||
return [false, 'Illegal browser_version definition']
|
||||
end
|
||||
end
|
||||
|
||||
if os_version != 'ALL'
|
||||
return [false, 'Illegal os_version definition'] unless
|
||||
VERSION.include?(os_version[0,2].gsub(/\s+/,'')) &&
|
||||
BeEF::Filters::is_valid_osversion?(os_version[2..-1].gsub(/\s+/,'')) && os_version.length < MAX_VER_LEN
|
||||
if os_version != 'ALL' && !(VERSION.include?(os_version[0, 2].gsub(/\s+/, '')) &&
|
||||
BeEF::Filters.is_valid_osversion?(os_version[2..-1].gsub(/\s+/, '')) && os_version.length < MAX_VER_LEN)
|
||||
return [false, 'Illegal os_version definition']
|
||||
end
|
||||
|
||||
return [false, 'Illegal os definition'] unless OS.include?(os)
|
||||
|
||||
# check if module names, conditions and options are ok
|
||||
modules.each do |cmd_mod|
|
||||
mod = BeEF::Core::Models::CommandModule.where(:name => cmd_mod['name']).first
|
||||
if mod != nil
|
||||
mod = BeEF::Core::Models::CommandModule.where(name: cmd_mod['name']).first
|
||||
if mod.nil?
|
||||
return [false, "The specified module name (#{cmd_mod['name']}) does not exist"]
|
||||
else
|
||||
modk = BeEF::Module.get_key_by_database_id(mod.id)
|
||||
mod_options = BeEF::Module.get_options(modk)
|
||||
|
||||
@@ -67,23 +66,20 @@ module BeEF
|
||||
}) for module (#{cmd_mod['name']}) does not exist"]
|
||||
end
|
||||
end
|
||||
else
|
||||
return [false, "The specified module name (#{cmd_mod['name']}) does not exist"]
|
||||
end
|
||||
end
|
||||
|
||||
exec_order.each{ |order| return [false, 'execution_order values must be Integers'] unless order.integer?}
|
||||
exec_delay.each{ |delay| return [false, 'execution_delay values must be Integers'] unless delay.integer?}
|
||||
exec_order.each { |order| return [false, 'execution_order values must be Integers'] unless order.integer? }
|
||||
exec_delay.each { |delay| return [false, 'execution_delay values must be Integers'] unless delay.integer? }
|
||||
|
||||
return [false, 'execution_order and execution_delay values must be consistent with modules numbers'] unless
|
||||
modules.size == exec_order.size && modules.size == exec_delay.size
|
||||
|
||||
success
|
||||
rescue => e
|
||||
print_error "#{e.message}"
|
||||
print_debug "#{e.backtrace.join("\n")}"
|
||||
return [false, 'Something went wrong.']
|
||||
end
|
||||
rescue StandardError => e
|
||||
print_error e.message.to_s
|
||||
print_debug e.backtrace.join("\n").to_s
|
||||
[false, 'Something went wrong.']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
module AutorunEngine
|
||||
|
||||
class RuleLoader
|
||||
|
||||
include Singleton
|
||||
|
||||
def initialize
|
||||
@@ -18,34 +16,33 @@ module BeEF
|
||||
|
||||
# this expects parsed JSON as input
|
||||
def load(data)
|
||||
begin
|
||||
|
||||
name = data['name']
|
||||
author = data['author']
|
||||
browser = data['browser']||'ALL'
|
||||
browser_version = data['browser_version']||'ALL'
|
||||
os = data['os']||'ALL'
|
||||
os_version = data['os_version']||'ALL'
|
||||
browser = data['browser'] || 'ALL'
|
||||
browser_version = data['browser_version'] || 'ALL'
|
||||
os = data['os'] || 'ALL'
|
||||
os_version = data['os_version'] || 'ALL'
|
||||
modules = data['modules']
|
||||
exec_order = data['execution_order']
|
||||
exec_delay = data['execution_delay']
|
||||
chain_mode = data['chain_mode']
|
||||
|
||||
parser_result = BeEF::Core::AutorunEngine::Parser.instance.parse(
|
||||
name,author,browser,browser_version,os,os_version,modules,exec_order,exec_delay,chain_mode)
|
||||
name, author, browser, browser_version, os, os_version, modules, exec_order, exec_delay, chain_mode
|
||||
)
|
||||
|
||||
if parser_result.length == 1 && parser_result.first
|
||||
print_info "[ARE] Ruleset (#{name}) parsed and stored successfully."
|
||||
if @debug_on
|
||||
print_more "Target Browser: #{browser} (#{browser_version})"
|
||||
print_more "Target OS: #{os} (#{os_version})"
|
||||
print_more "Modules to Trigger:"
|
||||
print_more 'Modules to Trigger:'
|
||||
modules.each do |mod|
|
||||
print_more "(*) Name: #{mod['name']}"
|
||||
print_more "(*) Condition: #{mod['condition']}"
|
||||
print_more "(*) Code: #{mod['code']}"
|
||||
print_more "(*) Options:"
|
||||
mod['options'].each do |key,value|
|
||||
print_more '(*) Options:'
|
||||
mod['options'].each do |key, value|
|
||||
print_more "\t#{key}: (#{value})"
|
||||
end
|
||||
end
|
||||
@@ -53,43 +50,40 @@ module BeEF
|
||||
print_more "Exec delay: #{exec_delay}"
|
||||
end
|
||||
are_rule = BeEF::Core::Models::Rule.new(
|
||||
:name => name,
|
||||
:author => author,
|
||||
:browser => browser,
|
||||
:browser_version => browser_version,
|
||||
:os => os,
|
||||
:os_version => os_version,
|
||||
:modules => modules.to_json,
|
||||
:execution_order => exec_order,
|
||||
:execution_delay => exec_delay,
|
||||
:chain_mode => chain_mode)
|
||||
name: name,
|
||||
author: author,
|
||||
browser: browser,
|
||||
browser_version: browser_version,
|
||||
os: os,
|
||||
os_version: os_version,
|
||||
modules: modules.to_json,
|
||||
execution_order: exec_order,
|
||||
execution_delay: exec_delay,
|
||||
chain_mode: chain_mode
|
||||
)
|
||||
are_rule.save
|
||||
return { 'success' => true, 'rule_id' => are_rule.id}
|
||||
{ 'success' => true, 'rule_id' => are_rule.id }
|
||||
else
|
||||
print_error "[ARE] Ruleset (#{name}): ERROR. " + parser_result.last
|
||||
return { 'success' => false, 'error' => parser_result.last }
|
||||
{ 'success' => false, 'error' => parser_result.last }
|
||||
end
|
||||
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
err = 'Malformed JSON ruleset.'
|
||||
print_error "[ARE] Ruleset (#{name}): ERROR. #{e} #{e.backtrace}"
|
||||
return { 'success' => false, 'error' => err }
|
||||
end
|
||||
{ 'success' => false, 'error' => err }
|
||||
end
|
||||
|
||||
def load_file(json_rule_path)
|
||||
begin
|
||||
rule_file = File.open(json_rule_path, 'r:UTF-8', &:read)
|
||||
self.load JSON.parse(rule_file)
|
||||
rescue => e
|
||||
print_error "[ARE] Failed to load ruleset from #{json_rule_path}"
|
||||
end
|
||||
rescue StandardError => e
|
||||
print_error "[ARE] Failed to load ruleset from #{json_rule_path}: #{e.message}"
|
||||
end
|
||||
|
||||
def load_directory
|
||||
Dir.glob("#{$root_dir}/arerules/enabled/**/*.json") do |rule|
|
||||
print_debug "[ARE] Processing rule: #{rule}"
|
||||
self.load_file rule
|
||||
load_file rule
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
@@ -39,7 +39,7 @@ if(typeof beef === 'undefined' && typeof window.beef === 'undefined') {
|
||||
*/
|
||||
debug: function(msg) {
|
||||
isDebug = '<%= @client_debug %>'
|
||||
if (typeof console == "object" && typeof console.log == "function" && isDebug.localeCompare("true")) {
|
||||
if (typeof console == "object" && typeof console.log == "function" && isDebug === 'true') {
|
||||
var currentdate = new Date();
|
||||
var pad = function(n){return ("0" + n).slice(-2);}
|
||||
var datetime = currentdate.getFullYear() + "-"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -16,10 +16,10 @@ var warnedAbout = {};
|
||||
jQuery.migrateWarnings = [];
|
||||
|
||||
// Set to true to prevent console output; migrateWarnings still maintained
|
||||
// jQuery.migrateMute = false;
|
||||
jQuery.migrateMute = true;
|
||||
|
||||
// Show a message on the console so devs know we're active
|
||||
if ( window.console && window.console.log ) {
|
||||
if (window.console && window.console.log && !jQuery.migrateMute) {
|
||||
window.console.log( "JQMIGRATE: Migrate is installed" +
|
||||
( jQuery.migrateMute ? "" : " with logging active" ) +
|
||||
", version " + jQuery.migrateVersion );
|
||||
@@ -27,7 +27,7 @@ if ( window.console && window.console.log ) {
|
||||
|
||||
// Set to false to disable traces that appear with warnings
|
||||
if ( jQuery.migrateTrace === undefined ) {
|
||||
jQuery.migrateTrace = true;
|
||||
jQuery.migrateTrace = false;
|
||||
}
|
||||
|
||||
// Forget any warnings we've already given; public
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
/*!
|
||||
* Platform.js
|
||||
* Copyright 2014-2018 Benjamin Tan
|
||||
* Copyright 2014-2020 Benjamin Tan
|
||||
* Copyright 2011-2013 John-David Dalton
|
||||
* Available under MIT license
|
||||
* @namespace platform
|
||||
*/
|
||||
;(function() {
|
||||
'use strict';
|
||||
@@ -340,7 +339,7 @@
|
||||
|
||||
/* Detectable layout engines (order is important). */
|
||||
var layout = getLayout([
|
||||
{ 'label': 'EdgeHTML', 'pattern': '(?:Edge|EdgA|EdgiOS)' },
|
||||
{ 'label': 'EdgeHTML', 'pattern': 'Edge' },
|
||||
'Trident',
|
||||
{ 'label': 'WebKit', 'pattern': 'AppleWebKit' },
|
||||
'iCab',
|
||||
@@ -370,7 +369,7 @@
|
||||
'Konqueror',
|
||||
'Lunascape',
|
||||
'Maxthon',
|
||||
{ 'label': 'Microsoft Edge', 'pattern': '(?:Edge|EdgA|EdgiOS)' },
|
||||
{ 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' },
|
||||
'Midori',
|
||||
'Nook Browser',
|
||||
'PaleMoon',
|
||||
@@ -386,13 +385,18 @@
|
||||
{ 'label': 'SRWare Iron', 'pattern': 'Iron' },
|
||||
'Sunrise',
|
||||
'Swiftfox',
|
||||
'Vivaldi',
|
||||
'Waterfox',
|
||||
'WebPositive',
|
||||
{ 'label': 'Yandex Browser', 'pattern': 'YaBrowser' },
|
||||
{ 'label': 'UC Browser', 'pattern': 'UCBrowser' },
|
||||
'Opera Mini',
|
||||
{ 'label': 'Opera Mini', 'pattern': 'OPiOS' },
|
||||
'Opera',
|
||||
{ 'label': 'Opera', 'pattern': 'OPR' },
|
||||
'Chromium',
|
||||
'Chrome',
|
||||
{ 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' },
|
||||
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
|
||||
{ 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
|
||||
{ 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
|
||||
@@ -438,6 +442,7 @@
|
||||
/* Detectable manufacturers. */
|
||||
var manufacturer = getManufacturer({
|
||||
'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
|
||||
'Alcatel': {},
|
||||
'Archos': {},
|
||||
'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
|
||||
'Asus': { 'Transformer': 1 },
|
||||
@@ -446,22 +451,28 @@
|
||||
'Google': { 'Google TV': 1, 'Nexus': 1 },
|
||||
'HP': { 'TouchPad': 1 },
|
||||
'HTC': {},
|
||||
'Huawei': {},
|
||||
'Lenovo': {},
|
||||
'LG': {},
|
||||
'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
|
||||
'Motorola': { 'Xoom': 1 },
|
||||
'Nintendo': { 'Wii U': 1, 'Wii': 1 },
|
||||
'Nokia': { 'Lumia': 1 },
|
||||
'Oppo': {},
|
||||
'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
|
||||
'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 }
|
||||
'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 },
|
||||
'Xiaomi': { 'Mi': 1, 'Redmi': 1 }
|
||||
});
|
||||
|
||||
/* Detectable operating systems (order is important). */
|
||||
var os = getOS([
|
||||
'Windows Phone',
|
||||
'KaiOS',
|
||||
'Android',
|
||||
'CentOS',
|
||||
{ 'label': 'Chrome OS', 'pattern': 'CrOS' },
|
||||
'Debian',
|
||||
{ 'label': 'DragonFly BSD', 'pattern': 'DragonFly' },
|
||||
'Fedora',
|
||||
'FreeBSD',
|
||||
'Gentoo',
|
||||
@@ -617,9 +628,26 @@
|
||||
// Convert layout to an array so we can add extra details.
|
||||
layout && (layout = [layout]);
|
||||
|
||||
// Detect Android products.
|
||||
// Browsers on Android devices typically provide their product IDS after "Android;"
|
||||
// up to "Build" or ") AppleWebKit".
|
||||
// Example:
|
||||
// "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
|
||||
// (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
|
||||
if (/\bAndroid\b/.test(os) && !product &&
|
||||
(data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
|
||||
product = trim(data[1])
|
||||
// Replace any language codes (eg. "en-US").
|
||||
.replace(/^[a-z]{2}-[a-z]{2};\s*/i, '')
|
||||
|| null;
|
||||
}
|
||||
// Detect product names that contain their manufacturer's name.
|
||||
if (manufacturer && !product) {
|
||||
product = getProduct([manufacturer]);
|
||||
} else if (manufacturer && product) {
|
||||
product = product
|
||||
.replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ')
|
||||
.replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
|
||||
}
|
||||
// Clean up Google TV.
|
||||
if ((data = /\bGoogle TV\b/.exec(product))) {
|
||||
@@ -647,7 +675,7 @@
|
||||
: '');
|
||||
}
|
||||
// Detect Kubuntu.
|
||||
else if (name == 'Konqueror' && !/buntu/i.test(os)) {
|
||||
else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
|
||||
os = 'Kubuntu';
|
||||
}
|
||||
// Detect Android browsers.
|
||||
@@ -667,6 +695,10 @@
|
||||
description.unshift('accelerated');
|
||||
}
|
||||
}
|
||||
// Detect UC Browser speed mode.
|
||||
else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
|
||||
description.push('speed mode');
|
||||
}
|
||||
// Detect PaleMoon identifying as Firefox.
|
||||
else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
|
||||
description.push('identifying as Firefox ' + data[1]);
|
||||
@@ -696,7 +728,7 @@
|
||||
// Detect non-Opera (Presto-based) versions (order is important).
|
||||
if (!version) {
|
||||
version = getVersion([
|
||||
'(?:Cloud9|CriOS|CrMo|Edge|EdgA|EdgiOS|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))',
|
||||
'(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)',
|
||||
'Version',
|
||||
qualify(name),
|
||||
'(?:Firefox|Minefield|NetFront)'
|
||||
@@ -824,7 +856,7 @@
|
||||
(prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
|
||||
}
|
||||
// Detect Firefox Mobile.
|
||||
if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS)\b/.test(os)) {
|
||||
if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
|
||||
name = 'Firefox Mobile';
|
||||
}
|
||||
// Obscure Maxthon's unreliable version.
|
||||
@@ -920,7 +952,7 @@
|
||||
version = null;
|
||||
}
|
||||
// Use the full Chrome version when available.
|
||||
data[1] = (/\bChrome\/([\d.]+)/i.exec(ua) || 0)[1];
|
||||
data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
|
||||
// Detect Blink layout engine.
|
||||
if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
|
||||
layout = ['Blink'];
|
||||
@@ -929,7 +961,7 @@
|
||||
// http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
|
||||
if (!useFeatures || (!likeChrome && !data[1])) {
|
||||
layout && (layout[1] = 'like Safari');
|
||||
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : '8');
|
||||
data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12');
|
||||
} else {
|
||||
layout && (layout[1] = 'like Chrome');
|
||||
data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
|
||||
@@ -939,6 +971,8 @@
|
||||
// Obscure version for some Safari 1-2 releases.
|
||||
if (name == 'Safari' && (!version || parseInt(version) > 45)) {
|
||||
version = data;
|
||||
} else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
|
||||
description.unshift('headless');
|
||||
}
|
||||
}
|
||||
// Detect Opera desktop modes.
|
||||
@@ -966,16 +1000,24 @@
|
||||
os = null;
|
||||
}
|
||||
}
|
||||
// Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
|
||||
else if (/\bSRWare Iron\b/.test(name) && !version) {
|
||||
version = getVersion('Chrome');
|
||||
}
|
||||
// Strip incorrect OS versions.
|
||||
if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
|
||||
ua.indexOf('/' + data + '-') > -1) {
|
||||
os = trim(os.replace(data, ''));
|
||||
}
|
||||
// Ensure OS does not include the browser name.
|
||||
if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
|
||||
os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
|
||||
}
|
||||
// Add layout engine.
|
||||
if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
|
||||
/Browser|Lunascape|Maxthon/.test(name) ||
|
||||
name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
|
||||
/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(name) && layout[1])) {
|
||||
/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) {
|
||||
// Don't add layout details to description if they are falsey.
|
||||
(data = layout[layout.length - 1]) && description.push(data);
|
||||
}
|
||||
@@ -1033,7 +1075,7 @@
|
||||
/**
|
||||
* The platform object.
|
||||
*
|
||||
* @memberof platform
|
||||
* @name platform
|
||||
* @type Object
|
||||
*/
|
||||
var platform = {};
|
||||
@@ -1144,8 +1186,8 @@
|
||||
*
|
||||
* Common values include:
|
||||
* "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
|
||||
* "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE",
|
||||
* "Android", "iOS" and "Windows Phone"
|
||||
* "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
|
||||
* "SuSE", "Android", "iOS" and "Windows Phone"
|
||||
*
|
||||
* @memberOf platform.os
|
||||
* @type string|null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
// Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
// Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
// See the file 'doc/COPYING' for copying permission
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -42,7 +42,8 @@ module BeEF
|
||||
# Two instances of this object are created during the execution of command module.
|
||||
#
|
||||
class Command
|
||||
attr_reader :datastore, :path, :default_command_url, :beefjs_components, :friendlyname
|
||||
attr_reader :datastore, :path, :default_command_url, :beefjs_components, :friendlyname,
|
||||
:config
|
||||
attr_accessor :zombie, :command_id, :session_id
|
||||
|
||||
include BeEF::Core::CommandUtils
|
||||
@@ -55,15 +56,15 @@ module BeEF
|
||||
# @param [String] key command module key
|
||||
#
|
||||
def initialize(key)
|
||||
config = BeEF::Core::Configuration.instance
|
||||
@config = BeEF::Core::Configuration.instance
|
||||
|
||||
@key = key
|
||||
@datastore = {}
|
||||
@friendlyname = config.get("beef.module.#{key}.name")
|
||||
@friendlyname = @config.get("beef.module.#{key}.name")
|
||||
@output = ''
|
||||
@path = config.get("beef.module.#{key}.path")
|
||||
@path = @config.get("beef.module.#{key}.path")
|
||||
@default_command_url = config.get("beef.module.#{key}.mount")
|
||||
@id = config.get("beef.module.#{key}.db.id")
|
||||
@id = @config.get("beef.module.#{key}.db.id")
|
||||
@auto_update_zombie = false
|
||||
@results = {}
|
||||
@beefjs_components = {}
|
||||
@@ -99,7 +100,7 @@ module BeEF
|
||||
# Returns information about the command in a JSON format.
|
||||
# @return [String] JSON formatted string
|
||||
#
|
||||
def to_json
|
||||
def to_json(*_args)
|
||||
{
|
||||
'Name' => @friendlyname,
|
||||
'Description' => BeEF::Core::Configuration.instance.get("beef.module.#{@key}.description"),
|
||||
@@ -115,7 +116,7 @@ module BeEF
|
||||
#
|
||||
def build_datastore(data)
|
||||
@datastore = JSON.parse data
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
print_error "Could not build datastore: #{e.message}"
|
||||
end
|
||||
|
||||
@@ -125,7 +126,7 @@ module BeEF
|
||||
# @param [Hash] http_headers HTTP headers
|
||||
#
|
||||
def build_callback_datastore(result, command_id, beefhook, http_params, http_headers)
|
||||
@datastore = {'http_headers' => {}} # init the datastore
|
||||
@datastore = { 'http_headers' => {} } # init the datastore
|
||||
|
||||
if !http_params.nil? && !http_headers.nil?
|
||||
# get, check and add the http_params to the datastore
|
||||
@@ -183,7 +184,7 @@ module BeEF
|
||||
|
||||
@eruby = Erubis::FastEruby.new(File.read(f))
|
||||
|
||||
#data = BeEF::Core::Configuration.instance.get "beef.module.#{@key}"
|
||||
# data = BeEF::Core::Configuration.instance.get "beef.module.#{@key}"
|
||||
cc = BeEF::Core::CommandContext.new
|
||||
cc['command_url'] = @default_command_url
|
||||
cc['command_id'] = @command_id
|
||||
@@ -225,7 +226,7 @@ module BeEF
|
||||
def use(component)
|
||||
return if @beefjs_components.include? component
|
||||
|
||||
component_path = '/'+component
|
||||
component_path = '/' + component
|
||||
component_path.gsub!(/beef./, '')
|
||||
component_path.gsub!(/\./, '/')
|
||||
component_path.replace "#{$root_dir}/core/main/client/#{component_path}.js"
|
||||
@@ -237,8 +238,9 @@ module BeEF
|
||||
|
||||
# @todo TODO Document
|
||||
def oc_value(name)
|
||||
option = BeEF::Core::Models::OptionCache.where(:name => name).first
|
||||
option = BeEF::Core::Models::OptionCache.where(name: name).first
|
||||
return nil unless option
|
||||
|
||||
option.value
|
||||
end
|
||||
|
||||
@@ -249,8 +251,6 @@ module BeEF
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@use_template
|
||||
@eruby
|
||||
@update_zombie
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
@@ -24,14 +24,15 @@ module BeEF
|
||||
raise TypeError, "Configuration file '#{config}' cannot be found" unless File.exist? config
|
||||
|
||||
begin
|
||||
#open base config
|
||||
# open base config
|
||||
@config = load(config)
|
||||
# set default value if key? does not exist
|
||||
@config.default = nil
|
||||
@@config = config
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
print_error "Fatal Error: cannot load configuration file '#{config}' : #{e.message}"
|
||||
print_error e.backtrace
|
||||
print_more e.backtrace
|
||||
exit(1)
|
||||
end
|
||||
|
||||
@@instance = self
|
||||
@@ -41,12 +42,8 @@ module BeEF
|
||||
# @param [String] file YAML file to be loaded
|
||||
# @return [Hash] YAML formatted hash
|
||||
def load(file)
|
||||
return nil unless File.exist? file
|
||||
raw = File.read file
|
||||
YAML.safe_load raw
|
||||
rescue => e
|
||||
print_debug "Unable to load configuration file '#{file}' : #{e.message}"
|
||||
print_error e.backtrace
|
||||
return nil unless File.exist?(file)
|
||||
YAML.safe_load(File.binread(file))
|
||||
end
|
||||
|
||||
#
|
||||
@@ -73,9 +70,122 @@ module BeEF
|
||||
return
|
||||
end
|
||||
|
||||
return unless validate_public_config_variable?(@config)
|
||||
|
||||
if @config['beef']['http']['public_port']
|
||||
print_error 'Config path beef.http.public_port is deprecated.'
|
||||
print_error 'Please use the new format for public variables found'
|
||||
print_error 'https://github.com/beefproject/beef/wiki/Configuration#web-server-configuration'
|
||||
return
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the configuration value for the http server host
|
||||
# If nothing is set it should default to 0.0.0.0 (all interfaces)
|
||||
def local_host
|
||||
get('beef.http.host') || '0.0.0.0'
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the configuration value for the http server port
|
||||
# If nothing is set it should default to 3000
|
||||
def local_port
|
||||
get('beef.http.port') || '3000'
|
||||
end
|
||||
|
||||
#
|
||||
# Return the local protocol
|
||||
# if nothing is set default to http
|
||||
def local_proto
|
||||
local_https_enabled ? 'https' : 'http'
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the configuration value for the local https enabled
|
||||
# If nothing is set it should default to false
|
||||
def local_https_enabled
|
||||
get('beef.http.https.enable') || false
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the configuration value for the http server host
|
||||
def public_host
|
||||
get('beef.http.public.host')
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the beef host which is used by external resources
|
||||
# e.g. hooked browsers
|
||||
def beef_host
|
||||
public_host || local_host
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the beef port which is used by external resource
|
||||
# e.g. hooked browsers
|
||||
def beef_port
|
||||
public_port || local_port
|
||||
end
|
||||
|
||||
def public_enabled?
|
||||
!get('beef.http.public.host').nil?
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the beef protocol that is used by external resources
|
||||
# e.g. hooked browsers
|
||||
def beef_proto
|
||||
if public_enabled? && public_https_enabled?
|
||||
'https'
|
||||
elsif public_enabled? && !public_https_enabled?
|
||||
'http'
|
||||
elsif !public_enabled?
|
||||
local_proto
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the beef scheme://host:port for external resources
|
||||
# e.g. hooked browsers
|
||||
def beef_url_str
|
||||
"#{beef_proto}://#{beef_host}:#{beef_port}"
|
||||
end
|
||||
|
||||
# Returns the hool path value stored in the config file
|
||||
#
|
||||
# @return [String] hook file path
|
||||
def hook_file_path
|
||||
get('beef.http.hook_file') || '/hook.js'
|
||||
end
|
||||
|
||||
# Returns the url to the hook file
|
||||
#
|
||||
# @return [String] the url string
|
||||
def hook_url
|
||||
"#{beef_url_str}#{hook_file_path}"
|
||||
end
|
||||
|
||||
# Returns the configuration value for the http server port
|
||||
# If nothing is set it should default to 3000
|
||||
def public_port
|
||||
return get('beef.http.public.port') unless get('beef.http.public.port').nil?
|
||||
|
||||
return '443' if public_https_enabled?
|
||||
return '80' unless public_host.nil?
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the configuration value for the local https enabled
|
||||
# If nothing is set it should default to false
|
||||
def public_https_enabled?
|
||||
get('beef.http.public.https') || false
|
||||
end
|
||||
|
||||
#
|
||||
# Returns the value of a selected key in the configuration file.
|
||||
# @param [String] key Key of configuration item
|
||||
@@ -88,6 +198,7 @@ module BeEF
|
||||
hash[k]
|
||||
end
|
||||
return nil if subhash.nil?
|
||||
|
||||
subhash.key?(lastkey) ? subhash[lastkey] : nil
|
||||
end
|
||||
|
||||
@@ -102,7 +213,7 @@ module BeEF
|
||||
return false if subkeys.empty?
|
||||
|
||||
hash = { subkeys.shift.to_s => value }
|
||||
subkeys.each { |v| hash = {v.to_s => hash} }
|
||||
subkeys.each { |v| hash = { v.to_s => hash } }
|
||||
@config = @config.deep_merge hash
|
||||
true
|
||||
end
|
||||
@@ -118,7 +229,7 @@ module BeEF
|
||||
|
||||
lastkey = subkeys.pop
|
||||
hash = @config
|
||||
subkeys.each {|v| hash = hash[v] }
|
||||
subkeys.each { |v| hash = hash[v] }
|
||||
hash.delete(lastkey).nil? ? false : true
|
||||
end
|
||||
|
||||
@@ -145,7 +256,7 @@ module BeEF
|
||||
def load_modules_config
|
||||
set('beef.module', {})
|
||||
# support nested sub-categories, like browser/hooked_domain/ajax_fingerprint
|
||||
module_configs = File.join("#{$root_dir}/modules/**", "config.yaml")
|
||||
module_configs = File.join("#{$root_dir}/modules/**", 'config.yaml')
|
||||
Dir.glob(module_configs) do |cf|
|
||||
y = load(cf)
|
||||
if y.nil?
|
||||
@@ -163,6 +274,18 @@ module BeEF
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_public_config_variable?(config)
|
||||
return true if config['beef']['http']['public'].is_a?(Hash) ||
|
||||
config['beef']['http']['public'].is_a?(NilClass)
|
||||
|
||||
print_error 'Config path beef.http.public is deprecated.'
|
||||
print_error 'Please use the new format for public variables found'
|
||||
print_error 'https://github.com/beefproject/beef/wiki/Configuration#web-server-configuration'
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#
|
||||
# Copyright (c) 2006-2021 Wade Alcorn - wade@bindshell.net
|
||||
# Copyright (c) 2006-2022 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
module BeEF
|
||||
module Core
|
||||
module Console
|
||||
|
||||
module Banners
|
||||
module Core
|
||||
module Console
|
||||
module Banners
|
||||
class << self
|
||||
attr_accessor :interfaces
|
||||
|
||||
@@ -15,7 +14,7 @@ module Banners
|
||||
# Prints BeEF's ascii art
|
||||
#
|
||||
def print_ascii_art
|
||||
if File.exists?('core/main/console/beef.ascii')
|
||||
if File.exist?('core/main/console/beef.ascii')
|
||||
File.open('core/main/console/beef.ascii', 'r') do |f|
|
||||
while line = f.gets
|
||||
puts line
|
||||
@@ -36,7 +35,7 @@ module Banners
|
||||
data += "Blog: http://blog.beefproject.com\n"
|
||||
data += "Wiki: https://github.com/beefproject/beef/wiki\n"
|
||||
print_more data
|
||||
print_info "Project Creator: " + "Wade Alcorn".red + " (@WadeAlcorn)"
|
||||
print_info 'Project Creator: ' + 'Wade Alcorn'.red + ' (@WadeAlcorn)'
|
||||
end
|
||||
|
||||
#
|
||||
@@ -48,12 +47,13 @@ module Banners
|
||||
def print_network_interfaces_count
|
||||
# get the configuration information
|
||||
configuration = BeEF::Core::Configuration.instance
|
||||
beef_host = configuration.get('beef.http.host')
|
||||
# local host
|
||||
beef_host = configuration.local_host
|
||||
|
||||
# create an array of the interfaces the framework is listening on
|
||||
if beef_host == '0.0.0.0' # the framework will listen on all interfaces
|
||||
interfaces = Socket.ip_address_list.map {|x| x.ip_address if x.ipv4?}
|
||||
interfaces.delete_if {|x| x.nil?} # remove if the entry is nill
|
||||
interfaces = Socket.ip_address_list.map { |x| x.ip_address if x.ipv4? }
|
||||
interfaces.delete_if { |x| x.nil? } # remove if the entry is nill
|
||||
else # the framework will listen on only one interface
|
||||
interfaces = [beef_host]
|
||||
end
|
||||
@@ -77,27 +77,26 @@ module Banners
|
||||
#
|
||||
def print_network_interfaces_routes
|
||||
configuration = BeEF::Core::Configuration.instance
|
||||
proto = configuration.get("beef.http.https.enable") == true ? 'https' : 'http'
|
||||
hook_file = configuration.get("beef.http.hook_file")
|
||||
admin_ui = configuration.get("beef.extension.admin_ui.enable") ? true : false
|
||||
admin_ui_path = configuration.get("beef.extension.admin_ui.base_path")
|
||||
# local config settings
|
||||
proto = configuration.local_proto
|
||||
hook_file = configuration.hook_file_path
|
||||
admin_ui = configuration.get('beef.extension.admin_ui.enable') ? true : false
|
||||
admin_ui_path = configuration.get('beef.extension.admin_ui.base_path')
|
||||
|
||||
# display the hook URL and Admin UI URL on each interface from the interfaces array
|
||||
self.interfaces.map do |host|
|
||||
interfaces.map do |host|
|
||||
print_info "running on network interface: #{host}"
|
||||
port = configuration.get("beef.http.port")
|
||||
port = configuration.local_port
|
||||
data = "Hook URL: #{proto}://#{host}:#{port}#{hook_file}\n"
|
||||
data += "UI URL: #{proto}://#{host}:#{port}#{admin_ui_path}/panel\n" if admin_ui
|
||||
print_more data
|
||||
end
|
||||
|
||||
# display the public hook URL and Admin UI URL
|
||||
if configuration.get("beef.http.public")
|
||||
host = configuration.get('beef.http.public')
|
||||
port = configuration.get("beef.http.public_port") || configuration.get('beef.http.port')
|
||||
if configuration.public_enabled?
|
||||
print_info 'Public:'
|
||||
data = "Hook URL: #{proto}://#{host}:#{port}#{hook_file}\n"
|
||||
data += "UI URL: #{proto}://#{host}:#{port}#{admin_ui_path}/panel\n" if admin_ui
|
||||
data = "Hook URL: #{configuration.hook_url}\n"
|
||||
data += "UI URL: #{configuration.beef_url_str}#{admin_ui_path}/panel\n" if admin_ui
|
||||
print_more data
|
||||
end
|
||||
end
|
||||
@@ -110,7 +109,7 @@ module Banners
|
||||
print_info "#{extensions.size} extensions enabled:"
|
||||
output = ''
|
||||
|
||||
extensions.each do |key, ext|
|
||||
extensions.each do |_key, ext|
|
||||
output << "#{ext['name']}\n"
|
||||
end
|
||||
|
||||
@@ -121,7 +120,7 @@ module Banners
|
||||
# Print loaded modules
|
||||
#
|
||||
def print_loaded_modules
|
||||
print_info "#{BeEF::Modules::get_enabled.count} modules enabled."
|
||||
print_info "#{BeEF::Modules.get_enabled.count} modules enabled."
|
||||
end
|
||||
|
||||
#
|
||||
@@ -130,14 +129,13 @@ module Banners
|
||||
def print_websocket_servers
|
||||
config = BeEF::Core::Configuration.instance
|
||||
ws_poll_timeout = config.get('beef.http.websocket.ws_poll_timeout')
|
||||
print_info "Starting WebSocket server ws://#{config.get('beef.http.host')}:#{config.get("beef.http.websocket.port").to_i} [timer: #{ws_poll_timeout}]"
|
||||
if config.get("beef.http.websocket.secure")
|
||||
print_info "Starting WebSocketSecure server on wss://[#{config.get('beef.http.host')}:#{config.get("beef.http.websocket.secure_port").to_i} [timer: #{ws_poll_timeout}]"
|
||||
print_info "Starting WebSocket server ws://#{config.beef_host}:#{config.get('beef.http.websocket.port').to_i} [timer: #{ws_poll_timeout}]"
|
||||
if config.get('beef.http.websocket.secure')
|
||||
print_info "Starting WebSocketSecure server on wss://[#{config.beef_host}:#{config.get('beef.http.websocket.secure_port').to_i} [timer: #{ws_poll_timeout}]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user