diff --git a/lib/msf/core/data_store.rb b/lib/msf/core/data_store.rb index 149f554d8f..8d45edab98 100644 --- a/lib/msf/core/data_store.rb +++ b/lib/msf/core/data_store.rb @@ -57,14 +57,16 @@ class DataStore < Hash # Imports option values from a whitespace separated string in # VAR=VAL format. # - def import_options_from_s(option_str) + def import_options_from_s(option_str, delim = nil) hash = {} # Figure out the deliminter, default to space. - delim = /\s/ + if (delim.nil?) + delim = /\s/ - if (option_str.split('=').length <= 2 or option_str.index(',') != nil) - delim = ',' + if (option_str.split('=').length <= 2 or option_str.index(',') != nil) + delim = ',' + end end # Split on the deliminter diff --git a/msfcli b/msfcli index 3562ce15bf..3c4a1e8bdc 100755 --- a/msfcli +++ b/msfcli @@ -70,7 +70,7 @@ exploit.init_ui( mode = ARGV.pop || 'h' # Import options -exploit.datastore.import_options_from_s(ARGV.join(' ')) +exploit.datastore.import_options_from_s(ARGV.join('_|_'), '_|_') case mode.downcase when 'h' diff --git a/msfencode b/msfencode index 6aa2f9bf44..5a715112ef 100755 --- a/msfencode +++ b/msfencode @@ -83,6 +83,7 @@ encoder = nil fmt = "c" input = $stdin options = '' +delim = '_|_' # Parse the argument and rock that shit. $args.parse(ARGV) { |opt, idx, val| @@ -117,7 +118,7 @@ $args.parse(ARGV) { |opt, idx, val| usage else if (val =~ /=/) - options += ((options.length > 0) ? "," : "") + "#{val}" + options += ((options.length > 0) ? delim : "") + "#{val}" end end } @@ -144,7 +145,7 @@ case cmd next if not enc begin # Imports options - enc.datastore.import_options_from_s(options) + enc.datastore.import_options_from_s(options, delim) # Encode it upt raw = enc.encode(buf, badchars)