Skip to content

Commit 537dc6e

Browse files
author
RageLtMan
committed
Update Payload Cached Sizes fails in PSH Script
When attempting to update cached payload sizes which utilize the Rex::Powershell functionality, the BRE block which appropriates initial code is called with the 'code' variable being a nil which results in: ``` lib/rex/powershell/script.rb:40:in `initialize': no implicit conversion of nil into String (TypeError) ``` This throws a conditional into the File.open call which presents an empty string instead of a nil. This still results in the rescue block having to catch the exception, but manages to keep the payload size updating script happy an retains consistent behavior.
1 parent 0557d21 commit 537dc6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rex/powershell/script.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def initialize(code)
3737

3838
begin
3939
# Open code file for reading
40-
fd = ::File.new(code, 'rb')
40+
fd = ::File.new(code || '', 'rb')
4141
while (line = fd.gets)
4242
@code << line
4343
end

0 commit comments

Comments
 (0)