Add utility_spec.rb

GSoC/Meterpreter_Web_Console
Wei Chen 2018-06-27 13:49:45 -05:00
parent 752192bfad
commit bc0b42c55b
1 changed files with 32 additions and 0 deletions

View File

@ -4,12 +4,44 @@ require 'metasploit/framework/obfuscation/crandomizer/utility'
RSpec.describe Metasploit::Framework::Obfuscation::CRandomizer::Utility do RSpec.describe Metasploit::Framework::Obfuscation::CRandomizer::Utility do
describe '#self.rand_int' do describe '#self.rand_int' do
it 'returns an integer' do
int = Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int
expect(int.class).to eq(Integer)
end
it 'returns a random integer' do
int_1 = Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int
int_2 = Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_int
expect(int_2).not_to eq(int_1)
end
end end
describe '#self.rand_string' do describe '#self.rand_string' do
it 'returns a string' do
s = Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_string
expect(s.class).to eq(String)
end
it 'returns a random string' do
s_1 = Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_string
s_2 = Metasploit::Framework::Obfuscation::CRandomizer::Utility.rand_string
expect(s_2).not_to eq(s_1)
end
end end
describe '#self.parse' do describe '#self.parse' do
let(:c_code) {
%Q|
int main() {
const char* s = "This is a test";
return 0;
}|
}
it 'returns a Metasploit::C::Parser object' do
p = Metasploit::Framework::Obfuscation::CRandomizer::Utility.parse(c_code)
expect(p.class).to eq(Metasm::C::Parser)
end
end end
end end