Skip to content

Commit 1ae9265

Browse files
committed
Update tortoisesvn to use the new cred API
1 parent c721cb6 commit 1ae9265

File tree

1 file changed

+45
-16
lines changed

1 file changed

+45
-16
lines changed

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

Lines changed: 45 additions & 16 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+
host: ::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,33 @@ 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+
post_reference_name: self.refname,
137+
session_id: session_db_id,
138+
origin_type: :session,
139+
private_data: opts[:password],
140+
private_type: :password,
141+
username: opts[:user]
142+
}.merge(service_data)
143+
144+
login_data = {
145+
core: create_credential(credential_data),
146+
status: Metasploit::Model::Login::Status::UNTRIED,
147+
}.merge(service_data)
148+
149+
create_credential_login(login_data)
150+
end
151+
152+
125153
def analyze_file(filename)
126154
config = client.fs.file.new(filename, 'r')
127155
contents = config.read
@@ -177,14 +205,15 @@ def analyze_file(filename)
177205
else
178206
source_id = nil
179207
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)
208+
209+
report_cred(
210+
ip: ::Rex::Socket.resolv_to_dotted(host), # XXX: Workaround for unresolved hostnames
211+
port: portnum,
212+
service_name: sname,
213+
user: user_name,
214+
password: password
215+
)
216+
188217
vprint_status("Should have reported...")
189218

190219
# Set savedpwds to 1 on return

0 commit comments

Comments
 (0)