Fix old powershell generation

bug/bundler_fix
Meatballs 2014-04-23 01:58:02 +01:00
parent dd38a81dfc
commit d2e8e07cfe
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 7 additions and 1 deletions

View File

@ -484,7 +484,13 @@ module Powershell
#
# @return [String] input_data as a powershell byte array
def self.to_byte_array(input_data,var_name = Rex::Text.rand_text_alpha(rand(3)+3))
code = ::File.file?(input_data) ? ::File.read(input_data) : input_data
# File will raise an exception if the path contains null byte
if input_data.include? "\x00"
code = input_data
else
code = ::File.file?(input_data) ? ::File.read(input_data) : input_data
end
code = code.unpack('C*')
psh = "[Byte[]] $#{var_name} = 0x#{code[0].to_s(16)}"
lines = []