diff --git a/lib/ronin/cli/commands/decode.rb b/lib/ronin/cli/commands/decode.rb index 1d2c56014..5497ffa3b 100644 --- a/lib/ronin/cli/commands/decode.rb +++ b/lib/ronin/cli/commands/decode.rb @@ -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 @@ -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' diff --git a/man/ronin-decode.1.md b/man/ronin-decode.1.md index 7050ffd34..b4a21ad26 100644 --- a/man/ronin-decode.1.md +++ b/man/ronin-decode.1.md @@ -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. diff --git a/spec/cli/commands/decode_spec.rb b/spec/cli/commands/decode_spec.rb index f612ba2c6..9ecf20ab7 100644 --- a/spec/cli/commands/decode_spec.rb +++ b/spec/cli/commands/decode_spec.rb @@ -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] }