ssh_scan 0.0.23 → 0.0.24

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: 48513bc99f2006e93467bc3ceedc6ac3e0796051
4
- data.tar.gz: 6a97bf4458070837295a311580576144c5d6c50a
3
+ metadata.gz: 1066cba29c8d997c6924ebc2155fa4ecc91d382c
4
+ data.tar.gz: 10880af54befeb4d528e91e15e17d9827578734b
5
5
  SHA512:
6
- metadata.gz: 374b93e8d788baad6c862309e720a212a9f1bbf937e0052c5f6c874bdd8cca4146f6fb8486777b51627c78f53ba4b620207b0c5a020074a9c25f6643b87423da
7
- data.tar.gz: 19def23166c22b188d09f2a21de66973bb2759c530d13e1a500eafc3834d7b1e7943802e47331edb62c3621a79b04e4f038067848c42b243839bb9fceb25e39b
6
+ metadata.gz: 698760530885d0c3288f426d9aa97eb2d84462d636c2509acacdbaaa2e24d9c4c53869abc7cb93d741b9dc16f29df6e18426909e0bc91a6fb70c3387b2a2a3ab
7
+ data.tar.gz: 683e352aec4ce7c2d7fc90ac56fbb050324017d4b155e690ea5ff92445e34eaba460c31cda5b487cda48a2e1f33b8122af2e6dfac30e65caf4ae147180878a6e
@@ -1,5 +1,5 @@
1
1
  ---
2
- 63.245.214.149:
3
- - 17:97:3a:64:83:4e:4f:fd:5d:d1:f5:fc:d5:9a:fb:15
4
- - 01:89:8a:f1:07:52:47:54:a5:58:99:77:23:0b:63:a5:d8:07:80:12
5
- - 23:4e:2e:30:8e:bd:bb:ae:65:55:57:a9:df:70:8c:c6:ac:48:18:f7:a0:3b:1e:ba:aa:c2:f4:d4:e6:f4:4b:6a
2
+ 45.55.203.36:
3
+ - 1b:21:eb:44:cd:3c:17:63:fa:6c:b2:58:11:ce:98:f4
4
+ - 88:74:a1:9e:b9:38:a0:a8:ac:2d:bd:82:eb:09:a0:49:84:dc:b8:c6
5
+ - 93:6c:b4:26:21:a8:ff:50:e9:e0:37:7b:2c:71:ea:e2:7e:6f:30:60:2e:8e:d2:b6:d7:8d:0a:78:a5:da:2c:76
@@ -28,6 +28,17 @@ module SSHScan
28
28
  @server_banner
29
29
  end
30
30
 
31
+ def close()
32
+ begin
33
+ unless @sock.nil?
34
+ @sock.close
35
+ end
36
+ rescue
37
+ @sock = nil
38
+ end
39
+ return true
40
+ end
41
+
31
42
  def connect()
32
43
  @error = nil
33
44
 
@@ -211,6 +211,10 @@ module SSHScan
211
211
  @error = error.to_s
212
212
  end
213
213
 
214
+ def unset_error
215
+ @error = nil
216
+ end
217
+
214
218
  def error?
215
219
  !@error.nil?
216
220
  end
@@ -36,9 +36,10 @@ module SSHScan
36
36
  client = SSHScan::Client.new(
37
37
  target.resolve_fqdn_as_ipv4.to_s, port, timeout
38
38
  )
39
- client.connect()
39
+ client.connect
40
40
  result.set_client_attributes(client)
41
41
  kex_result = client.get_kex_result()
42
+ client.close
42
43
  result.set_kex_result(kex_result) unless kex_result.nil?
43
44
  result.error = client.error if client.error?
44
45
  # If it does resolve as IPv6, we're try IPv6
@@ -46,20 +47,23 @@ module SSHScan
46
47
  client = SSHScan::Client.new(
47
48
  target.resolve_fqdn_as_ipv6.to_s, port, timeout
48
49
  )
49
- client.connect()
50
+ client.connect
50
51
  result.set_client_attributes(client)
51
52
  kex_result = client.get_kex_result()
53
+ client.close
52
54
  result.set_kex_result(kex_result) unless kex_result.nil?
53
55
  result.error = client.error if client.error?
54
56
 
55
57
  # If resolves as IPv6, but somehow we get an client error, fall-back to IPv4
56
58
  if result.error?
59
+ result.unset_error
57
60
  client = SSHScan::Client.new(
58
61
  target.resolve_fqdn_as_ipv4.to_s, port, timeout
59
62
  )
60
63
  client.connect()
61
64
  result.set_client_attributes(client)
62
65
  kex_result = client.get_kex_result()
66
+ client.close
63
67
  result.set_kex_result(kex_result) unless kex_result.nil?
64
68
  result.error = client.error if client.error?
65
69
  end
@@ -69,6 +73,7 @@ module SSHScan
69
73
  client.connect()
70
74
  result.set_client_attributes(client)
71
75
  kex_result = client.get_kex_result()
76
+ client.close
72
77
 
73
78
  unless kex_result.nil?
74
79
  result.set_kex_result(kex_result)
@@ -28,7 +28,11 @@ module SSHScan
28
28
  end
29
29
  return ip_array
30
30
  elsif ip.include? "/"
31
- cidr = NetAddr::CIDR.create(ip)
31
+ begin
32
+ cidr = NetAddr::CIDR.create(ip)
33
+ rescue
34
+ raise ArgumentError, "Invalid target: #{ip}"
35
+ end
32
36
  ip_array = cidr.enumerate
33
37
  ip_array.delete(cidr.network)
34
38
  ip_array.delete(cidr.last)
@@ -1,3 +1,3 @@
1
1
  module SSHScan
2
- VERSION = '0.0.23'
2
+ VERSION = '0.0.24'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh_scan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Claudius
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-06-14 00:00:00.000000000 Z
15
+ date: 2017-06-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bindata