@@ -395,6 +395,37 @@ def rpc_meterpreter_script( sid, data)
395
395
rpc_meterpreter_run_single ( sid , "run #{ data } " )
396
396
end
397
397
398
+ # Changes the Transport of a given Meterpreter Session
399
+ #
400
+ # @option opts [String] :transport The transport protocol to use (e.g. reverse_tcp, reverse_http, bind_tcp etc)
401
+ # @option opts [String] :lhost The LHOST of the listener to use
402
+ # @option opts [String] :lport The LPORT of the listener to use
403
+ # @option opts [String] :ua The User Agent String to use for reverse_http(s)
404
+ # @option opts [String] :proxy_host The address of the proxy to route transport through
405
+ # @option opts [String] :proxy_port The port the proxy is listening on
406
+ # @option opts [String] :proxy_type The type of proxy to use
407
+ # @option opts [String] :proxy_user The username to authenticate to the proxy with
408
+ # @option opts [String] :proxy_pass The password to authenticate to the proxy with
409
+ # @option opts [String] :comm_timeout Connection timeout in seconds
410
+ # @option opts [String] :session_exp Session Expiration Timeout
411
+ # @option opts [String] :retry_total Total number of times to retry etsablishing the transport
412
+ # @option opts [String] :retry_wait The number of seconds to wait between retries
413
+ # @option opts [String] :cert Path to the SSL Cert to use for HTTPS
414
+ # @return [Boolean] whether the transport was changed successfully
415
+ def rpc_meterpreter_transport_change ( sid , opts = { } )
416
+ session = _valid_session ( sid , "meterpreter" )
417
+ real_opts = { }
418
+ opts . each_pair do |key , value |
419
+ real_opts [ key . to_sym ] = value
420
+ end
421
+ real_opts [ :uuid ] = session . payload_uuid
422
+ result = session . core . transport_change ( real_opts )
423
+ if result == true
424
+ rpc_stop ( sid )
425
+ end
426
+ result
427
+ end
428
+
398
429
399
430
# Returns the separator used by the meterpreter.
400
431
#
0 commit comments