metasploit-framework/lib/msf/core/exploit/jsobfu.rb

31 lines
826 B
Ruby
Raw Normal View History

2014-09-21 05:39:04 +00:00
# -*- coding: binary -*-
require 'rex/exploitation/jsobfu'
module Msf
module Exploit::JSObfu
def initialize(info={})
super
register_advanced_options([
OptInt.new('JsObfuscate', [false, "Number of times to obfuscate JavaScript", 0])
], Exploit::JSObfu)
end
#
# Returns an JSObfu object. A wrapper of ::Rex::Exploitation::JSObfu.new(js).obfuscate
#
# @param js [String] JavaScript code
# @param opts [Hash] obfuscation options
# * :iterations [FixNum] Number of times to obfuscate
# @return [::Rex::Exploitation::JSObfu]
#
def js_obfuscate(js, opts={})
iterations = (opts[:iterations] || datastore['JsObfuscate']).to_i
obfu = ::Rex::Exploitation::JSObfu.new(js)
obfu.obfuscate(:iterations=>iterations)
obfu
end
end
end