Path: blob/master/spec/modules/payloads/singles/windows/aarch64/exec_spec.rb
20087 views
require 'rspec'12RSpec.describe 'singles/windows/aarch64/exec' do3include_context 'Msf::Simple::Framework#modules loading'45let(:subject) do6load_and_create_module(7module_type: 'payload',8reference_name: 'windows/aarch64/exec',9ancestor_reference_names: [10'singles/windows/aarch64/exec'11]12)13end14let(:cmd) { nil }15let(:datastore_values) { { 'CMD' => cmd } }1617before(:each) do18subject.datastore.merge!(datastore_values)19end2021describe '#generate' do22def expect_valid_compilation23allow(subject).to receive(:compile_aarch64).and_wrap_original do |original, asm|24compiled_asm = original.call asm25expect(compiled_asm.length).to be > 026'mock-aarch64-compiled'27end28expect(subject.generate).to include 'mock-aarch64-compiled'29end3031context 'when the CMD is notepad.exe' do32let(:cmd) { 'notepad.exe' }3334it 'compiles successfully' do35expect_valid_compilation36end37end38end39end404142