ronin 2.0.0.beta1 → 2.0.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -4
  3. data/data/new/project/Rakefile +3 -3
  4. data/data/new/project/project.rb.erb +1 -1
  5. data/gemspec.yml +12 -6
  6. data/lib/ronin/cli/char_set_options.rb +81 -68
  7. data/lib/ronin/cli/commands/dns.rb +3 -95
  8. data/lib/ronin/cli/commands/extract.rb +17 -7
  9. data/lib/ronin/cli/commands/grep.rb +17 -7
  10. data/lib/ronin/cli/commands/hexdump.rb +8 -2
  11. data/lib/ronin/cli/commands/host.rb +6 -88
  12. data/lib/ronin/cli/commands/http.rb +11 -11
  13. data/lib/ronin/cli/commands/public_suffix_list.rb +16 -2
  14. data/lib/ronin/cli/commands/tld_list.rb +16 -2
  15. data/lib/ronin/cli/dns.rb +136 -0
  16. data/lib/ronin/cli/pattern_options.rb +200 -85
  17. data/lib/ronin/cli.rb +5 -0
  18. data/lib/ronin/version.rb +1 -1
  19. data/man/ronin-extract.1 +52 -12
  20. data/man/ronin-extract.1.md +42 -12
  21. data/man/ronin-grep.1 +52 -12
  22. data/man/ronin-grep.1.md +42 -12
  23. data/man/ronin-http.1 +2 -2
  24. data/man/ronin-http.1.md +1 -1
  25. data/ronin.gemspec +2 -1
  26. metadata +15 -25
  27. data/spec/cli/command_spec.rb +0 -10
  28. data/spec/cli/commands/decode_spec.rb +0 -152
  29. data/spec/cli/commands/encode_spec.rb +0 -152
  30. data/spec/cli/commands/escape_spec.rb +0 -128
  31. data/spec/cli/commands/quote_spec.rb +0 -76
  32. data/spec/cli/commands/unescape_spec.rb +0 -128
  33. data/spec/cli/commands/unquote_spec.rb +0 -80
  34. data/spec/cli/fixtures/file.txt +0 -3
  35. data/spec/cli/fixtures/file2.txt +0 -3
  36. data/spec/cli/key_options_spec.rb +0 -56
  37. data/spec/cli/method_options_spec.rb +0 -71
  38. data/spec/cli/string_methods_command_spec.rb +0 -25
  39. data/spec/cli/string_processor_command_spec.rb +0 -258
  40. data/spec/cli/value_processor_command_spec.rb +0 -127
  41. data/spec/spec_helper.rb +0 -5
  42. data/spec/version_spec.rb +0 -11
@@ -1,128 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/commands/escape'
3
-
4
- describe Ronin::CLI::Commands::Escape do
5
- describe "options" do
6
- before { subject.parse_options(argv) }
7
-
8
- describe "--c" do
9
- let(:argv) { %w[--c] }
10
-
11
- it "must require 'ronin/support/encoding/c'" do
12
- expect(require 'ronin/support/encoding/c').to be(false)
13
- end
14
-
15
- it "must add :c_escape to #method_calls" do
16
- expect(subject.method_calls.last).to eq(:c_escape)
17
- end
18
- end
19
-
20
- describe "--hex" do
21
- let(:argv) { %w[--hex] }
22
-
23
- it "must require 'ronin/support/encoding/hex'" do
24
- expect(require 'ronin/support/encoding/hex').to be(false)
25
- end
26
-
27
- it "must add :hex_escape to #method_calls" do
28
- expect(subject.method_calls.last).to eq(:hex_escape)
29
- end
30
- end
31
-
32
- describe "--html" do
33
- let(:argv) { %w[--html] }
34
-
35
- it "must require 'ronin/support/encoding/html'" do
36
- expect(require 'ronin/support/encoding/html').to be(false)
37
- end
38
-
39
- it "must add :html_escape to #method_calls" do
40
- expect(subject.method_calls.last).to eq(:html_escape)
41
- end
42
- end
43
-
44
- describe "--uri" do
45
- let(:argv) { %w[--uri] }
46
-
47
- it "must require 'ronin/support/encoding/uri'" do
48
- expect(require 'ronin/support/encoding/uri').to be(false)
49
- end
50
-
51
- it "must add :uri_escape to #method_calls" do
52
- expect(subject.method_calls.last).to eq(:uri_escape)
53
- end
54
- end
55
-
56
- describe "--http" do
57
- let(:argv) { %w[--http] }
58
-
59
- it "must require 'ronin/support/encoding/http'" do
60
- expect(require 'ronin/support/encoding/http').to be(false)
61
- end
62
-
63
- it "must add :http_escape to #method_calls" do
64
- expect(subject.method_calls.last).to eq(:http_escape)
65
- end
66
- end
67
-
68
- describe "--js" do
69
- let(:argv) { %w[--js] }
70
-
71
- it "must require 'ronin/support/encoding/js'" do
72
- expect(require 'ronin/support/encoding/js').to be(false)
73
- end
74
-
75
- it "must add :js_escape to #method_calls" do
76
- expect(subject.method_calls.last).to eq(:js_escape)
77
- end
78
- end
79
-
80
- describe "--shell" do
81
- let(:argv) { %w[--shell] }
82
-
83
- it "must require 'ronin/support/encoding/shell'" do
84
- expect(require 'ronin/support/encoding/shell').to be(false)
85
- end
86
-
87
- it "must add :shell_escape to #method_calls" do
88
- expect(subject.method_calls.last).to eq(:shell_escape)
89
- end
90
- end
91
-
92
- describe "--powershell" do
93
- let(:argv) { %w[--powershell] }
94
-
95
- it "must require 'ronin/support/encoding/powershell'" do
96
- expect(require 'ronin/support/encoding/powershell').to be(false)
97
- end
98
-
99
- it "must add :powershell_escape to #method_calls" do
100
- expect(subject.method_calls.last).to eq(:powershell_escape)
101
- end
102
- end
103
-
104
- describe "--xml" do
105
- let(:argv) { %w[--xml] }
106
-
107
- it "must require 'ronin/support/encoding/xml'" do
108
- expect(require 'ronin/support/encoding/xml').to be(false)
109
- end
110
-
111
- it "must add :xml_escape to #method_calls" do
112
- expect(subject.method_calls.last).to eq(:xml_escape)
113
- end
114
- end
115
-
116
- describe "--ruby" do
117
- let(:argv) { %w[--ruby] }
118
-
119
- it "must require 'ronin/support/encoding/ruby'" do
120
- expect(require 'ronin/support/encoding/ruby').to be(false)
121
- end
122
-
123
- it "must add :ruby_escape to #method_calls" do
124
- expect(subject.method_calls.last).to eq(:ruby_escape)
125
- end
126
- end
127
- end
128
- end
@@ -1,76 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/commands/quote'
3
-
4
- describe Ronin::CLI::Commands::Quote do
5
- describe "options" do
6
- before { subject.parse_options(argv) }
7
-
8
- describe "--c" do
9
- let(:argv) { %w[--c] }
10
-
11
- it "must require 'ronin/support/encoding/c'" do
12
- expect(require 'ronin/support/encoding/c').to be(false)
13
- end
14
-
15
- it "must add :c_string to #method_calls" do
16
- expect(subject.method_calls.last).to eq(:c_string)
17
- end
18
- end
19
-
20
- describe "--hex" do
21
- let(:argv) { %w[--hex] }
22
-
23
- it "must require 'ronin/support/encoding/hex'" do
24
- expect(require 'ronin/support/encoding/hex').to be(false)
25
- end
26
-
27
- it "must add :hex_string to #method_calls" do
28
- expect(subject.method_calls.last).to eq(:hex_string)
29
- end
30
- end
31
-
32
- describe "--js" do
33
- let(:argv) { %w[--js] }
34
-
35
- it "must require 'ronin/support/encoding/js'" do
36
- expect(require 'ronin/support/encoding/js').to be(false)
37
- end
38
-
39
- it "must add :js_string to #method_calls" do
40
- expect(subject.method_calls.last).to eq(:js_string)
41
- end
42
- end
43
-
44
- describe "--shell" do
45
- let(:argv) { %w[--shell] }
46
-
47
- it "must require 'ronin/support/encoding/shell'" do
48
- expect(require 'ronin/support/encoding/shell').to be(false)
49
- end
50
-
51
- it "must add :shell_string to #method_calls" do
52
- expect(subject.method_calls.last).to eq(:shell_string)
53
- end
54
- end
55
-
56
- describe "--powershell" do
57
- let(:argv) { %w[--powershell] }
58
-
59
- it "must require 'ronin/support/encoding/powershell'" do
60
- expect(require 'ronin/support/encoding/powershell').to be(false)
61
- end
62
-
63
- it "must add :powershell_string to #method_calls" do
64
- expect(subject.method_calls.last).to eq(:powershell_string)
65
- end
66
- end
67
-
68
- describe "--ruby" do
69
- let(:argv) { %w[--ruby] }
70
-
71
- it "must add :ruby_string to #method_calls" do
72
- expect(subject.method_calls.last).to eq(:ruby_string)
73
- end
74
- end
75
- end
76
- end
@@ -1,128 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/commands/unescape'
3
-
4
- describe Ronin::CLI::Commands::Unescape do
5
- describe "options" do
6
- before { subject.parse_options(argv) }
7
-
8
- describe "--c" do
9
- let(:argv) { %w[--c] }
10
-
11
- it "must require 'ronin/support/encoding/c'" do
12
- expect(require 'ronin/support/encoding/c').to be(false)
13
- end
14
-
15
- it "must add :c_unescape to #method_calls" do
16
- expect(subject.method_calls.last).to eq(:c_unescape)
17
- end
18
- end
19
-
20
- describe "--hex" do
21
- let(:argv) { %w[--hex] }
22
-
23
- it "must require 'ronin/support/encoding/hex'" do
24
- expect(require 'ronin/support/encoding/hex').to be(false)
25
- end
26
-
27
- it "must add :hex_unescape to #method_calls" do
28
- expect(subject.method_calls.last).to eq(:hex_unescape)
29
- end
30
- end
31
-
32
- describe "--html" do
33
- let(:argv) { %w[--html] }
34
-
35
- it "must require 'ronin/support/encoding/html'" do
36
- expect(require 'ronin/support/encoding/html').to be(false)
37
- end
38
-
39
- it "must add :html_unescape to #method_calls" do
40
- expect(subject.method_calls.last).to eq(:html_unescape)
41
- end
42
- end
43
-
44
- describe "--uri" do
45
- let(:argv) { %w[--uri] }
46
-
47
- it "must require 'ronin/support/encoding/uri'" do
48
- expect(require 'ronin/support/encoding/uri').to be(false)
49
- end
50
-
51
- it "must add :uri_unescape to #method_calls" do
52
- expect(subject.method_calls.last).to eq(:uri_unescape)
53
- end
54
- end
55
-
56
- describe "--http" do
57
- let(:argv) { %w[--http] }
58
-
59
- it "must require 'ronin/support/encoding/http'" do
60
- expect(require 'ronin/support/encoding/http').to be(false)
61
- end
62
-
63
- it "must add :http_unescape to #method_calls" do
64
- expect(subject.method_calls.last).to eq(:http_unescape)
65
- end
66
- end
67
-
68
- describe "--js" do
69
- let(:argv) { %w[--js] }
70
-
71
- it "must require 'ronin/support/encoding/js'" do
72
- expect(require 'ronin/support/encoding/js').to be(false)
73
- end
74
-
75
- it "must add :js_unescape to #method_calls" do
76
- expect(subject.method_calls.last).to eq(:js_unescape)
77
- end
78
- end
79
-
80
- describe "--shell" do
81
- let(:argv) { %w[--shell] }
82
-
83
- it "must require 'ronin/support/encoding/shell'" do
84
- expect(require 'ronin/support/encoding/shell').to be(false)
85
- end
86
-
87
- it "must add :shell_unescape to #method_calls" do
88
- expect(subject.method_calls.last).to eq(:shell_unescape)
89
- end
90
- end
91
-
92
- describe "--powershell" do
93
- let(:argv) { %w[--powershell] }
94
-
95
- it "must require 'ronin/support/encoding/powershell'" do
96
- expect(require 'ronin/support/encoding/powershell').to be(false)
97
- end
98
-
99
- it "must add :powershell_unescape to #method_calls" do
100
- expect(subject.method_calls.last).to eq(:powershell_unescape)
101
- end
102
- end
103
-
104
- describe "--xml" do
105
- let(:argv) { %w[--xml] }
106
-
107
- it "must require 'ronin/support/encoding/xml'" do
108
- expect(require 'ronin/support/encoding/xml').to be(false)
109
- end
110
-
111
- it "must add :xml_unescape to #method_calls" do
112
- expect(subject.method_calls.last).to eq(:xml_unescape)
113
- end
114
- end
115
-
116
- describe "--ruby" do
117
- let(:argv) { %w[--ruby] }
118
-
119
- it "must require 'ronin/support/encoding/ruby'" do
120
- expect(require 'ronin/support/encoding/ruby').to be(false)
121
- end
122
-
123
- it "must add :ruby_unescape to #method_calls" do
124
- expect(subject.method_calls.last).to eq(:ruby_unescape)
125
- end
126
- end
127
- end
128
- end
@@ -1,80 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/commands/unquote'
3
-
4
- describe Ronin::CLI::Commands::Unquote do
5
- describe "options" do
6
- before { subject.parse_options(argv) }
7
-
8
- describe "--c" do
9
- let(:argv) { %w[--c] }
10
-
11
- it "must require 'ronin/support/encoding/c'" do
12
- expect(require 'ronin/support/encoding/c').to be(false)
13
- end
14
-
15
- it "must add :c_unquote to #method_calls" do
16
- expect(subject.method_calls.last).to eq(:c_unquote)
17
- end
18
- end
19
-
20
- describe "--hex" do
21
- let(:argv) { %w[--hex] }
22
-
23
- it "must require 'ronin/support/encoding/hex'" do
24
- expect(require 'ronin/support/encoding/hex').to be(false)
25
- end
26
-
27
- it "must add :hex_unquote to #method_calls" do
28
- expect(subject.method_calls.last).to eq(:hex_unquote)
29
- end
30
- end
31
-
32
- describe "--js" do
33
- let(:argv) { %w[--js] }
34
-
35
- it "must require 'ronin/support/encoding/js'" do
36
- expect(require 'ronin/support/encoding/js').to be(false)
37
- end
38
-
39
- it "must add :js_unquote to #method_calls" do
40
- expect(subject.method_calls.last).to eq(:js_unquote)
41
- end
42
- end
43
-
44
- describe "--shell" do
45
- let(:argv) { %w[--shell] }
46
-
47
- it "must require 'ronin/support/encoding/shell'" do
48
- expect(require 'ronin/support/encoding/shell').to be(false)
49
- end
50
-
51
- it "must add :shell_unquote to #method_calls" do
52
- expect(subject.method_calls.last).to eq(:shell_unquote)
53
- end
54
- end
55
-
56
- describe "--powershell" do
57
- let(:argv) { %w[--powershell] }
58
-
59
- it "must require 'ronin/support/encoding/powershell'" do
60
- expect(require 'ronin/support/encoding/powershell').to be(false)
61
- end
62
-
63
- it "must add :powershell_unquote to #method_calls" do
64
- expect(subject.method_calls.last).to eq(:powershell_unquote)
65
- end
66
- end
67
-
68
- describe "--ruby" do
69
- let(:argv) { %w[--ruby] }
70
-
71
- it "must require 'ronin/support/encoding/ruby'" do
72
- expect(require 'ronin/support/encoding/ruby').to be(false)
73
- end
74
-
75
- it "must add :ruby_unquote to #method_calls" do
76
- expect(subject.method_calls.last).to eq(:ruby_unquote)
77
- end
78
- end
79
- end
80
- end
@@ -1,3 +0,0 @@
1
- foo
2
- bar
3
- baz
@@ -1,3 +0,0 @@
1
- qux
2
- quux
3
- corge
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/key_options'
3
- require 'ronin/cli/command'
4
-
5
- describe Ronin::CLI::KeyOptions do
6
- module TestKeyOptions
7
- class TestCommand < Ronin::CLI::Command
8
- include Ronin::CLI::KeyOptions
9
- end
10
- end
11
-
12
- let(:test_class) { TestKeyOptions::TestCommand }
13
- subject { test_class.new }
14
-
15
- describe ".included" do
16
- subject { test_class }
17
-
18
- it "must define a --key option" do
19
- expect(subject.options[:key]).to be_kind_of(CommandKit::Options::Option)
20
- expect(subject.options[:key].short).to eq('-k')
21
- expect(subject.options[:key].long).to eq('--key')
22
- expect(subject.options[:key].desc).to eq("The key String")
23
- end
24
-
25
- it "must define a --key-file option" do
26
- expect(subject.options[:key_file]).to be_kind_of(CommandKit::Options::Option)
27
- expect(subject.options[:key_file].short).to eq('-K')
28
- expect(subject.options[:key_file].long).to eq('--key-file')
29
- expect(subject.options[:key_file].desc).to eq("The key file")
30
- end
31
- end
32
-
33
- describe "options" do
34
- before { subject.parse_options(argv) }
35
-
36
- context "when the --key option is parsed" do
37
- let(:key) { 'foo' }
38
- let(:argv) { ['--key', key] }
39
-
40
- it "must set #key to the given argument" do
41
- expect(subject.key).to eq(key)
42
- end
43
- end
44
-
45
- context "when the --key-file option is parsed" do
46
- let(:fixtures_dir) { File.join(__dir__,'fixtures') }
47
- let(:key_file) { File.join(fixtures_dir,'file.txt') }
48
-
49
- let(:argv) { ['--key-file', key_file] }
50
-
51
- it "must read the key file and set #key" do
52
- expect(subject.key).to eq(File.binread(key_file))
53
- end
54
- end
55
- end
56
- end
@@ -1,71 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/method_options'
3
- require 'ronin/cli/command'
4
-
5
- describe Ronin::CLI::MethodOptions do
6
- module TestMethodOptions
7
- class TestCommand < Ronin::CLI::Command
8
- include Ronin::CLI::MethodOptions
9
- end
10
- end
11
-
12
- let(:test_class) { TestMethodOptions::TestCommand }
13
- subject { test_class.new }
14
-
15
- describe "#initialize" do
16
- it "must initialize #methods_calls to an empty Array" do
17
- expect(subject.method_calls).to eq([])
18
- end
19
- end
20
-
21
- describe "#apply_method_options" do
22
- let(:object) { 'hello world' }
23
-
24
- before do
25
- subject.method_calls << [:upcase]
26
- subject.method_calls << [:reverse]
27
- end
28
-
29
- it "must apply all method options to the given String" do
30
- expect(subject.apply_method_options(object)).to eq("DLROW OLLEH")
31
- end
32
-
33
- context "when #method_calls contains an entry with arguments" do
34
- before do
35
- subject.method_calls << [:slice, [0, 5]]
36
- end
37
-
38
- it "must call that method with the given arguments Array" do
39
- expect(subject.apply_method_options(object)).to eq("DLROW")
40
- end
41
- end
42
-
43
- context "when #method_calls contains a private method" do
44
- let(:method_name) { :puts }
45
-
46
- before do
47
- subject.method_calls << [method_name, "shouldn't print this"]
48
- end
49
-
50
- it do
51
- expect {
52
- subject.apply_method_options(object)
53
- }.to raise_error(ArgumentError,"cannot call method Object##{method_name} on object \"DLROW OLLEH\"")
54
- end
55
- end
56
-
57
- context "when #method_calls contains a method inherited from Object" do
58
- let(:method_name) { :instance_eval }
59
-
60
- before do
61
- subject.method_calls << [method_name, "1 + 1"]
62
- end
63
-
64
- it do
65
- expect {
66
- subject.apply_method_options(object)
67
- }.to raise_error(ArgumentError,"cannot call method Object##{method_name} on object \"DLROW OLLEH\"")
68
- end
69
- end
70
- end
71
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/cli/string_methods_command'
3
-
4
- describe Ronin::CLI::StringMethodsCommand do
5
- module TestStringMethodsCommand
6
- class TestCommand < Ronin::CLI::StringMethodsCommand
7
- end
8
- end
9
-
10
- let(:test_class) { TestStringMethodsCommand::TestCommand }
11
- subject { test_class.new }
12
-
13
- describe "#process_string" do
14
- let(:string) { 'hello world' }
15
-
16
- before do
17
- subject.method_calls << [:upcase]
18
- subject.method_calls << [:reverse]
19
- end
20
-
21
- it "must apply all method options to the given String" do
22
- expect(subject.process_string(string)).to eq("DLROW OLLEH")
23
- end
24
- end
25
- end