Skip to content

Commit 9a5b1c4

Browse files
committed
Added the ronin-wordlists available command (closes #19).
* Removed the `--available` option.
1 parent bcd060e commit 9a5b1c4

File tree

8 files changed

+111
-45
lines changed

8 files changed

+111
-45
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Arguments:
3939
[ARGS ...] Additional arguments for the command
4040
4141
Commands:
42+
available
4243
completion
4344
download
4445
help
@@ -48,10 +49,10 @@ Commands:
4849
update, up
4950
```
5051

51-
List popular wordlists available for download:
52+
List popular wordlists available for download or installation:
5253

5354
```shell
54-
$ ronin-wordlists list --available
55+
$ ronin-wordlists available
5556
[ alexa-top-1000 ]
5657

5758
* URL: https://github.com/urbanadventurer/WhatWeb/blob/master/plugin-development/alexa-top-1000.txt

gemspec.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ metadata:
2121
generated_files:
2222
- data/completions/ronin-wordlists
2323
- man/ronin-wordlists.1
24+
- man/ronin-wordlists-available.1
2425
- man/ronin-wordlists-completion.1
2526
- man/ronin-wordlists-download.1
2627
- man/ronin-wordlists-list.1
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# frozen_string_literal: true
2+
#
3+
# ronin-wordlists - A library and tool for managing wordlists.
4+
#
5+
# Copyright (c) 2023 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/cli/command'
22+
23+
require 'yaml'
24+
25+
module Ronin
26+
module Wordlists
27+
class CLI
28+
module Commands
29+
#
30+
# Lists wordlists available for download or installation.
31+
#
32+
# ## Usage
33+
#
34+
# ronin-wordlists available [options]
35+
#
36+
# ## Options
37+
#
38+
# -h, --help Print help information
39+
#
40+
class Available < Command
41+
42+
usage '[options]'
43+
44+
description 'Lists wordlists available for download or installation'
45+
46+
man_page 'ronin-wordlists-available.1'
47+
48+
#
49+
# Runs the `ronin-wordlists available` command.
50+
#
51+
def run
52+
wordlists = YAML.load_file(File.join(ROOT,'data','wordlists.yml'))
53+
54+
wordlists.each do |name,attributes|
55+
puts "[ #{name} ]"
56+
puts
57+
puts " * URL: #{attributes[:url]}"
58+
puts " * Categories: #{attributes[:categories].join(', ')}"
59+
puts " * Summary: #{attributes[:summary]}"
60+
puts
61+
end
62+
end
63+
64+
end
65+
end
66+
end
67+
end
68+
end

lib/ronin/wordlists/cli/commands/list.rb

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
require 'ronin/wordlists/cli/wordlist_dir_option'
2323
require 'ronin/wordlists'
2424

25-
require 'yaml'
26-
2725
module Ronin
2826
module Wordlists
2927
class CLI
@@ -38,7 +36,6 @@ module Commands
3836
# ## Options
3937
#
4038
# -d, --wordlist-dir DIR The wordlist directory
41-
# -a, --available List all wordlists available for download
4239
# -h, --help Print help information
4340
#
4441
# ## Arguments
@@ -51,9 +48,6 @@ class List < Command
5148

5249
usage '[options] [NAME]'
5350

54-
option :available, short: '-a',
55-
desc: 'List all wordlists available for download'
56-
5751
argument :name, required: false,
5852
usage: 'NAME',
5953
desc: 'Optional wordlist name to search for'
@@ -69,38 +63,6 @@ class List < Command
6963
# The optional wordlist name.
7064
#
7165
def run(name=nil)
72-
if options[:available]
73-
list_available_wordlists
74-
else
75-
list_wordlists(name)
76-
end
77-
end
78-
79-
#
80-
# Lists wordlists available for download.
81-
#
82-
# @see https://github.com/ronin-rb/ronin-wordlists/blob/main/data/wordlists.yml
83-
#
84-
def list_available_wordlists
85-
wordlists = YAML.load_file(File.join(ROOT,'data','wordlists.yml'))
86-
87-
wordlists.each do |name,attributes|
88-
puts "[ #{name} ]"
89-
puts
90-
puts " * URL: #{attributes[:url]}"
91-
puts " * Categories: #{attributes[:categories].join(', ')}"
92-
puts " * Summary: #{attributes[:summary]}"
93-
puts
94-
end
95-
end
96-
97-
#
98-
# Lists downloaded wordlists.
99-
#
100-
# @param [String, nil] name
101-
# Optional wordlit name to list.
102-
#
103-
def list_wordlists(name=nil)
10466
wordlists = if name then wordlist_dir.list(name)
10567
else wordlist_dir.list
10668
end

man/ronin-wordlists-available.1.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ronin-wordlists-available 1 "2023-01-01" Ronin Wordlists "User Manuals"
2+
3+
## NAME
4+
5+
ronin-wordlists-available - Lists the available wordlists
6+
7+
## SYNOPSIS
8+
9+
`ronin-wordlists` `available` [*options*]
10+
11+
## DESCRIPTION
12+
13+
Lists popular wordlists that are available for download or installation,
14+
by the `ronin-wordlists download` or `ronin-wordlists install` commands.
15+
16+
## OPTIONS
17+
18+
`-h`, `--help`
19+
: Prints help information.
20+
21+
## AUTHOR
22+
23+
Postmodern <postmodern.mod3@gmail.com>
24+
25+
## SEE ALSO
26+
27+
[ronin-wordlists-download](ronin-wordlists-download.1.md) [ronin-wordlists-list](ronin-wordlists-list.1.md) [ronin-wordlists-remove](ronin-wordlists-remove.1.md) [ronin-wordlists-update](ronin-wordlists-update.1.md)

man/ronin-wordlists-list.1.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ Lists the downloaded wordlists.
1818
`-d`, `--wordlist-dir` *DIR*
1919
: The alternative wordlist directory to search.
2020

21-
`-a`, `--available`
22-
: Lists built-in wordlists that are available for download.
23-
2421
`-h`, `--help`
2522
: Prints help information.
2623

@@ -44,4 +41,4 @@ Postmodern <postmodern.mod3@gmail.com>
4441

4542
## SEE ALSO
4643

47-
[ronin-wordlists-download](ronin-wordlists-download.1.md) [ronin-wordlists-list](ronin-wordlists-list.1.md) [ronin-wordlists-remove](ronin-wordlists-remove.1.md) [ronin-wordlists-update](ronin-wordlists-update.1.md)
44+
[ronin-wordlists-download](ronin-wordlists-download.1.md) [ronin-wordlists-list](ronin-wordlists-list.1.md) [ronin-wordlists-remove](ronin-wordlists-remove.1.md) [ronin-wordlists-update](ronin-wordlists-update.1.md)

man/ronin-wordlists.1.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Command suite that manages wordlists.
2020

2121
## COMMANDS
2222

23+
`available`
24+
: Lists wordlists available for download or installation.
25+
2326
`completion`
2427
: Manages the shell completion rules for `ronin-wordlists`.
2528

@@ -58,4 +61,4 @@ Postmodern <postmodern.mod3@gmail.com>
5861

5962
## SEE ALSO
6063

61-
[ronin-wordlists-completion](ronin-wordlists-completion.1.md) [ronin-wordlists-download](ronin-wordlists-download.1.md) [ronin-wordlists-list](ronin-wordlists-list.1.md) [ronin-wordlists-remove](ronin-wordlists-remove.1.md) [ronin-wordlists-update](ronin-wordlists-update.1.md) [ronin-wordlists-purge](ronin-wordlists-purge.1.md)
64+
[ronin-wordlists-available](ronin-wordlists-available.1.md) [ronin-wordlists-completion](ronin-wordlists-completion.1.md) [ronin-wordlists-download](ronin-wordlists-download.1.md) [ronin-wordlists-list](ronin-wordlists-list.1.md) [ronin-wordlists-remove](ronin-wordlists-remove.1.md) [ronin-wordlists-update](ronin-wordlists-update.1.md) [ronin-wordlists-purge](ronin-wordlists-purge.1.md)

spec/cli/commands/available_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'spec_helper'
2+
require 'ronin/wordlists/cli/commands/available'
3+
require_relative 'man_page_example'
4+
5+
describe Ronin::Wordlists::CLI::Commands::Available do
6+
include_examples "man_page"
7+
end

0 commit comments

Comments
 (0)