File tree Expand file tree Collapse file tree 5 files changed +15
-35
lines changed
metasploit/framework/data_service
msf/ui/console/command_dispatcher Expand file tree Collapse file tree 5 files changed +15
-35
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ def run_remote_db_process(opts)
199
199
@pid = wait_t [ 0 ] . pid
200
200
puts "Started process with pid #{ @pid } "
201
201
202
- endpoint = Metasploit :: Framework :: DataService :: RemoteServiceEndpoint . new ( ' localhost' , 8080 )
202
+ endpoint = URI . parse ( 'http:// localhost: 8080' )
203
203
remote_host_data_service = Metasploit ::Framework ::DataService ::RemoteHTTPDataService . new ( endpoint )
204
204
register_data_service ( remote_host_data_service , true )
205
205
end
Original file line number Diff line number Diff line change @@ -20,11 +20,11 @@ class RemoteHTTPDataService
20
20
POST_REQUEST = 'POST'
21
21
22
22
#
23
- # @param endpoint - A RemoteServiceEndpoint . Cannot be nil
23
+ # @param [String] endpoint A valid http or https URL . Cannot be nil
24
24
#
25
25
def initialize ( endpoint )
26
26
validate_endpoint ( endpoint )
27
- @endpoint = endpoint
27
+ @endpoint = URI . parse ( endpoint )
28
28
build_client_pool ( 5 )
29
29
end
30
30
@@ -175,7 +175,6 @@ def initialize(response)
175
175
176
176
def validate_endpoint ( endpoint )
177
177
raise 'Endpoint cannot be nil' if endpoint . nil?
178
- raise "Endpoint: #{ endpoint . class } not of type RemoteServiceEndpoint" unless endpoint . is_a? ( RemoteServiceEndpoint )
179
178
end
180
179
181
180
def append_workspace ( data_hash )
@@ -224,7 +223,10 @@ def build_client_pool(size)
224
223
@client_pool = Queue . new ( )
225
224
( 1 ..size ) . each {
226
225
http = Net ::HTTP . new ( @endpoint . host , @endpoint . port )
227
- http . use_ssl = true if @endpoint . use_ssl
226
+ if @endpoint . is_a? ( URI ::HTTPS )
227
+ http . use_ssl = true
228
+ http . verify_mode = OpenSSL ::SSL ::VERIFY_NONE
229
+ end
228
230
@client_pool << http
229
231
}
230
232
end
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ def load_job_handlers
42
42
end
43
43
44
44
def inject_data_service
45
- remote_service_endpoint = Metasploit :: Framework :: DataService :: RemoteServiceEndpoint . new ( CONSOLE_SERVICE_HOST_NAME , CONSOLE_SERVICE_PORT )
46
- remote_data_service = Metasploit ::Framework ::DataService ::RemoteHTTPDataService . new ( remote_service_endpoint )
45
+ endpoint = URI . parse ( "http:// #{ CONSOLE_SERVICE_HOST_NAME } : #{ CONSOLE_SERVICE_PORT } " )
46
+ remote_data_service = Metasploit ::Framework ::DataService ::RemoteHTTPDataService . new ( endpoint )
47
47
remote_data_service . set_header ( SESSION_KEY_VALUE , @session_key )
48
48
data_service_manager = Metasploit ::Framework ::DataService ::DataProxy . instance
49
49
data_service_manager . register_data_service ( remote_data_service )
Original file line number Diff line number Diff line change @@ -100,17 +100,21 @@ def cmd_list_data_services()
100
100
end
101
101
102
102
def cmd_add_data_service ( *args )
103
+ protocol = "http"
103
104
while ( arg = args . shift )
104
105
case arg
105
106
when '-h'
106
107
host = args . shift
107
108
when '-p'
108
109
port = args . shift
110
+ when '-s'
111
+ protocol = "https"
112
+ args . shift
109
113
end
110
114
end
111
115
112
- remote_service_endpoint = Metasploit :: Framework :: DataService :: RemoteServiceEndpoint . new ( host , port )
113
- remote_data_service = Metasploit ::Framework ::DataService ::RemoteHTTPDataService . new ( remote_service_endpoint )
116
+ endpoint = " #{ protocol } :// #{ host } : #{ port } "
117
+ remote_data_service = Metasploit ::Framework ::DataService ::RemoteHTTPDataService . new ( endpoint )
114
118
data_service_manager = Metasploit ::Framework ::DataService ::DataProxy . instance
115
119
data_service_manager . register_data_service ( remote_data_service )
116
120
end
You can’t perform that action at this time.
0 commit comments