Skip to content

Commit 5b0565a

Browse files
committed
Msf::Exploit::VBSObfuscate: Add VBS obfuscation library
1 parent 391e4e2 commit 5b0565a

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- coding: binary -*-
2+
3+
require 'rex/exploitation/vbsobfuscate'
4+
5+
module Msf
6+
# VBS obfuscation library wrapper for Rex::Exploitation::VBSObfuscate
7+
module Exploit::VBSObfuscate
8+
def initialize(info = {})
9+
super
10+
register_advanced_options([
11+
OptInt.new('VbsObfuscate', [false, 'Number of times to obfuscate VBS', 1]),
12+
])
13+
end
14+
15+
#
16+
# Returns an VBSObfuscate object. A wrapper of ::Rex::Exploitation::VBSObfuscate.new(vbs).obfuscate!
17+
#
18+
# @param vbs [String] VBS code
19+
# @param opts [Hash] obfuscation options
20+
# * :iterations [FixNum] Number of times to obfuscate
21+
# * :normalize_whitespace [Boolean] normalize line endings and strip leading/trailing whitespace from each line (true)
22+
# * :dynamic_execution [Boolean] dynamically execute obfuscated code with Execute (true)
23+
# @return [::Rex::Exploitation::VBSObfuscate]
24+
#
25+
def vbs_obfuscate(vbs, opts = {})
26+
iterations = (opts[:iterations] || datastore['VbsObfuscate']).to_i
27+
normalize_whitespace = opts[:normalize_whitespace].blank? || opts[:normalize_whitespace]
28+
dynamic_execution = opts[:dynamic_execution].blank? || opts[:dynamic_execution]
29+
30+
vbs_obfuscate = ::Rex::Exploitation::VBSObfuscate.new(vbs)
31+
vbs_obfuscate.obfuscate!(
32+
iterations: iterations,
33+
normalize_whitespace: normalize_whitespace,
34+
dynamic_execution: dynamic_execution
35+
)
36+
vbs_obfuscate
37+
end
38+
end
39+
end

lib/msf_autoload.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def custom_inflections
124124
'macho' => 'MachO',
125125
'nodejs' => 'NodeJS',
126126
'jsobfu' => 'JSObfu',
127+
'vbsobfuscate' => 'VBSObfuscate',
127128
'osx' => 'OSX',
128129
'webrtc' => 'WebRTC',
129130
'json' => 'JSON',

0 commit comments

Comments
 (0)