wordlist 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3648b45622323ff7c7c9a39d3cdb458d40388f1f0840fb80b917239df7ae995a
4
- data.tar.gz: 8302f069d5a7dfd68103cfa106df8ade1b1d00f7f6755be7158dd7acd2a4bf0e
3
+ metadata.gz: 1e732c8a8b2aa358e9c21c46fd9b5f509b5aeef52d51477ceb49111f94a4102d
4
+ data.tar.gz: 0cb119f423d984b5538b5547f972a7c6c54e1e96e52e461acf3ba13328e8f4d5
5
5
  SHA512:
6
- metadata.gz: 01662d4d752294cca6da0809f7dfc0a953f7702259c448d73b4cfc796d214ce90797e4eedc80ebd48d005ec67039124ab5e974add35fadc8552f5cc9e6683de1
7
- data.tar.gz: d29b36e5319a75bd9d88617451e6a7fda6c0cf4d0fe4cb43fd41b19da1e960135a57982b09f3ce93ff106668443ba03f26479a664c73737cc7721d8e2d0f26e5
6
+ metadata.gz: b060a80fafcd2e24a1771537030085d19b70722b8436a62e810b2cc2ab876ac3c132b036d625ae496b2b2c2f18c11a75761b0ab6933878a29207f28cfb1b8a73
7
+ data.tar.gz: edef70fcf4bbcf6ab3d0ff4f78281bd4c1edca5535c057a515f662c5cd0efcae254a492d301d7d583ac622c0177961c3b028c2431d94a95da3d03116579824f1
@@ -4,18 +4,22 @@ on: [ push, pull_request ]
4
4
 
5
5
  jobs:
6
6
  tests:
7
- runs-on: ubuntu-latest
7
+ runs-on: ${{ matrix.os }}
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
+ os:
12
+ - ubuntu-latest
13
+ - macos-latest
11
14
  ruby:
12
15
  - 2.6
13
16
  - 2.7
14
17
  - 3.0
15
18
  - 3.1
19
+ - 3.2
16
20
  - jruby
17
21
  - truffleruby
18
- name: Ruby ${{ matrix.ruby }}
22
+ name: OS ${{ matrix.os }} / Ruby ${{ matrix.ruby }}
19
23
  steps:
20
24
  - uses: actions/checkout@v2
21
25
  - name: Set up Ruby
data/ChangeLog.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### 1.0.3 / 2023-08-04
2
+
3
+ * Fix reading of compressed wordlists on macOS.
4
+ * macOS's version of `zcat`, `bzcat`, and `xzcat` do not accept a file path
5
+ argument, but instead require the compressed input be piped or redirected
6
+ into them (ex: `zcat < path/to/file.gz`).
7
+
8
+ ### 1.0.2 / 2023-07-18
9
+
10
+ #### CLI
11
+
12
+ * Fixed a bug where operator options (ex: `--power 3`) were not being applied
13
+ to the wordlist.
14
+
1
15
  ### 1.0.1 / 2023-07-17
2
16
 
3
17
  * Require Ruby >= 2.0.0.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2021 Hal Brodigan
1
+ Copyright (c) 2009-2023 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -332,6 +332,6 @@ Wordlist::File#mutate_case (N=1000) 24.178521 0.000000 24.178521 ( 24.2
332
332
 
333
333
  ## License
334
334
 
335
- Copyright (c) 2009-2021 Hal Brodigan
335
+ Copyright (c) 2009-2023 Hal Brodigan
336
336
 
337
337
  See {file:LICENSE.txt} for details.
data/lib/wordlist/cli.rb CHANGED
@@ -239,7 +239,7 @@ module Wordlist
239
239
 
240
240
  # apply operators first
241
241
  @operators.each do |(operator,args)|
242
- wordlist.send(operator,*args)
242
+ wordlist = wordlist.send(operator,*args)
243
243
  end
244
244
 
245
245
  # then apply modifiers
@@ -37,7 +37,7 @@ module Wordlist
37
37
  raise(UnknownFormat,"unsupported format: #{format.inspect}")
38
38
  end
39
39
 
40
- Shellwords.shelljoin([command, path])
40
+ "#{command} < #{Shellwords.shellescape(path)}"
41
41
  end
42
42
 
43
43
  #
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Wordlist
4
4
  # wordlist version
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.3'
6
6
  end
data/spec/cli_spec.rb CHANGED
@@ -683,6 +683,35 @@ Please report the following text to: #{Regexp.escape(described_class::BUG_REPORT
683
683
  ).to_stdout
684
684
  end
685
685
 
686
+ context "when a modifier option is also given" do
687
+ let(:expected_words) { super().map(&:capitalize) }
688
+ let(:argv) { ["--capitalize", file] }
689
+
690
+ it "must apply the modifier to each word in the wordist" do
691
+ expect {
692
+ subject.run(argv)
693
+ }.to output(
694
+ expected_words.join($/) + $/
695
+ ).to_stdout
696
+ end
697
+ end
698
+
699
+ context "when an operator option is also given" do
700
+ let(:expected_words) do
701
+ super().product(super()).map(&:join)
702
+ end
703
+
704
+ let(:argv) { ["--power",'2', file] }
705
+
706
+ it "must apply the operator to the wordist" do
707
+ expect {
708
+ subject.run(argv)
709
+ }.to output(
710
+ expected_words.join($/) + $/
711
+ ).to_stdout
712
+ end
713
+ end
714
+
686
715
  context "when also given the --exec COMMAND option" do
687
716
  let(:command) { 'echo "WORD: {}"' }
688
717
  let(:argv) { ["--exec", command, file] }
@@ -8,15 +8,15 @@ describe Wordlist::Compression::Reader do
8
8
  context "when given format: :gzip" do
9
9
  subject { described_class.command(path, format: :gzip) }
10
10
 
11
- it "must return 'zcat path/to/file'" do
12
- expect(subject).to eq("zcat #{path}")
11
+ it "must return 'zcat < path/to/file'" do
12
+ expect(subject).to eq("zcat < #{path}")
13
13
  end
14
14
 
15
15
  context "and the file contains special characters" do
16
16
  let(:path) { 'path/to/the file' }
17
17
 
18
18
  it "must shellescape them" do
19
- expect(subject).to eq("zcat #{Shellwords.shellescape(path)}")
19
+ expect(subject).to eq("zcat < #{Shellwords.shellescape(path)}")
20
20
  end
21
21
  end
22
22
  end
@@ -24,15 +24,15 @@ describe Wordlist::Compression::Reader do
24
24
  context "when given format: :bzip2" do
25
25
  subject { described_class.command(path, format: :bzip2) }
26
26
 
27
- it "must return 'bzcat path/to/file'" do
28
- expect(subject).to eq("bzcat #{path}")
27
+ it "must return 'bzcat < path/to/file'" do
28
+ expect(subject).to eq("bzcat < #{path}")
29
29
  end
30
30
 
31
31
  context "and the file contains special characters" do
32
32
  let(:path) { 'path/to/the file' }
33
33
 
34
34
  it "must shellescape them" do
35
- expect(subject).to eq("bzcat #{Shellwords.shellescape(path)}")
35
+ expect(subject).to eq("bzcat < #{Shellwords.shellescape(path)}")
36
36
  end
37
37
  end
38
38
  end
@@ -40,15 +40,15 @@ describe Wordlist::Compression::Reader do
40
40
  context "when given format: :xz" do
41
41
  subject { described_class.command(path, format: :xz) }
42
42
 
43
- it "must return 'xzcat path/to/file'" do
44
- expect(subject).to eq("xzcat #{path}")
43
+ it "must return 'xzcat < path/to/file'" do
44
+ expect(subject).to eq("xzcat < #{path}")
45
45
  end
46
46
 
47
47
  context "and the file contains special characters" do
48
48
  let(:path) { 'path/to/the file' }
49
49
 
50
50
  it "must shellescape them" do
51
- expect(subject).to eq("xzcat #{Shellwords.shellescape(path)}")
51
+ expect(subject).to eq("xzcat < #{Shellwords.shellescape(path)}")
52
52
  end
53
53
  end
54
54
  end
@@ -69,7 +69,7 @@ describe Wordlist::Compression::Reader do
69
69
 
70
70
  context "when given format: :gzip" do
71
71
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.gz') }
72
- let(:expected_contents) { `zcat #{Shellwords.shellescape(path)}` }
72
+ let(:expected_contents) { `zcat < #{Shellwords.shellescape(path)}` }
73
73
 
74
74
  subject { described_class.open(path, format: :gzip) }
75
75
 
@@ -86,7 +86,7 @@ describe Wordlist::Compression::Reader do
86
86
 
87
87
  context "when given format: :bzip2" do
88
88
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.bz2') }
89
- let(:expected_contents) { `bzcat #{Shellwords.shellescape(path)}` }
89
+ let(:expected_contents) { `bzcat < #{Shellwords.shellescape(path)}` }
90
90
 
91
91
  subject { described_class.open(path, format: :bzip2) }
92
92
 
@@ -103,7 +103,7 @@ describe Wordlist::Compression::Reader do
103
103
 
104
104
  context "when given format: :xz" do
105
105
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.xz') }
106
- let(:expected_contents) { `xzcat #{Shellwords.shellescape(path)}` }
106
+ let(:expected_contents) { `xzcat < #{Shellwords.shellescape(path)}` }
107
107
 
108
108
  subject { described_class.open(path, format: :xz) }
109
109
 
@@ -120,7 +120,7 @@ describe Wordlist::Compression::Reader do
120
120
 
121
121
  context "when the command is not installed" do
122
122
  let(:format) { :gzip }
123
- let(:command) { Shellwords.shelljoin(['zcat', path]) }
123
+ let(:command) { "zcat < #{Shellwords.shellescape(path)}" }
124
124
  let(:path) { 'path/to/wordlist.gz' }
125
125
 
126
126
  before do
@@ -110,7 +110,7 @@ describe Wordlist::Compression::Writer do
110
110
  subject.close
111
111
  end
112
112
 
113
- let(:written_contents) { `zcat #{Shellwords.shellescape(path)}` }
113
+ let(:written_contents) { `zcat < #{Shellwords.shellescape(path)}` }
114
114
  let(:written_words) { written_contents.lines.map(&:chomp) }
115
115
 
116
116
  it "must writing gzip compressed data to the file" do
@@ -136,7 +136,7 @@ describe Wordlist::Compression::Writer do
136
136
  subject.close
137
137
  end
138
138
 
139
- let(:written_contents) { `bzcat #{Shellwords.shellescape(path)}` }
139
+ let(:written_contents) { `bzcat < #{Shellwords.shellescape(path)}` }
140
140
  let(:written_words) { written_contents.lines.map(&:chomp) }
141
141
 
142
142
  it "must writing bzip2 compressed data to the file" do
@@ -162,7 +162,7 @@ describe Wordlist::Compression::Writer do
162
162
  subject.close
163
163
  end
164
164
 
165
- let(:written_contents) { `xzcat #{Shellwords.shellescape(path)}` }
165
+ let(:written_contents) { `xzcat < #{Shellwords.shellescape(path)}` }
166
166
  let(:written_words) { written_contents.lines.map(&:chomp) }
167
167
 
168
168
  it "must writing xz compressed data to the file" do
data/spec/file_spec.rb CHANGED
@@ -132,7 +132,7 @@ describe Wordlist::File do
132
132
 
133
133
  context "and the wordlist format is gzip" do
134
134
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.gz') }
135
- let(:expected_contents) { `zcat #{Shellwords.shellescape(path)}` }
135
+ let(:expected_contents) { `zcat < #{Shellwords.shellescape(path)}` }
136
136
 
137
137
  it "must read the uncompressed gzip data" do
138
138
  expect { |b|
@@ -143,7 +143,7 @@ describe Wordlist::File do
143
143
 
144
144
  context "and the wordlist format is bzip2" do
145
145
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.bz2') }
146
- let(:expected_contents) { `bzcat #{Shellwords.shellescape(path)}` }
146
+ let(:expected_contents) { `bzcat < #{Shellwords.shellescape(path)}` }
147
147
 
148
148
  it "must read the uncompressed gzip data" do
149
149
  expect { |b|
@@ -154,7 +154,7 @@ describe Wordlist::File do
154
154
 
155
155
  context "and the wordlist format is xz" do
156
156
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.xz') }
157
- let(:expected_contents) { `xzcat #{Shellwords.shellescape(path)}` }
157
+ let(:expected_contents) { `xzcat < #{Shellwords.shellescape(path)}` }
158
158
 
159
159
  it "must read the uncompressed gzip data" do
160
160
  expect { |b|
@@ -172,7 +172,7 @@ describe Wordlist::File do
172
172
 
173
173
  context "and the wordlist format is gzip" do
174
174
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.gz') }
175
- let(:expected_contents) { `zcat #{Shellwords.shellescape(path)}` }
175
+ let(:expected_contents) { `zcat < #{Shellwords.shellescape(path)}` }
176
176
 
177
177
  it "must return an Enumerator of the uncompressed gzip data" do
178
178
  expect(subject.each_line).to be_kind_of(Enumerator)
@@ -182,7 +182,7 @@ describe Wordlist::File do
182
182
 
183
183
  context "and the wordlist format is bzip2" do
184
184
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.bz2') }
185
- let(:expected_contents) { `bzcat #{Shellwords.shellescape(path)}` }
185
+ let(:expected_contents) { `bzcat < #{Shellwords.shellescape(path)}` }
186
186
 
187
187
  it "must return an Enumerator of the compressed gzip data" do
188
188
  expect(subject.each_line).to be_kind_of(Enumerator)
@@ -192,7 +192,7 @@ describe Wordlist::File do
192
192
 
193
193
  context "and the wordlist format is xz" do
194
194
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.xz') }
195
- let(:expected_contents) { `xzcat #{Shellwords.shellescape(path)}` }
195
+ let(:expected_contents) { `xzcat < #{Shellwords.shellescape(path)}` }
196
196
 
197
197
  it "must return an Enumerator of the compressed gzip data" do
198
198
  expect(subject.each_line).to be_kind_of(Enumerator)
@@ -211,7 +211,7 @@ describe Wordlist::File do
211
211
 
212
212
  context "and the wordlist format is gzip" do
213
213
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.gz') }
214
- let(:expected_contents) { `zcat #{Shellwords.shellescape(path)}` }
214
+ let(:expected_contents) { `zcat < #{Shellwords.shellescape(path)}` }
215
215
 
216
216
  it "must read the uncompressed gzip data" do
217
217
  expect { |b|
@@ -222,7 +222,7 @@ describe Wordlist::File do
222
222
 
223
223
  context "and the wordlist format is bzip2" do
224
224
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.bz2') }
225
- let(:expected_contents) { `bzcat #{Shellwords.shellescape(path)}` }
225
+ let(:expected_contents) { `bzcat < #{Shellwords.shellescape(path)}` }
226
226
 
227
227
  it "must read the uncompressed gzip data" do
228
228
  expect { |b|
@@ -233,7 +233,7 @@ describe Wordlist::File do
233
233
 
234
234
  context "and the wordlist format is xz" do
235
235
  let(:path) { ::File.join(fixtures_dir,'wordlist.txt.xz') }
236
- let(:expected_contents) { `xzcat #{Shellwords.shellescape(path)}` }
236
+ let(:expected_contents) { `xzcat < #{Shellwords.shellescape(path)}` }
237
237
 
238
238
  it "must read the uncompressed gzip data" do
239
239
  expect { |b|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordlist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler