Method: Rex::Exploitation::Powershell::Obfu#standard_subs

Defined in:
lib/rex/exploitation/powershell/obfu.rb

#standard_subs(subs = %w(strip_comments strip_whitespace sub_funcs sub_vars))) ⇒ String

Perform standard substitutions

Returns:

  • (String)

    code with standard substitution methods applied



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/rex/exploitation/powershell/obfu.rb', line 84

def standard_subs(subs = %w(strip_comments strip_whitespace sub_funcs sub_vars))
  # Save us the trouble of breaking injected .NET and such
  subs.delete('strip_whitespace') unless get_string_literals.empty?
  # Run selected modifiers
  subs.each do |modifier|
    send(modifier)
  end
  code.gsub!(EMPTY_LINE_REGEX, '')

  code
end