Land #3663 - Add specs for Rex::Exploitation::EncryptJS

bug/bundler_fix
sinn3r 2014-08-19 13:08:14 -05:00
commit 7bf637716a
No known key found for this signature in database
GPG Key ID: 2384DB4EF06F730B
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# -*- coding:binary -*-
require 'spec_helper'
require 'rex/exploitation/encryptjs'
describe Rex::Exploitation::EncryptJS do
let(:code) { "var test = 'metasploit';" }
let(:key) { 'secret' }
let(:signature) { 'metasploit' }
let(:loader_signature) { 'location.search.substring(1);' }
let(:loader_key_words) { ['exploit', 'encoded', 'pass', 'decoded'] }
describe ".encrypt" do
it "returns an String" do
expect(Rex::Exploitation::EncryptJS.encrypt(code, key)).to be_an(String)
end
it "returns the JavaScript loader code" do
expect(Rex::Exploitation::EncryptJS.encrypt(code, key)).to include(loader_signature)
end
it "encrypts the code" do
expect(Rex::Exploitation::EncryptJS.encrypt(code, key)).to_not include(signature)
end
it "obfuscates the loader" do
loader_key_words.each do |key_word|
expect(Rex::Exploitation::EncryptJS.encrypt(code, key)).to_not include(key_word)
end
end
end
end