diff --git a/lib/ronin/cli/commands/decode.rb b/lib/ronin/cli/commands/decode.rb index aa10337fe..6a3a29cec 100644 --- a/lib/ronin/cli/commands/decode.rb +++ b/lib/ronin/cli/commands/decode.rb @@ -45,6 +45,7 @@ module Commands # -u, --uri URI decodes the data # --http HTTP decodes the data # -j, --js Decodes the data as a JavaScript string + # -n, --nodejs Decodes the data as a Node.js string # -S, --shell Decodes the data as a Shell string # -P, --powershell Decodes the data as a PowerShell string # --punycode Decodes the data as Punycode @@ -136,6 +137,12 @@ class Decode < StringMethodsCommand @method_calls << :js_decode end + option :nodejs, short: '-n', + desc: 'Decodes the data as a Node.js string' do + require 'ronin/support/encoding/node_js' + @method_calls << :node_js_decode + end + option :shell, short: '-S', desc: 'Decodes the data as a Shell string' do require 'ronin/support/encoding/shell' diff --git a/man/ronin-decode.1.md b/man/ronin-decode.1.md index bee2efa61..09f251c7b 100644 --- a/man/ronin-decode.1.md +++ b/man/ronin-decode.1.md @@ -66,6 +66,9 @@ Decodes each character of the given data from a variety of formats. `-j`, `--js` : JavaScript decodes the data. +`-n`, `--nodejs` +: Decodes the data as a Node.js string. + `-S`, `--shell` : Decodes the data as a Shell string. diff --git a/spec/cli/commands/decode_spec.rb b/spec/cli/commands/decode_spec.rb index d2d986e0b..667bbc821 100644 --- a/spec/cli/commands/decode_spec.rb +++ b/spec/cli/commands/decode_spec.rb @@ -132,6 +132,18 @@ end end + describe "--nodejs" do + let(:argv) { %w[--nodejs] } + + it "must require 'ronin/support/encoding/node_js'" do + expect(require('ronin/support/encoding/node_js')).to be(false) + end + + it "must add :node_js_decode to #method_calls" do + expect(subject.method_calls.last).to eq(:node_js_decode) + end + end + describe "--shell" do let(:argv) { %w[--shell] }