|
| 1 | +# frozen_string_literal: true |
| 2 | +# |
| 3 | +# ronin-wordlists - A library and tool for managing wordlists. |
| 4 | +# |
| 5 | +# Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com) |
| 6 | +# |
| 7 | +# ronin-wordlists is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU Lesser General Public License as published |
| 9 | +# by the Free Software Foundation, either version 3 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# ronin-wordlists is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU Lesser General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU Lesser General Public License |
| 18 | +# along with ronin-wordlists. If not, see <https://www.gnu.org/licenses/>. |
| 19 | +# |
| 20 | + |
| 21 | +require 'ronin/wordlists' |
| 22 | + |
| 23 | +module Ronin |
| 24 | + module Wordlists |
| 25 | + # |
| 26 | + # Wordlist helper methods. |
| 27 | + # |
| 28 | + module Mixin |
| 29 | + # |
| 30 | + # Downloads a new wordlist. |
| 31 | + # |
| 32 | + # @param [String, URI::HTTP] url |
| 33 | + # The URL of the wordlist to download. |
| 34 | + # |
| 35 | + # @api public |
| 36 | + # |
| 37 | + # @see Wordlists.download |
| 38 | + # |
| 39 | + def wordlists_download(url) |
| 40 | + Wordlists.download(url) |
| 41 | + end |
| 42 | + |
| 43 | + alias download_wordlist wordlists_download |
| 44 | + |
| 45 | + # |
| 46 | + # Finds a wordlist. |
| 47 | + # |
| 48 | + # @param [String] name |
| 49 | + # The wordlist file name. |
| 50 | + # |
| 51 | + # @return [String, nil] |
| 52 | + # The path to the wordlist file. |
| 53 | + # |
| 54 | + # @api public |
| 55 | + # |
| 56 | + # @see Wordlists.find |
| 57 | + # |
| 58 | + def wordlists_find(name) |
| 59 | + Wordlists.find(name) |
| 60 | + end |
| 61 | + |
| 62 | + alias find_wordlist wordlists_find |
| 63 | + |
| 64 | + # |
| 65 | + # Lists all wordlists on the system. |
| 66 | + # |
| 67 | + # @param [String] pattern |
| 68 | + # Optional glob pattern to search for within the wordlist directory. |
| 69 | + # |
| 70 | + # @return [Set<String>] |
| 71 | + # The wordlist files within the wordlist directories. |
| 72 | + # |
| 73 | + # @api public |
| 74 | + # |
| 75 | + # @see Wordlists.list |
| 76 | + # |
| 77 | + def wordlists_list(pattern='*') |
| 78 | + Wordlists.list(pattern) |
| 79 | + end |
| 80 | + |
| 81 | + alias list_wordlists wordlists_list |
| 82 | + |
| 83 | + # |
| 84 | + # Opens a wordlist. |
| 85 | + # |
| 86 | + # @param [String] name |
| 87 | + # The wordlist file name. |
| 88 | + # |
| 89 | + # @return [Wordlist::File] |
| 90 | + # The opened wordlist file. |
| 91 | + # |
| 92 | + # @raise [WordlistNotFound] |
| 93 | + # No wordlist with the given name. |
| 94 | + # |
| 95 | + # @api public |
| 96 | + # |
| 97 | + # @see Wordlists.open |
| 98 | + # |
| 99 | + def wordlists_open(name) |
| 100 | + Wordlists.open(name) |
| 101 | + end |
| 102 | + |
| 103 | + alias open_wordlist wordlists_open |
| 104 | + end |
| 105 | + end |
| 106 | +end |
0 commit comments