diff --git a/lib/ronin/cli/commands/escape.rb b/lib/ronin/cli/commands/escape.rb index fe624d02a..b685f8aab 100644 --- a/lib/ronin/cli/commands/escape.rb +++ b/lib/ronin/cli/commands/escape.rb @@ -39,6 +39,7 @@ module Commands # -H, --html HTML escapes the data # -u, --uri URI escapes the data # --http HTTP escapes the data + # -J, --java Java escapes the data # -j, --js JavaScript escapes the data # -n, --nodejs Node.js escapes the data # -S, --shell Escapes the data as a Shell String @@ -86,6 +87,12 @@ class Escape < StringMethodsCommand @method_calls << :http_escape end + option :java, short: '-J', + desc: 'Java escapes the data' do + require 'ronin/support/encoding/java' + @method_calls << :java_escape + end + option :js, short: '-j', desc: 'JavaScript escapes the data' do require 'ronin/support/encoding/js' diff --git a/man/ronin-escape.1.md b/man/ronin-escape.1.md index c2da78b9b..dea1551f6 100644 --- a/man/ronin-escape.1.md +++ b/man/ronin-escape.1.md @@ -47,6 +47,9 @@ Escapes each special character for a variety of encodings. `--http` : HTTP escapes the data. +`-J`, `--java` +: Java escapes the data. + `-j`, `--js` : JavaScript escapes the data. diff --git a/spec/cli/commands/escape_spec.rb b/spec/cli/commands/escape_spec.rb index 932098ab2..d7d8f0e2c 100644 --- a/spec/cli/commands/escape_spec.rb +++ b/spec/cli/commands/escape_spec.rb @@ -68,6 +68,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_escape to #method_calls" do + expect(subject.method_calls.last).to eq(:java_escape) + end + end + describe "--js" do let(:argv) { %w[--js] }