Skip to content

Instantly share code, notes, and snippets.

@zeroSteiner
Created June 23, 2017 20:13
Show Gist options
  • Save zeroSteiner/f3cf86af676ed427cf2c683cd4e97e15 to your computer and use it in GitHub Desktop.
Save zeroSteiner/f3cf86af676ed427cf2c683cd4e97e15 to your computer and use it in GitHub Desktop.
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/net-ssh/lib')
require 'net/ssh'
require 'socket'
if ARGV.length > 1
server = TCPServer.new 2000
loop do
client = server.accept
puts 'client connected'
Net::SSH.start('localhost', 'user', :socket => client, :is_server => true)
puts 'NET::SSH started'
client.close
end
else
puts 'starting'
Net::SSH.start('localhost', 'user', port: 2000) do |ssh|
puts 'connected'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment