diff --git a/lib/ronin/cli/commands/decode.rb b/lib/ronin/cli/commands/decode.rb index 5497ffa3b..7c6084100 100644 --- a/lib/ronin/cli/commands/decode.rb +++ b/lib/ronin/cli/commands/decode.rb @@ -44,6 +44,7 @@ module Commands # -H, --html HTML decodes the data # -u, --uri URI decodes the data # --http HTTP decodes the data + # -J, --java Java decodes the data # -j, --js JavaScript decodes the data # -n, --nodejs Node.js decodes the data # -S, --shell Encodes the data as a Shell String @@ -130,6 +131,12 @@ class Decode < StringMethodsCommand @method_calls << :http_decode end + option :java, short: '-J', + desc: 'Java decodes the data' do + require 'ronin/support/encoding/java' + @method_calls << :java_decode + end + option :js, short: '-j', desc: 'JavaScript decodes the data' do require 'ronin/support/encoding/js' diff --git a/man/ronin-decode.1.md b/man/ronin-decode.1.md index b4a21ad26..c54fb6d1d 100644 --- a/man/ronin-decode.1.md +++ b/man/ronin-decode.1.md @@ -63,6 +63,9 @@ Decodes each character of the given data from a variety of formats. `--http` : HTTP decodes the data. +`-J`, `--java` +: Java decodes the data. + `-j`, `--js` : JavaScript decodes the data. diff --git a/spec/cli/commands/decode_spec.rb b/spec/cli/commands/decode_spec.rb index 9ecf20ab7..38608161d 100644 --- a/spec/cli/commands/decode_spec.rb +++ b/spec/cli/commands/decode_spec.rb @@ -92,6 +92,18 @@ end end + describe "--java" do + let(:argv) { %w[--java] } + + it "must require 'ronin/support/encoding/java'" do + expect(require('ronin/support/encoding/java')).to be(false) + end + + it "must add :java_decode to #method_calls" do + expect(subject.method_calls.last).to eq(:java_decode) + end + end + describe "--js" do let(:argv) { %w[--js] }