Skip to content

Commit

Permalink
Added the --perl option to ronin quote (closes #245).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 23, 2024
1 parent b1b4156 commit 686fdd7
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/quote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module Commands
# -j, --js JavaScript quotes the data
# -S, --shell Quotes the data as a Shell String
# -P, --powershell Quotes the data as a PowerShell String
# --perl Quotes the data as a Perl String
# -p, --php Quotes the data as a PHP String
# --python Quotes the data as a Python String
# -R, --ruby Quotes the data as a Ruby String
Expand Down Expand Up @@ -80,6 +81,11 @@ class Quote < StringMethodsCommand
@method_calls << :powershell_string
end

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

option :php, short: '-p',
desc: 'Quotes the data as a PHP String' do
require 'ronin/support/encoding/php'
Expand Down
3 changes: 3 additions & 0 deletions man/ronin-quote.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Produces quoted a string for a variety of programming languages.
`-P`, `--powershell`
: Quotes the data as a PowerShell String.

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

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

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

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

Expand Down

0 comments on commit 686fdd7

Please sign in to comment.