Sha256: 7c296bf632d27701f89a1c01bb2bb117d8dd082fd0d93f6df042b6d494c11487

Contents?: true

Size: 833 Bytes

Versions: 60

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift("#{__dir__}/../lib")

require "json"
require "mihari"
require "open-uri"

module Mihari
  module Analyzers
    class HostedDomains < Base
      attr_reader :ip

      IPINFO_API_ENDPOINT = "https://ipinfo.io"

      def initialize(ip, token: nil)
        @ip = ip
        @token = token
      end

      def title
        "IPinfo hosted domains"
      end

      def description
        "IP info hosted domains: #{ip}"
      end

      def token
        ENV["IPINFO_TOKEN"] || @token
      end

      def artifacts
        uri = URI("#{IPINFO_API_ENDPOINT}/domains/#{ip}?token=#{token}")
        res = uri.read
        json = JSON.parse(res)
        json["domains"] || []
      end
    end
  end
end

ip = "TARGET_IP"
analyzer = Mihari::Analyzers::HostedDomains.new(ip)
analyzer.run

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
mihari-5.2.1 examples/ipinfo_hosted_domains.rb
mihari-5.2.0 examples/ipinfo_hosted_domains.rb
mihari-5.1.4 examples/ipinfo_hosted_domains.rb
mihari-5.1.3 examples/ipinfo_hosted_domains.rb
mihari-5.1.2 examples/ipinfo_hosted_domains.rb
mihari-5.1.1 examples/ipinfo_hosted_domains.rb
mihari-5.1.0 examples/ipinfo_hosted_domains.rb
mihari-5.0.1 examples/ipinfo_hosted_domains.rb
mihari-5.0.0 examples/ipinfo_hosted_domains.rb
mihari-4.12.0 examples/ipinfo_hosted_domains.rb
mihari-4.11.0 examples/ipinfo_hosted_domains.rb
mihari-4.10.0 examples/ipinfo_hosted_domains.rb
mihari-4.9.0 examples/ipinfo_hosted_domains.rb
mihari-4.8.0 examples/ipinfo_hosted_domains.rb
mihari-4.7.4 examples/ipinfo_hosted_domains.rb
mihari-4.7.3 examples/ipinfo_hosted_domains.rb
mihari-4.7.2 examples/ipinfo_hosted_domains.rb
mihari-4.7.1 examples/ipinfo_hosted_domains.rb
mihari-4.7.0 examples/ipinfo_hosted_domains.rb
mihari-4.6.1 examples/ipinfo_hosted_domains.rb