Class: Ronin::Wordlists::CLI::Commands::Search Private
- Inherits:
-
Ronin::Wordlists::CLI::Command
- Object
- Core::CLI::Command
- Ronin::Wordlists::CLI::Command
- Ronin::Wordlists::CLI::Commands::Search
- Defined in:
- lib/ronin/wordlists/cli/commands/search.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.
Lists wordlists available for download or installation.
Usage
ronin-wordlists search [options]
Options
-c, --category NAME Filters wordlists by a specific category
-h, --help Print help information
Arguments: [KEYWORD] Optional search keyword
Instance Attribute Summary collapse
-
#categories ⇒ Set<String>
readonly
private
Wordlist categories to filter by.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Search
constructor
private
Initializes the
ronin-wordlists search
command. -
#print_entry(entry) ⇒ Object
private
Prints an entry from the wordlist index file.
-
#run(keyword = nil) ⇒ Object
private
Runs the
ronin-wordlists search
command. -
#search(keyword = nil, categories: Set.new) ⇒ Enumerator::Lazy
private
Searches for matching entries in the wordlist index file.
Constructor Details
#initialize(**kwargs) ⇒ Search
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.
Initializes the ronin-wordlists search
command.
76 77 78 79 80 |
# File 'lib/ronin/wordlists/cli/commands/search.rb', line 76 def initialize(**kwargs) super(**kwargs) @categories = Set.new end |
Instance Attribute Details
#categories ⇒ Set<String> (readonly)
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.
Wordlist categories to filter by.
68 69 70 |
# File 'lib/ronin/wordlists/cli/commands/search.rb', line 68 def categories @categories end |
Instance Method Details
#print_entry(entry) ⇒ 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.
Prints an entry from the wordlist index file.
132 133 134 135 136 137 138 139 |
# File 'lib/ronin/wordlists/cli/commands/search.rb', line 132 def print_entry(entry) puts "[ #{entry.name} ]" puts puts " * URL: #{entry.url}" puts " * Categories: #{entry.categories.join(', ')}" puts " * Summary: #{entry.summary}" puts end |
#run(keyword = 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 search
command.
88 89 90 91 92 |
# File 'lib/ronin/wordlists/cli/commands/search.rb', line 88 def run(keyword=nil) search(keyword, categories: @categories).each do |entry| print_entry(entry) end end |
#search(keyword = nil, categories: Set.new) ⇒ Enumerator::Lazy
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.
Searches for matching entries in the wordlist index file.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/ronin/wordlists/cli/commands/search.rb', line 106 def search(keyword=nil, categories: Set.new) entries = WordlistIndex.load.lazy unless categories.empty? entries = entries.filter do |entry| categories.subset?(entry.categories) end end if keyword entries = entries.filter do |entry| entry.name.include?(keyword) || entry.summary.include?(keyword) || entry.categories.include?(keyword) end end return entries end |