kh2hc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/kh2hc/version.rb +1 -1
  4. data/lib/kh2hc.rb +4 -7
  5. metadata +16 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55b4188b8e1e718687f18b3f45b120f1d04da27c6c906bf9c6c7c89e005282f8
4
- data.tar.gz: 92b9439b9d9492bb58e38cc67788f54c256999c5fa119aa3d0f4f8ae0514cb1d
3
+ metadata.gz: 5fc579174cfb0a0a853d98c17aaa796a6167053142912cb0e035d6ad07aa62aa
4
+ data.tar.gz: be6ea1b720d8908a882e1eab389466b6a403c66e69c85b79207c0ce308bc51a9
5
5
  SHA512:
6
- metadata.gz: 53b67dcd4e5e51f41f0a709dd37092da8734ae0794814ff670e7b35cc0aa824159219c5b49f630a09549d75c5592027d85ce76f43d44d946bf79bbf0d0ac4283
7
- data.tar.gz: be057f802bca5560e4862cc3dd04f1edb4172216da83694008a58c62e559318857ab2d90afd0b5386eb7f93c6eda50e689022506f1aeb6d2aee424d6943bbc64
6
+ metadata.gz: 32f7bd1452206989b356534146928878567bebae23fe26b7ba2ebd67c130dc3850cc774885151123a675e417e3c8c71824824f1cb185635af03516bb87a8142e
7
+ data.tar.gz: 02ec0fb9fcbd10d822b84c48116e9bfbec102a3e3702481096a3f94295e1a07aa5205d4fc37682323885aec99b06e28ca15b3608c6cfc0a04d347fde2ed5e150
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Alexandre ZANNI
3
+ Copyright (c) 2023-2026 Alexandre ZANNI
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/lib/kh2hc/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Kh2hc
4
4
  # Version of Kh2hc library and app
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
data/lib/kh2hc.rb CHANGED
@@ -13,23 +13,20 @@ module Kh2hc
13
13
  # @return [Array<Hash>] An array of Hash. Each Hash has two keys: the `:hash` of the host hash,
14
14
  # the `:salt` of the host hash
15
15
  def self.convert(khfile)
16
- hosts = []
17
16
  data = File.read(khfile)
18
17
  # |<Magic string>|<salt>|<hash> <key algorithm> <public key sig.>
19
- data.scan(/^\|1\|([^|]+)\|([^|].+) .+ .+$/).each do |host|
18
+ data.scan(/^\|1\|([^|]+)\|([^|].+) .+ .+$/).map do |host|
20
19
  # hash:salt
21
- hosts << { hash: host[1].from_b64.to_hex, salt: host[0].from_b64.to_hex }
20
+ { hash: host[1].from_b64.to_hex, salt: host[0].from_b64.to_hex }
22
21
  end
23
- hosts
24
22
  end
25
23
 
26
24
  # Convert OpenSSH known_hosts file hashed with HashKnownHosts to a hash file crackable by Hashcat.
27
25
  # @param khfile [String] OpenSSH known_hosts file
28
26
  # @return [String] hash file in Hashcat format
29
27
  def self.convert1(khfile)
30
- hc_out = []
31
- convert(khfile).each do |host|
32
- hc_out << "#{host[:hash]}:#{host[:salt]}"
28
+ hc_out = convert(khfile).map do |host|
29
+ "#{host[:hash]}:#{host[:salt]}"
33
30
  end
34
31
  hc_out.join("\n")
35
32
  end
metadata CHANGED
@@ -1,29 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kh2hc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ctf-party
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '4.0'
19
+ - - "<"
18
20
  - !ruby/object:Gem::Version
19
- version: '2.3'
21
+ version: '6.0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - "~>"
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '4.0'
29
+ - - "<"
25
30
  - !ruby/object:Gem::Version
26
- version: '2.3'
31
+ version: '6.0'
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: docopt
29
34
  requirement: !ruby/object:Gem::Requirement
@@ -61,8 +66,8 @@ metadata:
61
66
  documentation_uri: https://noraj.github.io/kh2hc/
62
67
  homepage_uri: https://noraj.github.io/kh2hc/
63
68
  source_code_uri: https://github.com/noraj/kh2hc/
69
+ funding_uri: https://github.com/sponsors/noraj
64
70
  rubygems_mfa_required: 'true'
65
- post_install_message:
66
71
  rdoc_options: []
67
72
  require_paths:
68
73
  - lib
@@ -70,18 +75,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
75
  requirements:
71
76
  - - ">="
72
77
  - !ruby/object:Gem::Version
73
- version: 3.0.0
78
+ version: 3.2.0
74
79
  - - "<"
75
80
  - !ruby/object:Gem::Version
76
- version: '4.0'
81
+ version: '5.0'
77
82
  required_rubygems_version: !ruby/object:Gem::Requirement
78
83
  requirements:
79
84
  - - ">="
80
85
  - !ruby/object:Gem::Version
81
86
  version: '0'
82
87
  requirements: []
83
- rubygems_version: 3.4.6
84
- signing_key:
88
+ rubygems_version: 4.0.3
85
89
  specification_version: 4
86
90
  summary: Convert OpenSSH known_hosts file hashed with HashKnownHosts to hashes crackable
87
91
  by Hashcat.