Sha256: 4696555daa2c37cf0461d3d70ba174471cf31ecb5ccc45f8c03cc22dfafaac98
Contents?: true
Size: 891 Bytes
Versions: 3
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true require "json" require "thor" module Ukemi class CLI < Thor desc "lookup [IP|DOMAIN]", "Lookup passive DNS services" method_option :order_by, type: :string, desc: "Ordering of the passve DNS resolutions (last_seen or first_seen)", default: "-last_seen" def lookup(data) data = refang(data) set_ordering options["order_by"] result = Moderator.lookup(data) puts JSON.pretty_generate(result) end no_commands do def refang(data) data.gsub("[.]", ".").gsub("(.)", ".") end def set_ordering(order_by) parts = order_by.split("-") ordering_key = parts.last sort_order = parts.length == 2 ? "DESC" : "ASC" Ukemi.configure do |config| config.ordering_key = ordering_key config.sort_order = sort_order end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ukemi-0.4.0 | lib/ukemi/cli.rb |
ukemi-0.3.0 | lib/ukemi/cli.rb |
ukemi-0.2.0 | lib/ukemi/cli.rb |