diff --git a/lib/msf/base/sessions/vncinject.rb b/lib/msf/base/sessions/vncinject.rb index 5c1f1ef69a..eaa7decf8f 100644 --- a/lib/msf/base/sessions/vncinject.rb +++ b/lib/msf/base/sessions/vncinject.rb @@ -158,14 +158,12 @@ class VncInject Rex::FileUtils::find_full_path('vncviewer.exe') if (vnc) - if viewonly - vo = "-viewonly " - else - vo = "" - end + args = [] + args.push '-viewonly' if viewonly + args.push "#{vlhost}::#{vlport}" self.view = framework.threads.spawn("VncViewerWrapper", false) { - system("vncviewer #{vo}#{vlhost}::#{vlport}") + system(vnc, *args) } return true