Class: Ronin::Wordlists::CLI::Commands::Update Private

Inherits:
Ronin::Wordlists::CLI::Command show all
Includes:
Core::CLI::Logging
Defined in:
lib/ronin/wordlists/cli/commands/update.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 a wordlist or all wordlists.

Usage

ronin-wordlists update [options] [WORDLISt]

Options

-h, --help                       Print help information

Arguments

[WORDLIST]                       The optional wordlist to update

Instance Method Summary collapse

Instance Method Details

#run(name = nil) ⇒ Object

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-wordlists update command.

Parameters:

  • name (String, nil) (defaults to: nil)

    The optional wordlist name to update.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/ronin/wordlists/cli/commands/update.rb', line 64

def run(name=nil)
  cache_dir = CacheDir.new

  if name
    begin
      update(cache_dir[name])
    rescue WordlistNotFound
      print_error "no such wordlist: #{name}"
      exit(1)
    end
  else
    cache_dir.each(&method(:update))
  end
end

#update(wordlist) ⇒ Object

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 a wordlist.

Parameters:



85
86
87
88
89
90
91
92
# File 'lib/ronin/wordlists/cli/commands/update.rb', line 85

def update(wordlist)
  log_info "Updating wordlist #{wordlist.name} from #{wordlist.url} ..."
  begin
    wordlist.update
  rescue DownloadFailed => error
    log_error error.message
  end
end