Skip to content

Commit

Permalink
Added the --java option to ronin unescape (closes #238).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 23, 2024
1 parent 84020b2 commit 1cd2d4f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ronin/cli/commands/unescape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ class Unescape < StringMethodsCommand
@method_calls << :http_unescape
end

option :java, short: '-J',
desc: 'Java unescapes the data' do
require 'ronin/support/encoding/java'
@method_calls << :java_unescape
end

option :js, short: '-j',
desc: 'JavaScript unescapes the data' do
require 'ronin/support/encoding/js'
Expand Down
3 changes: 3 additions & 0 deletions man/ronin-unescape.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Unescapes each escaped character from a variety of encodings.
`--http`
: HTTP unescapes the data.

`-J`, `--java`
: Java unescapes the data.

`-j`, `--js`
: JavaScript unescapes the data.

Expand Down
12 changes: 12 additions & 0 deletions spec/cli/commands/unescape_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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_unescape to #method_calls" do
expect(subject.method_calls.last).to eq(:java_unescape)
end
end

describe "--js" do
let(:argv) { %w[--js] }

Expand Down

0 comments on commit 1cd2d4f

Please sign in to comment.