File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,8 @@ def self.to_java(str, name = "shell")
202
202
# Converts a raw string to a powershell byte array
203
203
#
204
204
def self . to_powershell ( str , name = "buf" )
205
+ return "[Byte[]]$#{ name } = ''" if str . nil? or str . empty?
206
+
205
207
code = str . unpack ( 'C*' )
206
208
buff = "[Byte[]]$#{ name } = 0x#{ code [ 0 ] . to_s ( 16 ) } "
207
209
1 . upto ( code . length -1 ) do |byte |
@@ -219,6 +221,8 @@ def self.to_powershell(str, name = "buf")
219
221
# Converts a raw string to a vbscript byte array
220
222
#
221
223
def self . to_vbscript ( str , name = "buf" )
224
+ return "#{ name } " if str . nil? or str . empty?
225
+
222
226
code = str . unpack ( 'C*' )
223
227
buff = "#{ name } =Chr(#{ code [ 0 ] } )"
224
228
1 . upto ( code . length -1 ) do |byte |
@@ -238,6 +242,8 @@ def self.to_vbscript(str, name = "buf")
238
242
# Converts a raw string into a vba buffer
239
243
#
240
244
def self . to_vbapplication ( str , name = "buf" )
245
+ return "#{ name } = Array()" if str . nil? or str . empty?
246
+
241
247
code = str . unpack ( 'C*' )
242
248
buff = "#{ name } = Array("
243
249
maxbytes = 20
You can’t perform that action at this time.
0 commit comments