Sha256: 8470c173660021cebf6fe9571dbd426093416adb6dc762581dc8664874af84f0

Contents?: true

Size: 1.36 KB

Versions: 30

Compression:

Stored size: 1.36 KB

Contents

#!/usr/bin/env ruby

$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
require 'optparse'
require 'ostruct'
require 'recog'
require 'recog/matcher_factory'

options = OpenStruct.new(color: false, detail: false, fail_fast: false)

option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: #{$0} [options] XML_FINGERPRINT_FILE <BANNERS_FILE>"
  opts.separator "Identifies the matches and misses between the fingerprints and the banners file."
  opts.separator ""
  opts.separator "Options"

  opts.on("-f", "--format FORMATTER", 
          "Choose a formatter.",
          "  [s]ummary (default - failure/match msgs)",
          "  [d]etail  (msgs with total counts)") do |format|
    if format.start_with? 'd'
      options.detail = true
    end
  end

  opts.on("--fail-fast [NUM]",
          "Stop after number of failures (default: 10).") do |num|
    options.fail_fast = true
    options.stop_after = (num.to_i == 0) ? 10 : num.to_i
  end

  opts.on("-c", "--color", "Enable color in the output.") do
    options.color = true
  end

  opts.on("-h", "--help", "Show this message.") do
    puts opts
    exit
  end
end
option_parser.parse!(ARGV)

if ARGV.count != 2
  puts option_parser
  exit
end

ndb = Recog::DB.new(ARGV.shift)
options.fingerprints = ndb.fingerprints
matcher = Recog::MatcherFactory.build(options)
matcher.match_banners(ARGV.shift || "-")

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
recog-1.0.27 bin/recog_match
recog-1.0.26 bin/recog_match
recog-1.0.25 bin/recog_match
recog-1.0.24 bin/recog_match
recog-1.0.23 bin/recog_match
recog-1.0.22 bin/recog_match
recog-1.0.21 bin/recog_match
recog-1.0.20 bin/recog_match
recog-1.0.19 bin/recog_match
recog-1.0.18 bin/recog_match
recog-1.0.17 bin/recog_match
recog-1.0.16 bin/recog_match
recog-1.0.15 bin/recog_match.rb
recog-1.0.14 bin/recog_match.rb
recog-1.0.13 bin/recog_match.rb
recog-1.0.12 bin/recog_match.rb
recog-1.0.11 bin/recog_match.rb
recog-1.0.10 bin/recog_match.rb
recog-1.0.9 bin/recog_match.rb
recog-1.0.8 bin/recog_match.rb