Skip to content

Commit 0820a4f

Browse files
committed
Land rapid7#3933 - Fix cmd_exec with Python Meterpreter on OS X
2 parents 0dfd8e2 + b1b8cba commit 0820a4f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/msf/core/post/common.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ def cmd_exec(cmd, args=nil, time_out=15)
111111
o << d
112112
end
113113
o.chomp! if o
114-
process.channel.close
114+
115+
begin
116+
process.channel.close
117+
rescue IOError => e
118+
# Channel was already closed, but we got the cmd output, so let's soldier on.
119+
end
120+
115121
process.close
116122
when /shell/
117123
o = session.shell_command_token("#{cmd} #{args}", time_out)

0 commit comments

Comments
 (0)