Rex::Exploitation::VBSObfuscate: Add VBScript obfuscation library#47
Rex::Exploitation::VBSObfuscate: Add VBScript obfuscation library#47adfoster-r7 merged 1 commit intorapid7:masterfrom
Conversation
Dim JbddUBzJRbRrVfg
For JbddUBzJRbRrVfg = 1 To 5
JbddUBzJRbRrVfg = JbddUBzJRbRrVfg + 0
Next
Dim aDvkcFnDGayWffd
For aDvkcFnDGayWffd = 1 To 4
aDvkcFnDGayWffd = aDvkcFnDGayWffd + 0
Next
Function hdySkwGHxJ(OTiALVCdLc)
hdySkwGHxJ = OTiALVCdLc * 2
End Function
Sub EjQtgCpFQ(qaNGszbDuR)
EjQtgCpFQ = qaNGszbDuR * 5
End Sub
Sub AVGbBw(hZyqkvEtkrobpPJ)
AVGbBw = hZyqkvEtkrobpPJ * 1
End Sub
Dim wDCJEsaZBDXo, kGhiVFpu
wDCJEsaZBDXo = 0
kGhiVFpu = 87
Sub xHMTnrcKyD(dAKXbMjoLp)
xHMTnrcKyD = dAKXbMjoLp * 3
End Sub
Sub BgBEFkeDKRZG(TbXNxKjhXTZJS)
BgBEFkeDKRZG = TbXNxKjhXTZJS * 5
End Sub
Dim UnMdYWeu
For UnMdYWeu = 1 To 4
UnMdYWeu = UnMdYWeu + 0
Next
MsgBox "hello!" |
| # Normalize line endings and strip leading/trailing whitespace | ||
| if strip_whitespace | ||
| obfuscated.gsub!(/\r\n/, "\n") | ||
| obfuscated = obfuscated.lines.map(&:strip).reject(&:empty?).join("\n") |
There was a problem hiding this comment.
Maybe a misunderstanding on my part - i assumed strip_whitespace would remove whitespace, but this seem to actually just be 'normalize'? 🤔
If the intent is stripping, would this work (not tested)
| obfuscated = obfuscated.lines.map(&:strip).reject(&:empty?).join("\n") | |
| obfuscated = obfuscated.lines.map(&:strip).reject(&:empty?).join(';') |
Or if the intent is normalization maybe renaming the option could be good for clarity
- if strip_whitespace
+ if normalize_whitespaceThere was a problem hiding this comment.
Maybe a misunderstanding on my part - i assumed
strip_whitespacewould remove whitespace, but this seem to actually just be 'normalize'? 🤔
It removes lines which contain only whitespace and "strips" leading and trailing whitepace on all lines:
# irb
irb(main):001> ' asdf asdf asdf '.strip
=> "asdf asdf asdf"
irb(main):002> Or if the intent is normalization maybe renaming the option could be good for clarity
To me, "normalize" seems equally as vague as "strip" here, but I'll change it.
If it's stripping, would this work (not tested)
No. VBS does not support command concatenation with ; - only new lines.
1fabf13 to
dd7d8d3
Compare
Adds a simple VBS obfuscator.
I tried to stick with the convention, structure, and existing interfaces of the existing JSObfu library, with a few differences:
obfuscate!method name is used (instead ofobfuscate) as the object is modified in placememory_sensitiveoption is not implementediterationsoption is supported, but not very useful. Note that using any obfuscation level beyonditerations: 3is time consuming and not recommended. When dynamic_execution is used (default),iterations: 1is recommended.