Module: Rex::Powershell
- Defined in:
- lib/rex/powershell.rb,
lib/rex/powershell/obfu.rb,
lib/rex/powershell/param.rb,
lib/rex/powershell/output.rb,
lib/rex/powershell/parser.rb,
lib/rex/powershell/script.rb,
lib/rex/powershell/command.rb,
lib/rex/powershell/payload.rb,
lib/rex/powershell/version.rb,
lib/rex/powershell/function.rb,
lib/rex/powershell/templates.rb,
lib/rex/powershell/exceptions.rb,
lib/rex/powershell/psh_methods.rb
Defined Under Namespace
Modules: Command, Exceptions, Obfu, Output, Parser, Payload, PshMethods, Templates Classes: Function, Param, Script
Constant Summary collapse
- VERSION =
"0.1.100"
Class Method Summary collapse
-
.make_subs(script, subs) ⇒ String
Insert substitutions into the powershell script If script is a path to a file then read the file otherwise treat it as the contents of a file.
-
.process_subs(subs) ⇒ Array
Return an array of substitutions for use in make_subs.
-
.read_script(script_path) ⇒ Script
Reads script into a Powershell::Script.
-
.to_powershell(str, name = "buf") ⇒ Object
Converts a raw string to a powershell byte array.
Class Method Details
.make_subs(script, subs) ⇒ String
Insert substitutions into the powershell script If script is a path to a file then read the file otherwise treat it as the contents of a file
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rex/powershell.rb', line 37 def self.make_subs(script, subs) if ::File.file?(script) script = ::File.read(script) end subs.each do |set| script.gsub!(set[0], set[1]) end script end |
.process_subs(subs) ⇒ Array
Return an array of substitutions for use in make_subs
55 56 57 58 59 60 61 62 63 |
# File 'lib/rex/powershell.rb', line 55 def self.process_subs(subs) return [] if subs.nil? or subs.empty? new_subs = [] subs.split(';').each do |set| new_subs << set.split(',', 2) end new_subs end |
.read_script(script_path) ⇒ Script
Reads script into a Powershell::Script
24 25 26 |
# File 'lib/rex/powershell.rb', line 24 def self.read_script(script_path) Rex::Powershell::Script.new(script_path) end |
.to_powershell(str, name = "buf") ⇒ Object
Converts a raw string to a powershell byte array
68 69 70 |
# File 'lib/rex/powershell.rb', line 68 def self.to_powershell(str, name = "buf") return Rex::Powershell::Script.to_byte_array(str, name) end |