lib/shaddox/target.rb in shaddox-0.0.14 vs lib/shaddox/target.rb in shaddox-0.0.15
- old
+ new
@@ -119,20 +119,20 @@
@ssh = ssh
super(&block)
end
end
def exec(command, opts = {})
+ require 'highline/import'
exit_code = nil
@ssh.open_channel do |channel|
channel.request_pty do |c, success|
raise "SSH could not obtain a pty." unless success
channel.exec(command)
channel.on_data do |c_, data|
if data =~ /\[sudo\]/ || data =~ /Password/i
warn "Target is asking for password: ", 1
$stdout.print data
- puts ""
- pass = $stdin.gets.chomp
+ pass = ask("") { |q| q.echo = false }
channel.send_data "#{pass}\n"
else
$stdout.print data unless opts[:quiet]
end
end