lib/shaddox/target.rb in shaddox-0.0.19 vs lib/shaddox/target.rb in shaddox-0.0.20
- old
+ new
@@ -33,16 +33,16 @@
gem_installed = exec 'type gem >/dev/null'
raise TargetError, "Gem is required to use shaddox. Please install it manually." unless gem_installed
shaddox_installed = lambda { exec 'gem list shaddox -i >/dev/null' }
if shaddox_installed.call()
info "Updating shaddox...", 1
- updated = exec "gem update shaddox", :quiet => true
+ updated = exec "gem update shaddox", :verbose => false
updated = exec "sudo gem update shaddox" unless updated
warn "Shaddox could not be automatically updated. Please update it manually with 'gem update shaddox'.", 1 unless updated
else
info "Installing shaddox...", 1
- installed = exec "gem install shaddox", :quiet => true
+ installed = exec "gem install shaddox", :verbose => false
installed = exec "sudo gem install shaddox" unless installed
warn "Shaddox could not be automatically installed. Please update it manually with 'gem update shaddox'.", 1 unless installed
end
unless shaddox_installed.call()
raise TargetError, "Shaddox was not found on this target."
@@ -118,11 +118,11 @@
Net::SSH.start(host, user, ssh_opts) do |ssh|
@ssh = ssh
super(&block)
end
end
- def exec(command, opts = {})
+ def exec(command, opts = {:verbose => true})
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
@@ -132,10 +132,10 @@
warn "Target is asking for password: ", 1
$stdout.print data
pass = ask("") { |q| q.echo = false }
channel.send_data "#{pass}\n"
else
- $stdout.print data unless opts[:quiet]
+ $stdout.print data if opts[:verbose]
end
end
channel.on_request('exit-status') do |ch, data|
exit_code = data.read_long
end