Skip to content

Commit 5631959

Browse files
committed
Fix #12895, fix console.read does not return command output
1 parent 647a73f commit 5631959

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/msf/ui/console/driver.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def unknown_command(method, line)
479479

480480
self.busy = true
481481
begin
482-
system(line)
482+
run_unknown_command(line)
483483
rescue ::Errno::EACCES, ::Errno::ENOENT
484484
print_error("Permission denied exec: #{line}")
485485
end
@@ -500,6 +500,10 @@ def unknown_command(method, line)
500500
super
501501
end
502502

503+
def run_unknown_command(command)
504+
system(command)
505+
end
506+
503507
##
504508
#
505509
# Handlers for various global configuration values

lib/msf/ui/web/web_console.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ module WebConsoleShell
3232
def supports_color?
3333
false
3434
end
35+
36+
def run_unknown_command(command)
37+
Open3.popen2e(command) {|stdin,output,thread|
38+
output.each {|outline|
39+
print_line(outline.chomp)
40+
}
41+
}
42+
end
43+
3544
end
3645

3746
def initialize(framework, console_id, opts={})

0 commit comments

Comments
 (0)