Skip to content

Commit

Permalink
Land #18952, Updates Postgres hashdump module to now work with newer …
Browse files Browse the repository at this point in the history
…versions of Postgres
  • Loading branch information
adfoster-r7 committed Mar 12, 2024
2 parents 1baf868 + a33e7a7 commit 81e96d3
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions modules/auxiliary/scanner/postgres/postgres_hashdump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,27 @@ def run_host(ip)
workspace_id: myworkspace_id
}

credential_data = {
origin_type: :service,
jtr_format: 'raw-md5,postgres',
module_fullname: self.fullname,
private_type: :postgres_md5
}

credential_data.merge!(service_data)


res[:complete].rows.each do |row|
next if row[0].nil? or row[1].nil?
next if row[0].empty? or row[1].empty?

password = row[1]

credential_data[:username] = row[0]
credential_data[:private_data] = password
credential_data = {
origin_type: :service,
module_fullname: self.fullname,
private_data: password,
username: row[0]
}

if password.start_with?('md5')
credential_data[:private_type] = :postgres_md5
credential_data[:jtr_format] = 'raw-md5,postgres'
else
credential_data[:private_type] = :nonreplayable_hash
end

credential_data.merge!(service_data)

credential_core = create_credential(credential_data)
login_data = {
Expand Down

0 comments on commit 81e96d3

Please sign in to comment.