mirror of
https://github.com/beefproject/beef
synced 2026-06-08 13:15:56 +00:00
TEST: modules/chrome_extensions specs
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - https://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative '../../../../modules/chrome_extensions/execute_tabs/module'
|
||||
|
||||
RSpec.describe Execute_tabs do
|
||||
describe '.options' do
|
||||
it 'returns url and theJS options' do
|
||||
opts = described_class.options
|
||||
expect(opts).to be_an(Array)
|
||||
expect(opts.map { |o| o['name'] }).to include('url', 'theJS')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#post_execute' do
|
||||
it 'saves Return from datastore' do
|
||||
instance = build_command_instance(described_class, 'return' => 'executed')
|
||||
results = run_post_execute(instance)
|
||||
expect(results).to eq('Return' => 'executed')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - https://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative '../../../../modules/chrome_extensions/get_all_cookies/module'
|
||||
|
||||
RSpec.describe Get_all_cookies do
|
||||
describe '.options' do
|
||||
it 'returns url option' do
|
||||
opts = described_class.options
|
||||
expect(opts).to be_an(Array)
|
||||
expect(opts.first).to include('name' => 'url', 'ui_label' => 'Domain (e.g. http://facebook.com)')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#post_execute' do
|
||||
it 'saves Return from datastore' do
|
||||
instance = build_command_instance(described_class, 'return' => 'cookies data')
|
||||
results = run_post_execute(instance)
|
||||
expect(results).to eq('Return' => 'cookies data')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - https://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative '../../../../modules/chrome_extensions/grab_google_contacts/module'
|
||||
|
||||
RSpec.describe Grab_google_contacts do
|
||||
describe '#post_execute' do
|
||||
it 'saves Return from datastore' do
|
||||
instance = build_command_instance(described_class, 'return' => 'contacts data')
|
||||
results = run_post_execute(instance)
|
||||
expect(results).to eq('Return' => 'contacts data')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - https://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative '../../../../modules/chrome_extensions/inject_beef/module'
|
||||
|
||||
RSpec.describe Inject_beef do
|
||||
describe '#post_execute' do
|
||||
it 'saves Return from datastore' do
|
||||
instance = build_command_instance(described_class, 'return' => 'injected')
|
||||
results = run_post_execute(instance)
|
||||
expect(results).to eq('Return' => 'injected')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - https://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative '../../../../modules/chrome_extensions/screenshot/module'
|
||||
|
||||
RSpec.describe Screenshot do
|
||||
describe '#post_execute' do
|
||||
it 'saves Return from datastore' do
|
||||
instance = build_command_instance(described_class, 'return' => 'screenshot data')
|
||||
results = run_post_execute(instance)
|
||||
expect(results).to eq('Return' => 'screenshot data')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Copyright (c) 2006-2026 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - https://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
|
||||
require_relative '../../../spec_helper'
|
||||
require_relative '../../../../modules/chrome_extensions/send_gvoice_sms/module'
|
||||
|
||||
RSpec.describe Send_gvoice_sms do
|
||||
describe '.options' do
|
||||
it 'returns to and message options' do
|
||||
opts = described_class.options
|
||||
expect(opts).to be_an(Array)
|
||||
expect(opts.map { |o| o['name'] }).to include('to', 'message')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#post_execute' do
|
||||
it 'saves To, Message, Status from datastore' do
|
||||
instance = build_command_instance(described_class,
|
||||
'to' => '1234567890',
|
||||
'message' => 'Hello',
|
||||
'status' => 'sent')
|
||||
results = run_post_execute(instance)
|
||||
expect(results).to include('To' => '1234567890', 'Message' => 'Hello', 'Status' => 'sent')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user