Created
June 23, 2017 20:13
-
-
Save zeroSteiner/f3cf86af676ed427cf2c683cd4e97e15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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