Land #8622, normalize short meterpreter command flags

bug/bundler_fix
Brent Cook 2017-06-27 02:09:12 -05:00
commit 0f48afa7ba
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
3 changed files with 43 additions and 47 deletions

View File

@ -512,7 +512,7 @@ class Console::CommandDispatcher::Android
'-h' => [ false, 'Help Banner' ], '-h' => [ false, 'Help Banner' ],
'-d' => [ true, 'Destination number' ], '-d' => [ true, 'Destination number' ],
'-t' => [ true, 'SMS body text' ], '-t' => [ true, 'SMS body text' ],
'-dr' => [ false, 'Wait for delivery report' ] '-r' => [ false, 'Wait for delivery report' ]
) )
dest = '' dest = ''
@ -530,7 +530,7 @@ class Console::CommandDispatcher::Android
dest = val dest = val
when '-t' when '-t'
body = val body = val
when '-dr' when '-r'
dr = true dr = true
end end
end end

View File

@ -604,25 +604,24 @@ class Console::CommandDispatcher::Core
# Arguments for transport switching # Arguments for transport switching
# #
@@transport_opts = Rex::Parser::Arguments.new( @@transport_opts = Rex::Parser::Arguments.new(
'-t' => [true, "Transport type: #{Rex::Post::Meterpreter::ClientCore::VALID_TRANSPORTS.keys.join(', ')}"], '-t' => [true, "Transport type: #{Rex::Post::Meterpreter::ClientCore::VALID_TRANSPORTS.keys.join(', ')}"],
'-l' => [true, 'LHOST parameter (for reverse transports)'], '-l' => [true, 'LHOST parameter (for reverse transports)'],
'-p' => [true, 'LPORT parameter'], '-p' => [true, 'LPORT parameter'],
'-i' => [true, 'Specify transport by index (currently supported: remove)'], '-i' => [true, 'Specify transport by index (currently supported: remove)'],
'-u' => [true, 'Custom URI for HTTP/S transports (used when removing transports)'], '-u' => [true, 'Local URI for HTTP/S transports (used when adding/changing transports with a custom LURI)'],
'-lu' => [true, 'Local URI for HTTP/S transports (used when adding/changing transports with a custom LURI)'], '-c' => [true, 'SSL certificate path for https transport verification (optional)'],
'-ua' => [true, 'User agent for HTTP/S transports (optional)'], '-A' => [true, 'User agent for HTTP/S transports (optional)'],
'-ph' => [true, 'Proxy host for HTTP/S transports (optional)'], '-H' => [true, 'Proxy host for HTTP/S transports (optional)'],
'-pp' => [true, 'Proxy port for HTTP/S transports (optional)'], '-P' => [true, 'Proxy port for HTTP/S transports (optional)'],
'-pu' => [true, 'Proxy username for HTTP/S transports (optional)'], '-U' => [true, 'Proxy username for HTTP/S transports (optional)'],
'-ps' => [true, 'Proxy password for HTTP/S transports (optional)'], '-N' => [true, 'Proxy password for HTTP/S transports (optional)'],
'-pt' => [true, 'Proxy type for HTTP/S transports (optional: http, socks; default: http)'], '-B' => [true, 'Proxy type for HTTP/S transports (optional: http, socks; default: http)'],
'-c' => [true, 'SSL certificate path for https transport verification (optional)'], '-C' => [true, 'Comms timeout (seconds) (default: same as current session)'],
'-to' => [true, 'Comms timeout (seconds) (default: same as current session)'], '-X' => [true, 'Expiration timout (seconds) (default: same as current session)'],
'-ex' => [true, 'Expiration timout (seconds) (default: same as current session)'], '-T' => [true, 'Retry total time (seconds) (default: same as current session)'],
'-rt' => [true, 'Retry total time (seconds) (default: same as current session)'], '-W' => [true, 'Retry wait time (seconds) (default: same as current session)'],
'-rw' => [true, 'Retry wait time (seconds) (default: same as current session)'], '-v' => [false, 'Show the verbose format of the transport list'],
'-v' => [false, 'Show the verbose format of the transport list'], '-h' => [false, 'Help menu'])
'-h' => [false, 'Help menu'])
# #
# Display help for transport management. # Display help for transport management.
@ -666,7 +665,6 @@ class Console::CommandDispatcher::Core
:transport => nil, :transport => nil,
:lhost => nil, :lhost => nil,
:lport => nil, :lport => nil,
:uri => nil,
:ua => nil, :ua => nil,
:proxy_host => nil, :proxy_host => nil,
:proxy_port => nil, :proxy_port => nil,
@ -687,31 +685,29 @@ class Console::CommandDispatcher::Core
case opt case opt
when '-c' when '-c'
opts[:cert] = val opts[:cert] = val
when '-u'
opts[:uri] = val
when '-i' when '-i'
transport_index = val.to_i transport_index = val.to_i
when '-lu' when '-u'
opts[:luri] = val opts[:luri] = val
when '-ph' when '-H'
opts[:proxy_host] = val opts[:proxy_host] = val
when '-pp' when '-P'
opts[:proxy_port] = val.to_i opts[:proxy_port] = val.to_i
when '-pt' when '-B'
opts[:proxy_type] = val opts[:proxy_type] = val
when '-pu' when '-U'
opts[:proxy_user] = val opts[:proxy_user] = val
when '-ps' when '-N'
opts[:proxy_pass] = val opts[:proxy_pass] = val
when '-ua' when '-A'
opts[:ua] = val opts[:ua] = val
when '-to' when '-C'
opts[:comm_timeout] = val.to_i if val opts[:comm_timeout] = val.to_i if val
when '-ex' when '-X'
opts[:session_exp] = val.to_i if val opts[:session_exp] = val.to_i if val
when '-rt' when '-T'
opts[:retry_total] = val.to_i if val opts[:retry_total] = val.to_i if val
when '-rw' when '-W'
opts[:retry_wait] = val.to_i if val opts[:retry_wait] = val.to_i if val
when '-p' when '-p'
opts[:lport] = val.to_i if val opts[:lport] = val.to_i if val

View File

@ -90,10 +90,10 @@ class Console::CommandDispatcher::Kiwi
'-h' => [false, 'Help banner'], '-h' => [false, 'Help banner'],
'-u' => [true, 'User name of the password to change.'], '-u' => [true, 'User name of the password to change.'],
'-s' => [true, 'Server to perform the action on (eg. Domain Controller).'], '-s' => [true, 'Server to perform the action on (eg. Domain Controller).'],
'-op' => [true, 'The known existing/old password (do not use with -oh).'], '-p' => [true, 'The known existing/old password (do not use with -n).'],
'-oh' => [true, 'The known existing/old hash (do not use with -op).'], '-n' => [true, 'The known existing/old hash (do not use with -p).'],
'-np' => [true, 'The new password to set for the account (do not use with -nh).'], '-P' => [true, 'The new password to set for the account (do not use with -N).'],
'-nh' => [true, 'The new hash to set for the account (do not use with -np).'] '-N' => [true, 'The new hash to set for the account (do not use with -P).']
) )
def cmd_password_change_usage def cmd_password_change_usage
@ -116,35 +116,35 @@ class Console::CommandDispatcher::Kiwi
opts[:user] = val opts[:user] = val
when '-s' when '-s'
opts[:server] = val opts[:server] = val
when '-op' when '-p'
opts[:old_pass] = val opts[:old_pass] = val
when '-oh' when '-n'
opts[:old_hash] = val opts[:old_hash] = val
when '-np' when '-P'
opts[:new_pass] = val opts[:new_pass] = val
when '-nh' when '-N'
opts[:new_hash] = val opts[:new_hash] = val
end end
} }
valid = true valid = true
if opts[:old_pass] && opts[:old_hash] if opts[:old_pass] && opts[:old_hash]
print_error('Options -op and -oh cannot be used together.') print_error('Options -p and -n cannot be used together.')
valid = false valid = false
end end
if opts[:new_pass] && opts[:new_hash] if opts[:new_pass] && opts[:new_hash]
print_error('Options -np and -nh cannot be used together.') print_error('Options -P and -N cannot be used together.')
valid = false valid = false
end end
unless opts[:old_pass] || opts[:old_hash] unless opts[:old_pass] || opts[:old_hash]
print_error('At least one of -op and -oh must be specified.') print_error('At least one of -p and -n must be specified.')
valid = false valid = false
end end
unless opts[:new_pass] || opts[:new_hash] unless opts[:new_pass] || opts[:new_hash]
print_error('At least one of -np and -nh must be specified.') print_error('At least one of -P and -N must be specified.')
valid = false valid = false
end end