Skip to content

Commit

Permalink
Added the --perl option to ronin decode (closes #226).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 23, 2024
1 parent cd22fcf commit 339a691
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/decode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module Commands
# -P, --powershell Encodes the data as a PowerShell String
# --punycode Decodes the data as Punycode
# -Q, --quoted-printable Decodes the data as Quoted Printable
# --perl Perl decodes the data
# -p, --php PHP decodes the data
# --python Python decodes the data
# -R, --ruby Ruby decodes the data
Expand Down Expand Up @@ -164,6 +165,11 @@ class Decode < StringMethodsCommand
@method_calls << :quoted_printable_decode
end

option :perl, desc: 'Perl decodes the data' do
require 'ronin/support/encoding/perl'
@method_calls << :perl_decode
end

option :php, short: '-p',
desc: 'PHP decodes the data' do
require 'ronin/support/encoding/php'
Expand Down
3 changes: 3 additions & 0 deletions man/ronin-decode.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ Decodes each character of the given data from a variety of formats.
`-Q`, `--quoted-printable`
: Decodes the data as Quoted Printable.

`--perl`
: Perl decodes the data.

`-p`, `--php`
: PHP decodes the data.

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

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

Expand Down

0 comments on commit 339a691

Please sign in to comment.