Skip to content

Commit

Permalink
Added the --python option to ronin unquote (closes #240).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 23, 2024
1 parent 70c20ac commit 61e154d
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/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
# --python Unquotes the PowerShell String
# -R, --ruby Unquotes the Ruby String
# -h, --help Print help information
#
Expand Down Expand Up @@ -78,6 +79,11 @@ class Unquote < StringMethodsCommand
@method_calls << :powershell_unquote
end

option :python, desc: 'Unquotes the PowerShell String' do
require 'ronin/support/encoding/python'
@method_calls << :python_unquote
end

option :ruby, short: '-R',
desc: 'Unquotes the Ruby String' do
require 'ronin/support/encoding/ruby'
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.

`--python`
: Unquotes the Python String.

`-R`, `--ruby`
: Unquotes the Ruby 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 "--python" do
let(:argv) { %w[--python] }

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

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

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

Expand Down

0 comments on commit 61e154d

Please sign in to comment.