bin/tls-map in tls-map-1.2.0 vs bin/tls-map in tls-map-1.3.0

- old
+ new

@@ -8,15 +8,18 @@ require 'tls_map/cli' # External require 'docopt' require 'paint' +# can't specify 2 options with the same name even if used in different commands +# https://github.com/docopt/docopt/issues/296#issuecomment-857477191 doc = <<~DOCOPT TLS map #{TLSmap::VERSION} Usage: tls-map search <critera> <term> [-o <output> --force -e -a] [--no-color --debug] + tls-map bulk <critera> <file> [-q <output> --force] [--no-color --debug] tls-map export <filename> <format> [--force] [--debug] tls-map extract <filename> <format> [--no-color --debug] tls-map update [--debug] tls-map -h | --help tls-map --version @@ -26,10 +29,15 @@ <term> The cipher algorithm name. -o, --output <output> Displayed fields. Accepted values: all, codepoint, iana, openssl, gnutls, nss. [default: all] -e, --extended (Online) Display additional information about the cipher (requires output = all or iana) -a, --acronym (Online) Display full acronym name (requires -e / --extended option) + Bulk options: (offline) search and translate cipher names between SSL/TLS libraries in bulk + <critera> The type of term. Accepted values: codepoint, iana, openssl, gnutls, nss. + <file> File containing the cipher algorithm names, one per line. + -q, --output2 <output> Displayed fields. Accepted values: codepoint, iana, openssl, gnutls, nss. [default: iana] + Export options: (offline) export the list of all ciphers (mapping) in various formats <filename> The output file name to write to. <format> Supported formats: markdown (a markdown table), json_pretty (expanded JSON), json_compact (minified JSON), marshal (Ruby marshalized hash). Extract options: (offline) extract ciphers from external tools output file @@ -37,11 +45,11 @@ <format> Supported formats: sslyze, sslscan2, testssl, ssllabs-scan (check the documentation for the expected file format) Update options: (online) DANGEROUS, will break database integrity, force option will be required Other options: - --force Force parsing even if intigrity check failed (DANGEROUS, may result in command execution vulnerability) + --force Force parsing even if integrity check failed (DANGEROUS, may result in command execution vulnerability) --no-color Disable colorized output --debug Display arguments -h, --help Show this screen --version Show version DOCOPT @@ -77,9 +85,16 @@ print "#{Paint[dic[k], :magenta]}: #{Paint[v, :white]}" print " (#{tmext_i.translate_acronym(v)})" if args['--acronym'] && !tmext_i.translate_acronym(v).nil? # rubocop:disable Metrics/BlockNesting puts end end + end + elsif args['bulk'] + cli = TLSmap::CLI.new(args['--force']) + res = cli.bulk_search(args['<critera>'].to_sym, args['<file>'], args['--output2'].to_sym) + puts Paint['No match found', :red] if res.empty? + res.each do |h| + puts "#{Paint[h[args['--output2'].to_sym], :green]}" end elsif args['export'] cli = TLSmap::CLI.new(args['--force']) cli.export(args['<filename>'], args['<format>'].to_sym) puts "#{args['<filename>']} exported"