Skip to content

Commit dca2607

Browse files
committed
Land rapid7#5452, @wchen-r7 Update tortoisesvn to use the new cred API
2 parents c3437da + bf35b9b commit dca2607

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

modules/post/windows/gather/credentials/tortoisesvn.rb

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@ def get_proxy_data
8989
else
9090
source_id = nil
9191
end
92-
report_auth_info(
93-
:host => Rex::Socket.resolv(http_proxy_host), # TODO: Fix up report_host?
94-
:port => http_proxy_port,
95-
:sname => "http",
96-
:source_id => source_id,
97-
:source_type => "exploit",
98-
:user => http_proxy_username,
99-
:pass => http_proxy_password)
92+
93+
report_cred(
94+
ip: ::Rex::Socket.resolv(http_proxy_host), # TODO: Fix up report_host?
95+
port: http_proxy_port,
96+
service_name: 'http',
97+
user: http_proxy_username,
98+
password: http_proxy_password
99+
)
100+
100101
end
101102

102103
def get_config_files
@@ -122,6 +123,34 @@ def get_config_files
122123

123124
end
124125

126+
def report_cred(opts)
127+
service_data = {
128+
address: opts[:ip],
129+
port: opts[:port],
130+
service_name: opts[:service_name],
131+
protocol: 'tcp',
132+
workspace_id: myworkspace_id
133+
}
134+
135+
credential_data = {
136+
module_fullname: fullname,
137+
post_reference_name: self.refname,
138+
session_id: session_db_id,
139+
origin_type: :session,
140+
private_data: opts[:password],
141+
private_type: :password,
142+
username: opts[:user]
143+
}.merge(service_data)
144+
145+
login_data = {
146+
core: create_credential(credential_data),
147+
status: Metasploit::Model::Login::Status::UNTRIED,
148+
}.merge(service_data)
149+
150+
create_credential_login(login_data)
151+
end
152+
153+
125154
def analyze_file(filename)
126155
config = client.fs.file.new(filename, 'r')
127156
contents = config.read
@@ -177,14 +206,15 @@ def analyze_file(filename)
177206
else
178207
source_id = nil
179208
end
180-
report_auth_info(
181-
:host => ::Rex::Socket.resolv_to_dotted(host), # XXX: Workaround for unresolved hostnames
182-
:port => portnum,
183-
:sname => sname,
184-
:source_id => source_id,
185-
:source_type => "exploit",
186-
:user => user_name,
187-
:pass => password)
209+
210+
report_cred(
211+
ip: ::Rex::Socket.resolv_to_dotted(host), # XXX: Workaround for unresolved hostnames
212+
port: portnum,
213+
service_name: sname,
214+
user: user_name,
215+
password: password
216+
)
217+
188218
vprint_status("Should have reported...")
189219

190220
# Set savedpwds to 1 on return
@@ -202,8 +232,8 @@ def run
202232
else
203233
print_status("Searching for TortoiseSVN...")
204234
prepare_railgun
205-
get_config_files()
206-
get_proxy_data()
235+
get_config_files
236+
get_proxy_data
207237
end
208238

209239
print_status("Complete")

0 commit comments

Comments
 (0)