Add rspec for outputdebugstring and correct a few things

GSoC/Meterpreter_Web_Console
Wei Chen 2018-06-28 21:08:15 -05:00
parent 03c3e08167
commit 5c86b836c4
4 changed files with 30 additions and 4 deletions

View File

@ -10,7 +10,7 @@ module Metasploit
class Malloc < Base
def initialize
super
@dep = ['stdlib.h']
@dep = ['malloc']
end
def stub

View File

@ -6,7 +6,7 @@ RSpec.describe Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Int
described_class.new
end
describe '#if_stub' do
describe '#stub' do
it 'is a string' do
expect(subject.send(:stub).class).to be(String)
end

View File

@ -19,8 +19,8 @@ RSpec.describe Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::Mal
expect(subject.send(:stub)).to match(/void stub()/)
end
it 'depends on stdlib.h' do
expect(subject.dep).to eq(['stdlib.h'])
it 'depends on malloc' do
expect(subject.dep).to eq(['malloc'])
end
end
end

View File

@ -0,0 +1,26 @@
require 'metasploit/framework/obfuscation/crandomizer/code_factory'
RSpec.describe Metasploit::Framework::Obfuscation::CRandomizer::CodeFactory::OutputDebugString do
subject(:int_assignments) do
described_class.new
end
describe '#outputdebugstring_1' do
it 'is a string' do
expect(subject.send(:outputdebugstring_1).class).to be(String)
end
it 'has an OutputDebugString' do
expect(subject.send(:outputdebugstring_1)).to match(/OutputDebugString\(.+\)/)
end
it 'has a stub() function' do
expect(subject.send(:outputdebugstring_1)).to match(/void stub()/)
end
it 'depends on stdlib.h' do
expect(subject.dep).to eq(['OutputDebugString'])
end
end
end