diff --git a/lib/ronin/cli/pattern_options.rb b/lib/ronin/cli/pattern_options.rb index a90d05e77..91423c37f 100644 --- a/lib/ronin/cli/pattern_options.rb +++ b/lib/ronin/cli/pattern_options.rb @@ -129,6 +129,34 @@ def self.define_numeric_options(command) desc: 'Searches for all version numbers' do @pattern = VERSION_NUMBER end + + command.option :alpha, desc: 'Searches for all alphabetic characters' do + @pattern = /[a-zA-Z]+/ + end + + command.option :uppercase, desc: 'Searches for all uppercase alphabetic characters' do + @pattern = /[A-Z]+/ + end + + command.option :lowercase, desc: 'Searches for all lowercase alphabetic characters' do + @pattern = /[a-z]+/ + end + + command.option :alpha_numeric, desc: 'Searches for all alphanumeric characters' do + @pattern = /[0-9a-zA-Z]+/ + end + + command.option :hex, desc: 'Searches for all hexadecimal characters' do + @pattern = /[0-9a-fA-F]+/ + end + + command.option :uppercase_hex, desc: 'Searches for all uppercase hexadecimal characters' do + @pattern = /[0-9A-F]+/ + end + + command.option :lowercase_hex, desc: 'Searches for all lowercase hexadecimal characters' do + @pattern = /[0-9a-f]+/ + end end # diff --git a/spec/cli/pattern_options_spec.rb b/spec/cli/pattern_options_spec.rb index 35d37dd62..871765d6c 100644 --- a/spec/cli/pattern_options_spec.rb +++ b/spec/cli/pattern_options_spec.rb @@ -39,6 +39,55 @@ class TestCommand < Ronin::CLI::Command expect(subject.options[:version_number].desc).to eq('Searches for all version numbers') end + it "must define a '--alpha' option" do + expect(subject.options[:alpha]).to_not be(nil) + expect(subject.options[:alpha].short).to be(nil) + expect(subject.options[:alpha].value).to be(nil) + expect(subject.options[:alpha].desc).to eq('Searches for all alphabetic characters') + end + + it "must define a '--uppercase' option" do + expect(subject.options[:uppercase]).to_not be(nil) + expect(subject.options[:uppercase].short).to be(nil) + expect(subject.options[:uppercase].value).to be(nil) + expect(subject.options[:uppercase].desc).to eq('Searches for all uppercase alphabetic characters') + end + + it "must define a '--lowercase' option" do + expect(subject.options[:lowercase]).to_not be(nil) + expect(subject.options[:lowercase].short).to be(nil) + expect(subject.options[:lowercase].value).to be(nil) + expect(subject.options[:lowercase].desc).to eq('Searches for all lowercase alphabetic characters') + end + + it "must define a '--alpha-numeric' option" do + expect(subject.options[:alpha_numeric]).to_not be(nil) + expect(subject.options[:alpha_numeric].short).to be(nil) + expect(subject.options[:alpha_numeric].value).to be(nil) + expect(subject.options[:alpha_numeric].desc).to eq('Searches for all alphanumeric characters') + end + + it "must define a '--hex' option" do + expect(subject.options[:hex]).to_not be(nil) + expect(subject.options[:hex].short).to be(nil) + expect(subject.options[:hex].value).to be(nil) + expect(subject.options[:hex].desc).to eq('Searches for all hexadecimal characters') + end + + it "must define a '--uppercase-hex' option" do + expect(subject.options[:uppercase_hex]).to_not be(nil) + expect(subject.options[:uppercase_hex].short).to be(nil) + expect(subject.options[:uppercase_hex].value).to be(nil) + expect(subject.options[:uppercase_hex].desc).to eq('Searches for all uppercase hexadecimal characters') + end + + it "must define a '--lowercase-hex' option" do + expect(subject.options[:lowercase_hex]).to_not be(nil) + expect(subject.options[:lowercase_hex].short).to be(nil) + expect(subject.options[:lowercase_hex].value).to be(nil) + expect(subject.options[:lowercase_hex].desc).to eq('Searches for all lowercase hexadecimal characters') + end + # # Language pattern options #