ssh-manager 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10e0a6ecfbd52c188a0252c5374c33bd92656e57
4
- data.tar.gz: 59be4d7b2cd671355dcb606e1ec171997d05ef67
3
+ metadata.gz: 242c3e31b394c8af8a1e562047d81bf97e80230a
4
+ data.tar.gz: cdf870f02298851e998e8b3b0356689a842b23e7
5
5
  SHA512:
6
- metadata.gz: 582dd5364afc293035e2663aee1d40f85679a6f31622bf3e4d9c7def2488278b9165aa299a6ebfc26d00850730c05d663abd1747ff6124d5bf2627ba4d3968f9
7
- data.tar.gz: b8da76fd9719cddf3704418870bbf007283a6950513db0df2c9d28bb7333c6228e0a96970b33ad88b5b963e804c588d50d963d0c04928b2a6909fba0c0481b6d
6
+ metadata.gz: 279cd4ac17a71b57d32348e2269d873e69b55ef29d98ab36f07716c07bda85cf5128e49231475fc2cb3fbf88f52fbaaf52f6163758c5505189732f6488b9d8bd
7
+ data.tar.gz: ca26cc043b4757ca6d15ad9a693b08e8088eb3ff59d16b9d85e1755e09c8720d4a1629de6500c20126a8f49c23306ce64b6b5b81a5ce8a50b60baac6ca17d73c
@@ -34,9 +34,17 @@ module SSH
34
34
  end
35
35
 
36
36
  def connect_to(id)
37
- @ip = DATABASE.get_connection_data[id.to_i-1][0]
38
- @user = DATABASE.get_connection_data[id.to_i-1][1]
39
- check_term(@ip, @user)
37
+ via = DATABASE.get_connection_data[id.to_i-1][-1] =~ /@/
38
+ if via.integer? == false
39
+ @ip = DATABASE.get_connection_data[id.to_i-1][0]
40
+ @user = DATABASE.get_connection_data[id.to_i-1][1]
41
+ check_term(@ip, @user)
42
+ else
43
+ @ip = DATABASE.get_connection_data[id.to_i-1][0]
44
+ @user = DATABASE.get_connection_data[id.to_i-1][1]
45
+ via = DATABASE.get_connection_data[id.to_i-1][-1]
46
+ %x(gnome-terminal --command="ssh -A -t #{via} ssh -A -t #{@user}@#{@ip}")
47
+ end
40
48
  #TODO: check for options
41
49
  #TODO: if db[secure_login] = false => http://linuxcommando.blogspot.de/2008/10/how-to-disable-ssh-host-key-checking.html
42
50
  end
@@ -80,15 +88,16 @@ module SSH
80
88
  options = '' if options == ''
81
89
  puts 'Group: '
82
90
  group = $stdin.gets.chomp
83
- # puts 'Connect via(ip): '
84
- # connect_via_ip = $stdin.gets.chomp
85
- # puts 'With Username: '
86
- # connect_via_user = $stdin.gets.chomp
87
- # connect_via= "#{connect_via_user}@#{connect_via_ip}"
91
+ puts 'Connect via(ip): '
92
+ connect_via_ip = $stdin.gets.chomp
93
+ puts 'With Username: '
94
+ connect_via_user = $stdin.gets.chomp
95
+ connect_via= "#{connect_via_user}@#{connect_via_ip}"
96
+ # ssh -A -t jxs@10.160.64.184 ssh -A -t tux@10.160.65.2
88
97
  count = 0
89
98
  created_at = Time.now.to_s
90
99
  last_time = Time.now.to_s
91
- DATABASE.add_new_connection(ip, user, hostname, port, note, created_at, options, count, group, last_time)
100
+ DATABASE.add_new_connection(ip, user, hostname, port, note, connect_via, created_at, options, count, group, last_time)
92
101
  end
93
102
 
94
103
  def delete(id)
@@ -3,7 +3,6 @@ require 'optparse'
3
3
  require_relative 'db'
4
4
  require_relative 'client'
5
5
  require_relative 'version'
6
- require 'byebug'
7
6
 
8
7
  module SSH
9
8
  module Manager
@@ -21,8 +21,8 @@ module SSH
21
21
  @connections.map([:ip, :user, :note, :group, :connect_via])
22
22
  end
23
23
 
24
- def add_new_connection(ip, user='root', hostname='', port=22, note='', created_at, option, count, group, last_time)
25
- @connections.insert(:ip => ip, :user => user, :hostname => hostname, :port => port, :note => note, :created_at => created_at, :options => option, :group => group, :count => count, :last_time => last_time)
24
+ def add_new_connection(ip, user='root', hostname='', port=22, note='', connect_via='', created_at, option, count, group, last_time)
25
+ @connections.insert(:ip => ip, :user => user, :hostname => hostname, :port => port, :note => note, :connect_via => connect_via, :created_at => created_at, :options => option, :group => group, :count => count, :last_time => last_time)
26
26
  end
27
27
 
28
28
  def delete_connection(ip)
@@ -1,5 +1,5 @@
1
1
  module SSH
2
2
  module Manager
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Schmid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -127,3 +127,4 @@ summary: manage and connect ssh
127
127
  test_files:
128
128
  - spec/client_spec.rb
129
129
  - spec/spec_helper.rb
130
+ has_rdoc: