apullo 0.1.4 → 0.1.5

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
  SHA256:
3
- metadata.gz: 3fef54d32890b574081af9e64c6d76dc01287651779bb43eaecc046df9763e43
4
- data.tar.gz: 07f3676d94fd54345a40a547c0a6b82ffa5d599ff34a21b7cf59270e608f2df1
3
+ metadata.gz: 96eb9917a6d5fcef270fe520a2312f7447896b2d1e6f0bfc61f966d554e8f9c6
4
+ data.tar.gz: ca4807677d7519969aae72fcc647cad01f3799e04cea1d3aee3433efbb4e77bc
5
5
  SHA512:
6
- metadata.gz: 5bd0f54aebb6c6f7515fbc2979c22c3af2a3553535665f5a3ca7af5bd1358f0e5372b33a2db03c181e115d9aac87d7b819f57b49c281a8362c78860d175c2545
7
- data.tar.gz: d5ac2f8806e242005d2bd6ee1d03de9126eed3b01b93a19583fe387e5842cce1b5a99ff05dcbfc6a3b58ba5b4d5ae38e11a48a68872953b03e47dcf2417d5e45
6
+ metadata.gz: 8d32ee78a83177d0dbca9a7d418f5e5e8af4894f516d05ed705a1ab8b082601663353f69e30571663015ddf0fbe9e91b19e6ac0b83431369a7866f51b147b6f7
7
+ data.tar.gz: 5e846ede99ffd718f5e75944eb1ef79b97be719f6cbbf62a43ebf05891e405142a1781d6676ec7e8fabdfe5d0530b7fddeedf7ef0573ca07165110828644a098
@@ -37,7 +37,7 @@ module Apullo
37
37
  hash = Hash.new(@peer_cert.to_der)
38
38
  {
39
39
  md5: hash.md5,
40
- serial: @peer_cert.serial,
40
+ serial: @peer_cert.serial.to_i,
41
41
  sha1: hash.sha1,
42
42
  sha256: hash.sha256,
43
43
  }
@@ -93,7 +93,9 @@ module Apullo
93
93
  href = icon.get("href")
94
94
  return default_favicon_url unless href
95
95
 
96
- href.start_with?("http://", "https://") ? href : target.url + href
96
+ return href if href.start_with?("http://", "https://")
97
+
98
+ target.url.end_with?("/") ? target.url + href : "#{target.url}/#{href}"
97
99
  end
98
100
 
99
101
  def get(path, limit: 3)
@@ -6,7 +6,7 @@ module Apullo
6
6
  module Fingerprint
7
7
  class SSH < Base
8
8
  DEFAULT_OPTIONS = { "timeout" => 3 }.freeze
9
- DEFAULT_PORT = 22
9
+ DEFAULT_PORTS = [22, 2222].freeze
10
10
 
11
11
  private
12
12
 
@@ -16,7 +16,7 @@ module Apullo
16
16
 
17
17
  def pluck_fingerprints
18
18
  result = scan
19
- keys = result.dig("keys") || []
19
+ keys = result.dig("keys") || {}
20
20
  keys.map do |cipher, data|
21
21
  raw = data.dig("raw")
22
22
  fingerprints = data.dig("fingerprints") || []
@@ -30,14 +30,23 @@ module Apullo
30
30
  end.to_h
31
31
  end
32
32
 
33
- def scan
34
- return {} unless target.host
33
+ def _scan(target, port: 22)
34
+ return nil unless target.host
35
35
 
36
36
  engine = SSHScan::ScanEngine.new
37
- dest = "#{target.host}:#{DEFAULT_PORT}"
37
+ dest = "#{target.host}:#{port}"
38
38
  result = engine.scan_target(dest, DEFAULT_OPTIONS)
39
39
  result.to_hash
40
40
  end
41
+
42
+ def scan
43
+ [target].product(DEFAULT_PORTS).each do |target, port|
44
+ result = _scan(target, port: port)
45
+ keys = result.dig("keys") || {}
46
+ return result unless keys.empty?
47
+ end
48
+ {}
49
+ end
41
50
  end
42
51
  end
43
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Apullo
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apullo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-31 00:00:00.000000000 Z
11
+ date: 2020-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler