Skip to content

Commit

Permalink
Added the --perl option to ronin unescape (closes #228).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 23, 2024
1 parent ca5e3bb commit b1b4156
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 @@ -43,6 +43,7 @@ module Commands
# -n, --nodejs Node.js unescapes the data
# -S, --shell Unescapes the data as a Shell String
# -P, --powershell Unescapes the data as a PowerShell String
# --perl Unescapes the data as a Perl String
# -p, --php Unescapes the data as a PHP String
# --python Unescapes the data as a Python String
# -R, --ruby Unescapes the data as a Ruby String
Expand Down Expand Up @@ -115,6 +116,11 @@ class Unescape < StringMethodsCommand
@method_calls << :quoted_printable_unescape
end

option :perl, desc: 'Unescapes the data as a Perl String' do
require 'ronin/support/encoding/perl'
@method_calls << :perl_unescape
end

option :php, short: '-p',
desc: 'Unescapes the data as a PHP String' do
require 'ronin/support/encoding/php'
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 @@ -62,6 +62,9 @@ Unescapes each escaped character from a variety of encodings.
`-Q`, `--quoted-printable`
: Unescapes the data as Quoted Printable.

`--perl`
: Unescapes the data as a Perl String.

`-p`, `--php`
: Unescapes the data as a PHP String.

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 @@ -128,6 +128,18 @@
end
end

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

it "must require 'ronin/support/encoding/perl'" do
expect(require('ronin/support/encoding/perl')).to be(false)
end

it "must add :perl_unescape to #method_calls" do
expect(subject.method_calls.last).to eq(:perl_unescape)
end
end

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

Expand Down

0 comments on commit b1b4156

Please sign in to comment.