tls-map 1.2.0 → 1.3.0

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: 41d9e4f95a9edfc3fbb1e8c72e3e15ab6d20c40621576b7829ce75c057141329
4
- data.tar.gz: 71add869718efbad2b14e3da7ace2d5967013455daee5d310b89443d1a5d5a70
3
+ metadata.gz: 5ac0d9c7dbfc9715ca7387df65617f1202a06ab70b72f764356e6bdb3cbeda3d
4
+ data.tar.gz: 37f02d9953363e4fb90e940d894b1ecdafe9bba9ae1636540f9593ee3c37b808
5
5
  SHA512:
6
- metadata.gz: d03f9a2d71f71290c75bd5c2f8a296c7af7ab571f5ecc7cc1da7351ba65edf57a44b14aa697079b784ec0ed0df4df95a15be8a0bc9a6ec5d1f757a995809cd2c
7
- data.tar.gz: 440522feebc7dbd057ec8abb9e1ad75b44567c861b97b2871f67e6836f7482db4d9ff5d4a4cf9ac081a51fe176a0b0ecbe2e818ccf40e1459fad6c60f3f17172
6
+ metadata.gz: 8a514c524c42e6765e55817dea46b905fdf717e6609e0f1efc2f2555249938b750ae79325b5c2ba3cc58b645f0b378f0f3f13d877a9be37a74dff033b420edbd
7
+ data.tar.gz: 8691bfcdb56bbfe8daa408b290f06f1eb2e9dd2f564a9c86e59b2c64e077b037b45b27e4d4e1000fab7b6fc418064b0d4d1b66e1eb174b221b0fe8c022b72b1c
data/bin/tls-map CHANGED
@@ -10,11 +10,14 @@ require 'tls_map/cli'
10
10
  require 'docopt'
11
11
  require 'paint'
12
12
 
13
+ # can't specify 2 options with the same name even if used in different commands
14
+ # https://github.com/docopt/docopt/issues/296#issuecomment-857477191
13
15
  doc = <<~DOCOPT
14
16
  TLS map #{TLSmap::VERSION}
15
17
 
16
18
  Usage:
17
19
  tls-map search <critera> <term> [-o <output> --force -e -a] [--no-color --debug]
20
+ tls-map bulk <critera> <file> [-q <output> --force] [--no-color --debug]
18
21
  tls-map export <filename> <format> [--force] [--debug]
19
22
  tls-map extract <filename> <format> [--no-color --debug]
20
23
  tls-map update [--debug]
@@ -28,6 +31,11 @@ doc = <<~DOCOPT
28
31
  -e, --extended (Online) Display additional information about the cipher (requires output = all or iana)
29
32
  -a, --acronym (Online) Display full acronym name (requires -e / --extended option)
30
33
 
34
+ Bulk options: (offline) search and translate cipher names between SSL/TLS libraries in bulk
35
+ <critera> The type of term. Accepted values: codepoint, iana, openssl, gnutls, nss.
36
+ <file> File containing the cipher algorithm names, one per line.
37
+ -q, --output2 <output> Displayed fields. Accepted values: codepoint, iana, openssl, gnutls, nss. [default: iana]
38
+
31
39
  Export options: (offline) export the list of all ciphers (mapping) in various formats
32
40
  <filename> The output file name to write to.
33
41
  <format> Supported formats: markdown (a markdown table), json_pretty (expanded JSON), json_compact (minified JSON), marshal (Ruby marshalized hash).
@@ -39,7 +47,7 @@ doc = <<~DOCOPT
39
47
  Update options: (online) DANGEROUS, will break database integrity, force option will be required
40
48
 
41
49
  Other options:
42
- --force Force parsing even if intigrity check failed (DANGEROUS, may result in command execution vulnerability)
50
+ --force Force parsing even if integrity check failed (DANGEROUS, may result in command execution vulnerability)
43
51
  --no-color Disable colorized output
44
52
  --debug Display arguments
45
53
  -h, --help Show this screen
@@ -80,6 +88,13 @@ begin
80
88
  end
81
89
  end
82
90
  end
91
+ elsif args['bulk']
92
+ cli = TLSmap::CLI.new(args['--force'])
93
+ res = cli.bulk_search(args['<critera>'].to_sym, args['<file>'], args['--output2'].to_sym)
94
+ puts Paint['No match found', :red] if res.empty?
95
+ res.each do |h|
96
+ puts "#{Paint[h[args['--output2'].to_sym], :green]}"
97
+ end
83
98
  elsif args['export']
84
99
  cli = TLSmap::CLI.new(args['--force'])
85
100
  cli.export(args['<filename>'], args['<format>'].to_sym)
data/lib/tls_map.rb CHANGED
@@ -55,6 +55,23 @@ module TLSmap
55
55
  {}
56
56
  end
57
57
 
58
+ # Search for corresponding cipher algorithms in other libraries in bulk
59
+ # @param critera [Symbol] The type of `term`.
60
+ # Accepted values: `:codepoint`, `:iana`, `:openssl`, `:gnutls`, `:nss`.
61
+ # @param file [String] File containing the cipher algorithm names, one per line.
62
+ # @param output [Symbol] The corresponding type to be included in the return value.
63
+ # Accepted values: `:all` (default), `:codepoint`, `:iana`, `:openssl`,
64
+ # `:gnutls`, `:nss`.
65
+ # @return [Array<Hash>] The corresponding type, same as {search} return value
66
+ # but one per line stored in an array.
67
+ def bulk_search(critera, file, output = :all)
68
+ res = []
69
+ File.foreach(file) do |line|
70
+ res.push(search(critera, line.chomp, output))
71
+ end
72
+ res
73
+ end
74
+
58
75
  protected :parse
59
76
  end
60
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TLSmap
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tls-map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-28 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -170,6 +170,20 @@ dependencies:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
172
  version: '1.10'
173
+ - !ruby/object:Gem::Dependency
174
+ name: webrick
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '1.7'
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: '1.7'
173
187
  - !ruby/object:Gem::Dependency
174
188
  name: yard
175
189
  requirement: !ruby/object:Gem::Requirement