Sha256: 0ebdfb9c684d49b439bd9ae623a6e05e480c930e283767443adbbfba6db82e3a

Contents?: true

Size: 754 Bytes

Versions: 17

Compression:

Stored size: 754 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'net/ssh/cli'
require 'irb'

begin
  $NET_SSH = Net::SSH.start("localhost")
  $CLI = Net::SSH::CLI::Session.new(net_ssh: $NET_SSH, default_prompt: "@")
  $CLI.open_channel
  puts "assuming your prompt contains '@'"
  puts $CLI.cmd "echo 'hello world'"
rescue StandardError => error
  puts "#{error.class} #{error.message}"
  puts error.backtrace
ensure
  puts ""
  puts File.read(__FILE__).lines.map {|line| "[bin/localhost] " + line}
  puts ""
  IRB.start(__FILE__)
end

## Try one of those
# $CLI.cmd "echo 'hello world'"
# $CLI.detect_prompt
# $CLI.default_prompt
# $CLI.cmd "cat /etc/passwd"
# $CLI.write "cat /etc/passwd"
# $CLI.read
# $CLI.cmd "echo 'hello world'"

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
net-ssh-cli-1.9.2 bin/localhost
net-ssh-cli-1.9.1 bin/localhost
net-ssh-cli-1.9.0 bin/localhost
net-ssh-cli-1.8.0 bin/localhost
net-ssh-cli-1.7.0 bin/localhost
net-ssh-cli-1.6.0 bin/localhost
net-ssh-cli-1.5.0 bin/localhost
net-ssh-cli-1.4.1 bin/localhost
net-ssh-cli-1.3.1 bin/localhost
net-ssh-cli-1.3.0 bin/localhost
net-ssh-cli-1.2.1 bin/localhost
net-ssh-cli-1.2.0 bin/localhost
net-ssh-cli-1.1.2 bin/localhost
net-ssh-cli-1.1.1 bin/localhost
net-ssh-cli-1.1.0 bin/localhost
net-ssh-cli-1.0.0 bin/localhost
net-ssh-cli-0.3.0 bin/localhost