lib/ronin/cli/commands/unhexdump.rb in ronin-2.0.0.beta4 vs lib/ronin/cli/commands/unhexdump.rb in ronin-2.0.0.beta5
- old
+ new
@@ -15,11 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with Ronin. If not, see <https://www.gnu.org/licenses/>.
#
require 'ronin/cli/command'
-require 'ronin/support/binary/hexdump/parser'
+require 'ronin/support/binary/unhexdump/parser'
module Ronin
class CLI
module Commands
#
@@ -30,11 +30,11 @@
# ronin unhexdump [options] [FILE]
#
# ## Options
#
# -o, --output FILE Optional output file
- # -f, --format od|hexdump Format of the hexdump input (Default: hexdump)
+ # -f, --format hexdump|od Format of the hexdump input (Default: hexdump)
# -t int8|uint8|char|uchar|byte|int16|int16_le|int16_be|int16_ne|uint16|uint16_le|uint16_be|uint16_ne|short|short_le|short_be|short_ne|ushort|ushort_le|ushort_be|ushort_ne|int32|int32_le|int32_be|int32_ne|uint32|uint32_le|uint32_be|uint32_ne|int|long|long_le|long_be|long_ne|uint|ulong|ulong_le|ulong_be|ulong_ne|int64|int64_le|int64_be|int64_ne|uint64|uint64_le|uint64_be|uint64_ne|long_long|long_long_le|long_long_be|long_long_ne|ulong_long|ulong_long_le|ulong_long_be|ulong_long_ne|float|float_le|float_be|float_ne|double|double_le|double_be|double_ne,
# --type The binary data type to decode the data as
# -b, --base 2|8|10|16 Numerical base of the hexdumped numbers
# -A, --address-base 2|8|10|16 Numerical base of the address column
# --[no-]named-chars Enables parsing of od-style named charactters
@@ -122,11 +122,11 @@
},
desc: 'Optional output file'
option :format, short: '-f',
value: {
- type: [:od, :hexdump],
+ type: [:hexdump, :od],
default: :hexdump
},
desc: 'Format of the hexdump input'
option :type, short: '-t',
@@ -156,11 +156,11 @@
#
# @param [String, nil] file
# Optional input file.
#
def run(file=nil)
- parser = Support::Binary::Hexdump::Parser.new(
+ parser = Support::Binary::Unhexdump::Parser.new(
**hexdump_parser_options
)
input = if file
begin
@@ -180,10 +180,13 @@
else
stdout.write(data)
end
end
+ # Maps command-line options to
+ # `Ronin::Support::Binary::Unhexdump::Parser#initialize` keyword
+ # arguments.
HEXDUMP_PARSER_OPTIONS = [
:format,
:type,
:address_base,
:base,
@@ -191,10 +194,10 @@
]
#
# Builds a keyword arguments `Hash` of all command `options` that will
# be directly passed to
- # `Ronin::Support::Binary::Hexdump::Parser#initialize`.
+ # `Ronin::Support::Binary::Unhexdump::Parser#initialize`.
#
# @return [Hash{Symbol => Object}]
#
def hexdump_parser_options
kwargs = {}