Skip to content

Commit

Permalink
Added the --php option to ronin unquote (closes #242).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 23, 2024
1 parent c1c6488 commit 6605870
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ronin/cli/commands/unquote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module Commands
# -j, --js Unquotes the JavaScript String
# -S, --shell Unquotes the Shell String
# -P, --powershell Unquotes the PowerShell String
# -p, --php Unquotes the PHP String
# --python Unquotes the PowerShell String
# -R, --ruby Unquotes the Ruby String
# -h, --help Print help information
Expand Down Expand Up @@ -79,6 +80,12 @@ class Unquote < StringMethodsCommand
@method_calls << :powershell_unquote
end

option :php, short: '-p',
desc: 'Unquotes the PHP String' do
require 'ronin/support/encoding/php'
@method_calls << :php_unquote
end

option :python, desc: 'Unquotes the PowerShell String' do
require 'ronin/support/encoding/python'
@method_calls << :python_unquote
Expand Down
3 changes: 3 additions & 0 deletions man/ronin-unquote.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Unquotes a double/single quoted string.
`-P`, `--powershell`
: Unquotes the PowerShell String.

`-p`, `--php`
: Unquotes the PHP String.

`--python`
: Unquotes the Python String.

Expand Down
12 changes: 12 additions & 0 deletions spec/cli/commands/unquote_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@
end
end

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

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

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

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

Expand Down

0 comments on commit 6605870

Please sign in to comment.