fix for option import issue when options had spaces

git-svn-id: file:///home/svn/incoming/trunk@3571 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2006-03-16 16:33:32 +00:00
parent bd862a5049
commit a6726c8df7
3 changed files with 10 additions and 7 deletions

View File

@ -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

2
msfcli
View File

@ -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'

View File

@ -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)