Class: Ronin::CLI::Commands::PublicSuffixList Private

Inherits:
Ronin::CLI::Command show all
Includes:
CommandKit::Options::Verbose, Core::CLI::Logging, Support::Network::PublicSuffix
Defined in:
lib/ronin/cli/commands/public_suffix_list.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Updates and parses the public suffix list file.

Usage

ronin public-suffix-list [options]

Options

-v, --verbose                    Enables verbose output
-u, --update                     Updates the public suffix list file
-U, --url URL                    URL to the public suffix list (Default: https://publicsuffix.org/list/public_suffix_list.dat)
-p, --path FILE                  Path to the public suffix list file (Default: /home/postmodern/.local/share/ronin/ronin-support/public_suffix_list.dat)
-h, --help                       Print help information

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#downloadObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Downloads the public suffix list file.

Since:

  • 2.0.0



110
111
112
113
114
115
116
# File 'lib/ronin/cli/commands/public_suffix_list.rb', line 110

def download
  if verbose?
    log_info "Downloading public suffix list from #{options[:url]} to #{options[:path]} ..."
  end

  List.download(url: options[:url], path: options[:path])
end

#downloaded?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Determines if the public suffix list file has been downloaded yet.

Returns:

  • (Boolean)

Since:

  • 2.0.0



94
95
96
# File 'lib/ronin/cli/commands/public_suffix_list.rb', line 94

def downloaded?
  List.downloaded?(options[:path])
end

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the ronin public-suffix-list command.

Since:

  • 2.0.0



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ronin/cli/commands/public_suffix_list.rb', line 75

def run
  if !downloaded?
    download
  elsif options[:update] || stale?
    update
  end

  list_file = List.load_file(options[:path])

  list_file.each do |suffix|
    puts suffix
  end
end

#stale?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Determines if the public suffix list file is stale.

Returns:

  • (Boolean)

Since:

  • 2.0.0



103
104
105
# File 'lib/ronin/cli/commands/public_suffix_list.rb', line 103

def stale?
  List.stale?(options[:path])
end

#updateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Updates the public suffix list file.

Since:

  • 2.0.0



121
122
123
124
125
126
127
# File 'lib/ronin/cli/commands/public_suffix_list.rb', line 121

def update
  if verbose?
    log_info "Updating public suffix list file #{options[:path]} ..."
  end

  List.update(path: options[:path])
end