Skip to content

Commit

Permalink
Added the --sql option to ronin decode (closes #194).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Nov 24, 2024
1 parent a6d96a3 commit 0b5807b
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 @@ -56,6 +56,7 @@ module Commands
# -p, --php Decodes the data as a PHP string
# --python Decodes the data as a Python string
# -R, --ruby Decodes the data as a Ruby string
# --sql Decodes the data as a SQL string
# --uudecode uudecodes the data
# -x, --xml XML decodes the data
# -h, --help Print help information
Expand Down Expand Up @@ -203,6 +204,11 @@ class Decode < StringMethodsCommand
@method_calls << :ruby_decode
end

option :sql, desc: 'Decodes the data as a SQL string' do
require 'ronin/support/encoding/sql'
@method_calls << :sql_decode
end

option :uudecode, desc: 'uudecodes the data' do
require 'ronin/support/encoding/uuencoding'
@method_calls << :uudecode
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 @@ -102,6 +102,9 @@ Decodes each character of the given data from a variety of formats.
`--uudecode`
: uudecodes the data.

`--sql`
: Decodes the data as a SQL string.

`-x`, `--xml`
: XML 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 @@ -264,6 +264,18 @@
end
end

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

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

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

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

Expand Down

0 comments on commit 0b5807b

Please sign in to comment.